KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > verge > mvc > controller > actionflow > config > NodeBuilder


1 /*
2  * Copyright (c) 2002, Inversoft Corporation, All Rights Reserved
3  */

4 package com.inversoft.verge.mvc.controller.actionflow.config;
5
6
7 import org.jdom.Element;
8
9 import com.inversoft.config.ConfigurationException;
10 import com.inversoft.verge.repository.config.RepositoryConfigRegistry;
11
12
13 /**
14  * <p>
15  * This interface describes the factory that is used to
16  * build the Node objects. Implementations of this
17  * class should be added to the
18  * ActionFlowConfigBuilders.properties file so that they are
19  * registered with the ComponentConfig system. You can read
20  * more on this {@link
21  * com.inversoft.config.component.ComponentConfigBuilder
22  * here}
23  * </p>
24  *
25  * <p>
26  * Each implementation is associated with a particular type
27  * of Node that might be specified in the configuration XML
28  * file. The type of the Node is specified using the type
29  * attribute on the node XML element. This type is also the
30  * key in the properties file.
31  * </p>
32  *
33  * <p>
34  * All implementors of this interface are pooled (flyweight)
35  * and therefore should not hold any state information about
36  * Node or Element objects.
37  * </p>
38  *
39  * @author Brian Pontarelli
40  * @since 2.0
41  * @version 2.0
42  */

43 public interface NodeBuilder {
44
45     /**
46      * Builds the Node instance from the Node Element given. This Element
47      * should contain all the information needed for building.
48      *
49      * @param namespace The namespace the new Node belongs to
50      * @param element The Element to build the Node from
51      * @return The Node that was built
52      * @throws ConfigurationException If the was any problem during building
53      */

54     Node build(Namespace namespace, Element element) throws ConfigurationException;
55
56     /**
57      * Handles any post build processing and building. This is called by the
58      * ActionFlowConfigBuilder class after all the configurations have been created. This
59      * includes all the namespaces and all the nodes. This is very useful for
60      * building objects that require Node objects such as ActionLinks and
61      * other similar classes. This also allows for cross-namespace lookups.
62      * <p>
63      * It is important to notice that the Element is not supplied to this method.
64      * This is due to the fact that the memory comsumption necessary to hash
65      * every element is quite larger and this also would require every Node
66      * to implement equals() and hashcode() correctly. Instead, if a Node
67      * needs post processing, it needs to be responsible for storing its own
68      * element and freeing that Element when finished.
69      *
70      * @param config The Node to post build process
71      * @param registry The ActionFlowConfigRegistry to use for looking recently
72      * built configuration objects up (if need be)
73      * @param repositoryRegistry The RepositoryConfigRegistry that can be used
74      * to determine if repository ids are valid
75      * @throws ConfigurationException If the was any problem during post building
76      */

77     void postBuild(Node config, ActionFlowConfigRegistry registry,
78             RepositoryConfigRegistry repositoryRegistry)
79     throws ConfigurationException;
80 }
81
82
Popular Tags