001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/authz/tags/sakai_2-4-1/authz-impl/impl/src/java/org/sakaiproject/authz/impl/FunctionManagerComponent.java $
003: * $Id: FunctionManagerComponent.java 7163 2006-03-28 20:44:51Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.authz.impl;
021:
022: import java.util.Iterator;
023: import java.util.List;
024: import java.util.Vector;
025:
026: import org.apache.commons.logging.Log;
027: import org.apache.commons.logging.LogFactory;
028: import org.sakaiproject.authz.api.FunctionManager;
029:
030: /**
031: * <p>
032: * FunctionManagerComponent implements the FunctionMananger API.
033: * </p>
034: *
035: * @author Sakai Software Development Team
036: */
037: public class FunctionManagerComponent implements FunctionManager {
038: /** Our log (commons). */
039: private static Log M_log = LogFactory
040: .getLog(FunctionManagerComponent.class);
041:
042: /** List of security functions. */
043: protected List m_registeredFunctions = new Vector();
044:
045: /**********************************************************************************************************************************************************************************************************************************************************
046: * Dependencies and their setter methods
047: *********************************************************************************************************************************************************************************************************************************************************/
048:
049: /**********************************************************************************************************************************************************************************************************************************************************
050: * Init and Destroy
051: *********************************************************************************************************************************************************************************************************************************************************/
052:
053: /**
054: * Final initialization, once all dependencies are set.
055: */
056: public void init() {
057: M_log.info("init()");
058: }
059:
060: /**
061: * Final cleanup.
062: */
063: public void destroy() {
064: M_log.info("destroy()");
065: }
066:
067: /**********************************************************************************************************************************************************************************************************************************************************
068: * Work interface methods: FunctionMananger
069: *********************************************************************************************************************************************************************************************************************************************************/
070:
071: /**
072: * @inheritDoc
073: */
074: public void registerFunction(String function) {
075: if (function == null)
076: return;
077:
078: m_registeredFunctions.add(function);
079: }
080:
081: /**
082: * @inheritDoc
083: */
084: public List getRegisteredFunctions() {
085: return new Vector(m_registeredFunctions);
086: }
087:
088: /**
089: * @inheritDoc
090: */
091: public List getRegisteredFunctions(String prefix) {
092: List rv = new Vector();
093:
094: for (Iterator i = m_registeredFunctions.iterator(); i.hasNext();) {
095: String function = (String) i.next();
096: if (function.startsWith(prefix)) {
097: rv.add(function);
098: }
099: }
100:
101: return rv;
102: }
103: }
|