001 /*
002 * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.osgi.service.component;
018
019 import java.util.Dictionary;
020
021 /**
022 * When a component is declared with the <code>factory</code> attribute on its
023 * <code>component</code> element, the Service Component Runtime will register
024 * a Component Factory service to allow new component configurations to be
025 * created and activated rather than automatically creating and activating
026 * component configuration as necessary.
027 *
028 * @ThreadSafe
029 * @version $Revision: 5654 $
030 */
031 public interface ComponentFactory {
032 /**
033 * Create and activate a new component configuration. Additional properties
034 * may be provided for the component configuration.
035 *
036 * @param properties Additional properties for the component configuration
037 * or <code>null</code> if there are no additional properties.
038 * @return A <code>ComponentInstance</code> object encapsulating the
039 * component instance of the component configuration. The component
040 * configuration has been activated and, if the component specifies
041 * a <code>service</code> element, the component instance has been
042 * registered as a service.
043 * @throws ComponentException If the Service Component Runtime is unable to
044 * activate the component configuration.
045 */
046 public ComponentInstance newInstance(Dictionary properties);
047 }