com.cafesoft.core.field
Class PropertiesFieldInfoFactory

java.lang.Object
  |
  +--com.cafesoft.core.field.PropertiesFieldInfoFactory

public class PropertiesFieldInfoFactory
extends Object

PropertiesFieldInfoFactory is a factory class that is used to construct instances of FieldInfo objects using a Properties object as it's configuration object.

This object is designed to be used as a Singleton. Therefore, there will be only a single instance per classloader. Use the standard mechanism of getInstance() to retrieve the instance of the Factory.

The expected format for a Properties file that will be parsed by this factory is the following:

 PROPERTY-PREFIX.fieldInfo.FIELD-INFO-NAME.type=FIELD-TYPE
 PROPERTY-PREFIX.fieldInfo.FIELD-INFO-NAME.validationClass=FIELD-VALIDATION-RULE-CLASSNAME
 PROPERTY-PREFIX.fieldInfo.FIELD-INFO-NAME.valueOptionClass=FIELD-VALUE-OPTIONS-CLASSNAME
 PROPERTY-PREFIX.fieldInfo.FIELD-INFO-NAME.attribute.ATTRIBUTE-NAME=ATTRIBUTE-VALUE
 PROPERTY-PREFIX.fieldInfo.FIELD-INFO-NAME.isRequired=BOOLEAN VALUE
 PROPERTY-PREFIX.fieldInfo.FIELD-INFO-NAME.allowNull=BOOLEAN VALUE
 PROPERTY-PREFIX.fieldInfo.FIELD-INFO-NAME.defaultValue=VALUE
 
NOTE:Refer to the FieldType documentation to view all valids FieldTypes
Examples, of usage:

Property Prefix: resource-type.http.
FieldInfo Name: SchemePattern

 resource-type.http.fieldInfo.SchemePattern.type=STRING
 resource-type.http.fieldInfo.SchemePattern.validationClass=\
      com.cafesoft.core.field.StringValidationRule
 resource-type.http.fieldInfo.SchemePattern.valueOptionClass=\
      com.cafesoft.security.engine.access.url.UrlValueOptions
 resource-type.http.fieldInfo.SchemePattern.isRequired=true
 resource-type.http.fieldInfo.SchemePattern.allowNull=false
 resource-type.http.fieldInfo.SchemePattern.defaultValue=
 

Property Prefix: resource-type.http.
FieldInfo Name: HostPattern

 resource-type.http.fieldInfo.HostPattern.type=STRING
 resource-type.http.fieldInfo.HostPattern.validationClass=\
      com.cafesoft.core.field.StringValidationRule
 resource-type.http.fieldInfo.HostPattern.isRequired=true
 resource-type.http.fieldInfo.HostPattern.allowNull=true
 resource-type.http.fieldInfo.HostPattern.defaultValue=
 

Property Prefix: resource-type.http.
FieldInfo Name: PortPattern

 resource-type.http.fieldInfo.PortPattern.type=INTEGER
 resource-type.http.fieldInfo.PortPattern.validationClass=\
      com.cafesoft.core.field.IntegerValidationRule
 resource-type.http.fieldInfo.PortPattern.attribute.minimum=1
 resource-type.http.fieldInfo.PortPattern.attribute.maximum=32655
 resource-type.http.fieldInfo.PortPattern.isRequired=true
 resource-type.http.fieldInfo.PortPattern.allowNull=true
 resource-type.http.fieldInfo.PortPattern.defaultValue=
 

Property Prefix: resource-type.http.
FieldInfo Name: UriPattern

 resource-type.http.fieldInfo.UriPattern.type=STRING
 resource-type.http.fieldInfo.UriPattern.validationClass=\
      com.cafesoft.security.engine.access.url.UriValidationRule
 resource-type.http.fieldInfo.UriPattern.allowNull=true
 resource-type.http.fieldInfo.UriPattern.isRequired=true
 resource-type.http.fieldInfo.UriPattern.defaultValue=
 

Since:
8/13/03
See Also:
FieldInfo, FieldType

Constructor Summary
PropertiesFieldInfoFactory()
          Create a new ProertiesFieldInfoFactory.
 
Method Summary
 FieldInfo createInstance(Properties properties, String propertyPrefix, String fieldInfoName)
          Create a new FieldInfo instance.
static PropertiesFieldInfoFactory getInstance()
          Get instance of the PropertiesFieldInfoFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesFieldInfoFactory

public PropertiesFieldInfoFactory()
Create a new ProertiesFieldInfoFactory.

Not intended to be called anywhere except internally to this class.

Method Detail

getInstance

public static final PropertiesFieldInfoFactory getInstance()
Get instance of the PropertiesFieldInfoFactory.

Returns:
an instance of the PropertiesFieldInfoFactory.

createInstance

public FieldInfo createInstance(Properties properties,
                                String propertyPrefix,
                                String fieldInfoName)
                         throws FieldException
Create a new FieldInfo instance.

Parameters:
properties - the Properties object which contains all required configuration parameters.
propertyPrefix - the prefix (if one exists) the prepends all of the FieldInfo property names. If one exists it is expected to carry the trailing '.'. For instance, it expects "abc." not just "abc". This value can be null.
fieldInfoName - the name of the FieldInfo object to construct.
Returns:
a new FieldInfo object.
Throws:
FieldException - if an error occurs constructing the FieldInfo object, or if properties is null, or if fieldInfoName is null.


Generated on 8:41:50 AM June 06, 2005, © 1996-2005 Cafésoft LLC. All rights reserved.