001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/component/tags/sakai_2-4-1/component-api/component/src/java/org/sakaiproject/component/api/ComponentManager.java $
003: * $Id: ComponentManager.java 8039 2006-04-20 17:01:39Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 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.component.api;
021:
022: import java.util.Properties;
023: import java.util.Set;
024:
025: /**
026: * <p>
027: * ...
028: * </p>
029: */
030: public interface ComponentManager {
031: /** The java system property name where the full path to the components packages. */
032: public static final String SAKAI_COMPONENTS_ROOT_SYS_PROP = "sakai.components.root";
033:
034: /**
035: * Find a component that is registered to provide this interface.
036: *
037: * @param iface
038: * The interface Class.
039: * @return a component instance, or null if not found.
040: */
041: Object get(Class iface);
042:
043: /**
044: * Find a component that is registered to provide this interface.
045: *
046: * @param ifaceName
047: * The fully qualified interface Class name.
048: * @return a component instance, or null if not found.
049: */
050: Object get(String ifaceName);
051:
052: /**
053: * Check if this interface Class has a registered component.
054: *
055: * @param iface
056: * The interface Class.
057: * @return <strong>true</strong> if this interface Class has a registered component, <strong>false</strong> if not.
058: */
059: boolean contains(Class iface);
060:
061: /**
062: * Check if this interface Class name has a registered component.
063: *
064: * @param ifaceName
065: * The fully qualified interface Class name.
066: * @return <strong>true</strong> if this interface has a registered component, <strong>false</strong> if not.
067: */
068: boolean contains(String ifaceName);
069:
070: /**
071: * Get all interfaces registered in the component manager.
072: *
073: * @return A Set (String class name) of all interfaces registered in the component manager.
074: */
075: Set getRegisteredInterfaces();
076:
077: /**
078: * Load a singleton already created component for this interface class as a singleton.
079: *
080: * @param iface
081: * The interface class.
082: * @param component
083: * The alread created component.
084: */
085: void loadComponent(Class iface, Object component);
086:
087: /**
088: * Load a singleton already created component for this interface class as a singleton.
089: *
090: * @param ifaceName
091: * The fully qualified interface Class name.
092: * @param component
093: * The alread created component.
094: */
095: void loadComponent(String ifaceName, Object component);
096:
097: /**
098: * Close the component manager, shutting down any created singletons.
099: */
100: void close();
101:
102: /**
103: * Access the configuration properties used when configuring components.
104: *
105: * @return The Properties with the configuration values used when configuring components.
106: */
107: Properties getConfig();
108:
109: /**
110: * Wait right here till the component manager is fully configured.
111: */
112: void waitTillConfigured();
113:
114: /**
115: * Check if the ComponentManager has already been or is in the processing of being closed.
116: * @return true if closed, false if not.
117: */
118: boolean hasBeenClosed();
119: }
|