com.tensegrity.generic.util
Class Factory

java.lang.Object
  extended bycom.tensegrity.generic.util.Factory

public class Factory
extends java.lang.Object

This class implements the "AbstractFactory" pattern, a software technique that decouples client code from the factory creational process. This is achieved by having a dedicated object perform this activity instead.

An AbstractFactory is simply a factory specialized in creating other factories, further decoupling client code from the knowledge of which factory object they are using to create new objects.

To create an AbstractFactory, you must instantiate this class.

Call the findFactory method, passing it the path to the file which contains the factory configuration.

Factory objects that are dereferenced will be garbage collected.

Every AbstractFactory class depends on the types it is specialized to create.

Version:
$Id: Factory.java,v 1.25 2005/04/01 15:40:21 MichaelKegel Exp $
Author:
M. Kegel, S. Rutz

Constructor Summary
Factory()
          Default constructor specifying no parameters.
 
Method Summary
 java.lang.String findFactory(java.lang.String serviceFile, java.lang.String defaultFactory)
          This function searches for a factory class name at different locations in the following order:
in the system properties where the property should look like follows:
com.tensegrity.generic.attribute.AttributeFactory= PathToTheServiceFile
in the attributes.properties file the attribute.properties must be located in the lib folder of the java.home directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Factory

public Factory()
Default constructor specifying no parameters.

Method Detail

findFactory

public java.lang.String findFactory(java.lang.String serviceFile,
                                    java.lang.String defaultFactory)
This function searches for a factory class name at different locations in the following order:
  1. in the system properties where the property should look like follows:
    com.tensegrity.generic.attribute.AttributeFactory= PathToTheServiceFile

  2. in the attributes.properties file the attribute.properties must be located in the lib folder of the java.home directory. within the attribute.properties file must be an entry for the service file like follows:
    com.tensegrity.generic.attribute.AttributeFactory= PathToTheServiceFile

  3. in folder META-INF/services in file com.tensegrity.generic.attribute.AttributeFactory

Parameters:
serviceFile - the name of the service file
defaultFactory - the name of the default factory
Returns:
an string containing the name of the found factory.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.