Package com.iizix.prop
Class PropFactory
java.lang.Object
com.iizix.prop.PropFactory
This class handles definitions of available properties, available as predefined or plug-in classes extending the 
GProp class. Processing of these properties classes is handled in different ways for the client, server and editor. The client has functionality towards Swing, the server for storing the properties in XML files, and the editor provides developer-functions for Eclipse.- Author:
- Christopher Mindus
- Field SummaryFields
- Constructor SummaryConstructorsConstructorDescription- PropFactory- (int programType) Constructs the property factory with the default class loader.- PropFactory- (int programType, ClassLoader classLoader) Constructs the property factory.
- Method SummaryModifier and TypeMethodDescription- createClientClassNameMap- (boolean jsClient) Creates the map used to replace server/editor class names with client ones.Creates a Document from a property container.Creates the map used to replace class names for communication between the editor and the server.- GProp<?>- createProp- (String tag, Atom atom) Creates a generic property with the specified tag name and atom.- createPropertyManager- (int application, Map<String, - String> classNameMapper) Creates a Property Manager for the application type.- protected URLMaps a file name into a File object in the class path.- IPluginDescriptor<?>[]Gets a list of the loaded Server plug-in descriptors.- getLoadedPlugins- (String names) Gets a list of the loaded Server plug-in descriptors.- int- getPropClass- (String className) Gets the property class from a class name.- boolean- isPlugInRegistered- (String name) Registers a plug-in.- voidLoads the "schema/base-properties.xml" file using the "schema/property-definition-1.0.xsd" schema.- GProp<?>- loadPropTree- (GProp<?> parent, Element element) Creates the GProp tree from an Element.- loadPropTree- (PropMgr propertyManager, File file, boolean setPropMgrToProps) Loads a property tree from an XML file.- loadPropTree- (PropMgr propertyManager, String fileName, InputStream in, boolean setPropMgrToProps) Loads a property tree from an XML file.- loadPropTree- (PropMgr propertyManager, Document document, boolean setPropMgrToProps) Loads a property tree from an XML document.- static void- processQueryDesignerProps- (PropReference ref, GEvent event) Requests processing of the method by the Designer factory interface, done when the- PropReferencegets the- GEvent.PROP_QUERY_DESIGNER_PROPSevent.- void- registerPlugIn- (String name, URL url, ClassLoader classLoader, IPluginDescriptor<?> serverPluginDescriptor) Registers a plug-in.- static void- setDesignerInterface- (IPropFactory designerInterface) Assigns the Designer factory interface.
- Field Details- CLIENTpublic static final int CLIENTThe application type: CLIENT = 0.- See Also:
 
- SERVERpublic static final int SERVERThe application type: SERVER = 1.- See Also:
 
- EDITORpublic static final int EDITORThe application type: EDITOR = 2.- See Also:
 
 
- Constructor Details- PropFactorypublic PropFactory- (int programType) Constructs the property factory with the default class loader.- Parameters:
- programType- Value indicating what program type is running, CLIENT, SERVER or EDITOR.
 
- PropFactoryConstructs the property factory.- Parameters:
- programType- Value indicating what program type is running, CLIENT, SERVER or EDITOR.
- classLoader- The class loader.
 
 
- Method Details- getProgramTypepublic int getProgramType()
- getPropClassGets the property class from a class name.- Parameters:
- className- The class name.
- Returns:
- The class, or null for not found.
 
- getFileMaps a file name into a File object in the class path.- Parameters:
- fn- The file name.
- Returns:
- null if not resolved.
 
- loadPropDefinitionsLoads the "schema/base-properties.xml" file using the "schema/property-definition-1.0.xsd" schema.- Throws:
- IOException- for load errors.
 
- loadPropTreepublic PropCnr loadPropTree- (PropMgr propertyManager, File file, boolean setPropMgrToProps) throws IOException, PropException Loads a property tree from an XML file.- Parameters:
- propertyManager- The PropertyManager instance.
- file- The file to load.
- setPropMgrToProps- Flag to initialize the property manager to the properties.
- Returns:
- the property container.
- Throws:
- IOException- for file errors.
- PropException- for property errors.
 
- loadPropTreepublic PropCnr loadPropTree- (PropMgr propertyManager, String fileName, InputStream in, boolean setPropMgrToProps) throws IOException, PropException Loads a property tree from an XML file.- Parameters:
- propertyManager- The PropertyManager instance.
- fileName- The file name for logging and error messages/logging.
- in- The input stream.
- setPropMgrToProps- Flag to initialize the property manager to the properties.
- Returns:
- the property container.
- Throws:
- IOException- for file errors.
- PropException- for property errors.
 
- loadPropTreepublic PropCnr loadPropTree- (PropMgr propertyManager, Document document, boolean setPropMgrToProps) throws IOException, PropException Loads a property tree from an XML document.- Parameters:
- propertyManager- the PropertyManager instance.
- document- the Document.
- Returns:
- the property container.
- Throws:
- IOException- for file errors.
- PropException- for property errors.
 
- loadPropTreeCreates the GProp tree from an Element.- Parameters:
- parent- the parent property.
- element- the Element for the tree.
- Returns:
- the property container.
- Throws:
- PropException- for property errors.
 
- createClientClassNameMapCreates the map used to replace server/editor class names with client ones.- Parameters:
- jsClient- The JavaScript client flag.
- Returns:
- Map the map of names.
 
- createEditorServerClassNameMapCreates the map used to replace class names for communication between the editor and the server.- Returns:
- Map the map of names.
 
- createDocumentCreates a Document from a property container.- Note: this only work for the Editor, an InternalError is thrown otherwise! - Parameters:
- pc- The property container.
- Returns:
- The Document created.
- Throws:
- IllegalStateException- If the factory does not match the run mode, i.e. Designer or Server (Client is not allowed).
 
- isPlugInRegisteredRegisters a plug-in. A plug-in has an XML file that has the same format as the product-internal base definitions.- Parameters:
- name- The plug-in name.
 
- registerPlugInpublic void registerPlugIn- (String name, URL url, ClassLoader classLoader, IPluginDescriptor<?> serverPluginDescriptor) throws IOException Registers a plug-in. A plug-in has an XML file that has the same format as the product-internal base definitions.- Parameters:
- name- The plug-in name.
- url- The file of the XML properties file for the plug-in.
- classLoader- Additional class loader if not null.
- serverPluginDescriptor- The Server plug-in descriptor, can be null only for "com.iizigo" plug-in name.
- Throws:
- IOException- for load errors.
 
- getLoadedPluginsGets a list of the loaded Server plug-in descriptors.- Returns:
- The list of plug-in descriptors.
 
- getLoadedPluginsGets a list of the loaded Server plug-in descriptors.- Parameters:
- names- The plug-in name, e.g. "com.iizigo.db,com.iizigo.term,com.iizigo.ws".
- Returns:
- The list of plug-in descriptors.
- Throws:
- IOException- If a plug-in is not loaded. This exception is thrown in order to have the same exception as the exception thrown in the- com.iizix.server.IAppLoaderinterface.
 
- createPropertyManagerCreates a Property Manager for the application type.- Parameters:
- application- The application type, EDITOR, SERVER or CLIENT.
- classNameMapper- A class name mapper array, may be null for none.
- Returns:
- An initialized Property Manager.
 
- createPropCreates a generic property with the specified tag name and atom.- This method will throw an InternalError if the calling process is not the Editor. - This method will throw an NullPointerException if the tag name is not found. - Parameters:
- tag- The tag name in the property definition XML file.
- atom- The atom for the property.
 
- setDesignerInterfaceAssigns the Designer factory interface.- Note: this can only be done in the Designer ONCE. 
- processQueryDesignerPropsRequests processing of the method by the Designer factory interface, done when the- PropReferencegets the- GEvent.PROP_QUERY_DESIGNER_PROPSevent.- Parameters:
- ref- The property reference instance.
- event- The event.