KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > loom > components > util > factory > ComponentFactory


1 /*
2  * Copyright (C) The Loom Group. All rights reserved.
3  *
4  * This software is published under the terms of the Loom
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.loom.components.util.factory;
9
10 import org.codehaus.loom.components.util.info.ComponentInfo;
11
12 /**
13  * This interface defines the mechanism via which a component or its associated
14  * ComponentInfo can be created.
15  *
16  * <p>Usually the component or ComponentBundle will just be loaded from a
17  * particular ClassLoader. However if a developer wanted to dynamically assemble
18  * applications they could implement a custom factory that created components
19  * via non-standard mechanisms (say by wrapping remote, CORBA, or other style
20  * objects).</p>
21  *
22  * <p>The methods take a <code>implementationKey</code> parameter and usually
23  * this represents the class name of the component. However in alternative
24  * component systems this may designate objects via different mechanisms.</p>
25  *
26  * @author Peter Donald
27  * @version $Revision: 1.2 $ $Date: 2004/05/01 12:48:33 $
28  */

29 public interface ComponentFactory
30 {
31     /**
32      * Create a ComponentInfo for component specified by implementationKey.
33      *
34      * @param implementationKey the key indicating type of component (usually
35      * classname)
36      * @return the ComponentInfo for component
37      * @throws Exception if unable to create Info object
38      */

39     ComponentInfo createInfo( String JavaDoc implementationKey )
40         throws Exception JavaDoc;
41
42     /**
43      * Create an instance of component with specified implementationKey.
44      *
45      * @param implementationKey the key indicating type of component (usually
46      * classname)
47      * @return an instance of component
48      * @throws java.lang.Exception if unable to create component
49      */

50     Object JavaDoc createComponent( String JavaDoc implementationKey )
51         throws Exception JavaDoc;
52 }
53
Popular Tags