001    /**
002     * <copyright>
003     * </copyright>
004     *
005     * $Id$
006     */
007    package com.hammurapi.config;
008    
009    import java.io.File;
010    
011    import org.eclipse.emf.common.util.EList;
012    import org.eclipse.emf.ecore.EObject;
013    
014    import com.hammurapi.config.bootstrap.ConfigurationException;
015    import com.hammurapi.config.bootstrap.FactoryClosure;
016    import com.hammurapi.config.bootstrap.TokenExpander.TokenSource;
017    import com.hammurapi.config.runtime.FactoryConfig;
018    import com.hammurapi.party.CommonObject;
019    
020    /**
021     * <!-- begin-user-doc -->
022     * A representation of the model object '<em><b>Factory</b></em>'.
023     * <!-- end-user-doc -->
024     *
025     * <!-- begin-model-doc -->
026     * Creates an object which can be further configured (except Null) and referenced.
027     * <!-- end-model-doc -->
028     *
029     * <p>
030     * The following features are supported:
031     * <ul>
032     *   <li>{@link com.hammurapi.config.Factory#getDescription <em>Description</em>}</li>
033     *   <li>{@link com.hammurapi.config.Factory#getConfigScript <em>Config Script</em>}</li>
034     *   <li>{@link com.hammurapi.config.Factory#getId <em>Id</em>}</li>
035     *   <li>{@link com.hammurapi.config.Factory#getSource <em>Source</em>}</li>
036     *   <li>{@link com.hammurapi.config.Factory#isEnabled <em>Enabled</em>}</li>
037     *   <li>{@link com.hammurapi.config.Factory#getService <em>Service</em>}</li>
038     *   <li>{@link com.hammurapi.config.Factory#getSupportedExecutionEnvironments <em>Supported Execution Environments</em>}</li>
039     *   <li>{@link com.hammurapi.config.Factory#getHomePage <em>Home Page</em>}</li>
040     * </ul>
041     * </p>
042     *
043     * @see com.hammurapi.config.ConfigPackage#getFactory()
044     * @model interface="true" abstract="true"
045     * @generated
046     */
047    public interface Factory extends CommonObject {
048            /**
049             * Returns the value of the '<em><b>Description</b></em>' attribute.
050             * <!-- begin-user-doc -->
051             * <!-- end-user-doc -->
052             * <!-- begin-model-doc -->
053             * Object description.
054             * <!-- end-model-doc -->
055             * @return the value of the '<em>Description</em>' attribute.
056             * @see #setDescription(String)
057             * @see com.hammurapi.config.ConfigPackage#getFactory_Description()
058             * @model
059             * @generated
060             */
061            String getDescription();
062    
063            /**
064             * Sets the value of the '{@link com.hammurapi.config.Factory#getDescription <em>Description</em>}' attribute.
065             * <!-- begin-user-doc -->
066             * <!-- end-user-doc -->
067             * @param value the new value of the '<em>Description</em>' attribute.
068             * @see #getDescription()
069             * @generated
070             */
071            void setDescription(String value);
072    
073            /**
074             * Returns the value of the '<em><b>Config Script</b></em>' attribute.
075             * <!-- begin-user-doc -->
076             * <!-- end-user-doc -->
077             * <!-- begin-model-doc -->
078             * Fragment of Java code to perform advanced configuration of the object. This code is invoked after declarative configuration is complete. 
079             * The code shall be a body of void method with the following parameters (Object instance, FactoryConfig config)
080             * <!-- end-model-doc -->
081             * @return the value of the '<em>Config Script</em>' attribute.
082             * @see #setConfigScript(String)
083             * @see com.hammurapi.config.ConfigPackage#getFactory_ConfigScript()
084             * @model
085             * @generated
086             */
087            String getConfigScript();
088    
089            /**
090             * Sets the value of the '{@link com.hammurapi.config.Factory#getConfigScript <em>Config Script</em>}' attribute.
091             * <!-- begin-user-doc -->
092             * <!-- end-user-doc -->
093             * @param value the new value of the '<em>Config Script</em>' attribute.
094             * @see #getConfigScript()
095             * @generated
096             */
097            void setConfigScript(String value);
098    
099            /**
100             * Returns the value of the '<em><b>Id</b></em>' attribute.
101             * <!-- begin-user-doc -->
102             * <!-- end-user-doc -->
103             * <!-- begin-model-doc -->
104             * Object id to use in references. If this attribute is not blank, FactoryConfig shall provie mutable context or ConfigurationException will be thrown at instantiation time. Referenced objects shall be declared before they are first used.
105             * <!-- end-model-doc -->
106             * @return the value of the '<em>Id</em>' attribute.
107             * @see #setId(String)
108             * @see com.hammurapi.config.ConfigPackage#getFactory_Id()
109             * @model
110             * @generated
111             */
112            String getId();
113    
114            /**
115             * Sets the value of the '{@link com.hammurapi.config.Factory#getId <em>Id</em>}' attribute.
116             * <!-- begin-user-doc -->
117             * <!-- end-user-doc -->
118             * @param value the new value of the '<em>Id</em>' attribute.
119             * @see #getId()
120             * @generated
121             */
122            void setId(String value);
123    
124            /**
125             * Returns the value of the '<em><b>Source</b></em>' containment reference list.
126             * The list contents are of type {@link com.hammurapi.config.Source}.
127             * <!-- begin-user-doc -->
128             * <!-- end-user-doc -->
129             * <!-- begin-model-doc -->
130             * Object defintion can have zero or more sources. 
131             * <!-- end-model-doc -->
132             * @return the value of the '<em>Source</em>' containment reference list.
133             * @see com.hammurapi.config.ConfigPackage#getFactory_Source()
134             * @model containment="true"
135             * @generated
136             */
137            EList<Source> getSource();
138    
139            /**
140             * Returns the value of the '<em><b>Enabled</b></em>' attribute.
141             * The default value is <code>"true"</code>.
142             * <!-- begin-user-doc -->
143             * <!-- end-user-doc -->
144             * <!-- begin-model-doc -->
145             * If this attribute is set to false, given definition is skipped during configuration. Setting this attribute to false is like commenting out the definition.
146             * <!-- end-model-doc -->
147             * @return the value of the '<em>Enabled</em>' attribute.
148             * @see #setEnabled(boolean)
149             * @see com.hammurapi.config.ConfigPackage#getFactory_Enabled()
150             * @model default="true"
151             * @generated
152             */
153            boolean isEnabled();
154    
155            /**
156             * Sets the value of the '{@link com.hammurapi.config.Factory#isEnabled <em>Enabled</em>}' attribute.
157             * <!-- begin-user-doc -->
158             * <!-- end-user-doc -->
159             * @param value the new value of the '<em>Enabled</em>' attribute.
160             * @see #isEnabled()
161             * @generated
162             */
163            void setEnabled(boolean value);
164    
165            /**
166             * Returns the value of the '<em><b>Service</b></em>' attribute list.
167             * The list contents are of type {@link java.lang.String}.
168             * <!-- begin-user-doc -->
169             * <!-- end-user-doc -->
170             * <!-- begin-model-doc -->
171             * Values in this attribute are names of service interfaces which this object exposes. Configuration framework registers created object in the context if the context is mutable. If the context is immutable, a configuration exception is thrown.
172             * <!-- end-model-doc -->
173             * @return the value of the '<em>Service</em>' attribute list.
174             * @see com.hammurapi.config.ConfigPackage#getFactory_Service()
175             * @model
176             * @generated
177             */
178            EList<String> getService();
179    
180            /**
181             * Returns the value of the '<em><b>Supported Execution Environments</b></em>' attribute list.
182             * The list contents are of type {@link java.lang.String}.
183             * <!-- begin-user-doc -->
184             * <!-- end-user-doc -->
185             * <!-- begin-model-doc -->
186             * Versions of Java supported by given factory.
187             * <!-- end-model-doc -->
188             * @return the value of the '<em>Supported Execution Environments</em>' attribute list.
189             * @see com.hammurapi.config.ConfigPackage#getFactory_SupportedExecutionEnvironments()
190             * @model
191             * @generated
192             */
193            EList<String> getSupportedExecutionEnvironments();
194    
195            /**
196             * Returns the value of the '<em><b>Home Page</b></em>' attribute.
197             * <!-- begin-user-doc -->
198             * <!-- end-user-doc -->
199             * <!-- begin-model-doc -->
200             * URL of component's home page with additional information.
201             * <!-- end-model-doc -->
202             * @return the value of the '<em>Home Page</em>' attribute.
203             * @see #setHomePage(String)
204             * @see com.hammurapi.config.ConfigPackage#getFactory_HomePage()
205             * @model
206             * @generated
207             */
208            String getHomePage();
209    
210            /**
211             * Sets the value of the '{@link com.hammurapi.config.Factory#getHomePage <em>Home Page</em>}' attribute.
212             * <!-- begin-user-doc -->
213             * <!-- end-user-doc -->
214             * @param value the new value of the '<em>Home Page</em>' attribute.
215             * @see #getHomePage()
216             * @generated
217             */
218            void setHomePage(String value);
219    
220            /**
221             * <!-- begin-user-doc -->
222             * <!-- end-user-doc -->
223             * <!-- begin-model-doc -->
224             * Instantiates and configures a Java object. Returns factory result instance which contains instantiated/configured object and an instance of Destroyable, which shall be used to destroy resources held by the instantiated object and its parts when it is no longer needed.
225             * @param factoryConfig Factory configuration.
226             * <!-- end-model-doc -->
227             * @model dataType="com.hammurapi.config.EFactoryClosure<org.eclipse.emf.ecore.EJavaObject>" exceptions="com.hammurapi.config.EConfigurationException" factoryConfigDataType="com.hammurapi.config.EFactoryConfig"
228             * @generated
229             */
230            FactoryClosure<Object> create(FactoryConfig factoryConfig) throws ConfigurationException;
231    
232            /**
233             * <!-- begin-user-doc -->
234             * <!-- end-user-doc -->
235             * <!-- begin-model-doc -->
236             * Compiles configuration to Java source file. Applies profiles, expands tokens, verifies configuration correctness. The compiled source file shall be further compiled with java compiler to produce configuration class to be used at runtime. This compiled file doesn't have dependency on EMF, XML and Janino.
237             * @param profilePath Profile path for compilation.
238             * @param tokens Expansion tokens.
239             * @param classLoader Class loader from which classes being used in the configuration script will be loaded for introspection during compilation. This class loader will be used as parent classloader for classloaders defined in the configuration file. 
240             * @param dir Directory where to store generated files.
241             * @param targetPackage Target package for generated files.
242             * @param targetClass Target class name for generated file.
243             * <!-- end-model-doc -->
244             * @model exceptions="com.hammurapi.config.EConfigurationException" profilePathMany="true" tokensDataType="com.hammurapi.config.ETokenSource" classLoaderDataType="com.hammurapi.config.EClassLoader" dirDataType="com.hammurapi.config.File"
245             * @generated
246             */
247            void compile(EList<String> profilePath, TokenSource tokens, ClassLoader classLoader, File dir, String targetPackage, String targetClass) throws ConfigurationException;
248    
249    } // Factory