wt.tools.resource
Class ResourceInfo

java.lang.Object
  extended bywt.tools.resource.ResourceInfo
Direct Known Subclasses:
StringResourceInfo

public abstract class ResourceInfo
extends Object

A Resource, which may have multiple localizations.

Supported API: false

Extendable: false

See Also:
buildResource(), write()

Field Summary
protected static boolean BACKUP
           
protected  boolean baseHasChanged
           
private  ResourceBuilder builder
           
private static String CLASSNAME
           
private  String[] comments
           
protected static String COMPILE
           
private  boolean containsCategory
           
protected  boolean customHasChanged
           
private  boolean customizable
           
private  com.objectspace.jgl.OrderedMap customizedValue
           
private  ResourceInfo defaultInfo
           
protected static boolean DEL_SOURCE
           
private  boolean deprecated
           
private  String extendClass
           
static String EXTENSION
           
protected static boolean FORCE_COMPILE
           
protected static boolean FROM_DEFAULT_FORCE
           
protected static Locale[] FROM_DEFAULT_LOCALES
           
private  Locale locale
           
private  Hashtable localization
           
protected static String MSG_CAT
           
private  String name
           
private  boolean replacement
           
private static String RESOURCE
           
protected static String TRANSLATION_SECTION_MARKER
           
protected static boolean TRANSLATION_SUPPORT
           
protected  boolean translationSectionStarted
           
private  boolean updated
           
private  com.objectspace.jgl.OrderedMap value
           
 
Constructor Summary
protected ResourceInfo()
           
 
Method Summary
 void buildResource()
          Use this ResourceInfo to build a resource, which can be used at run-time, for resource value lookups.
 void buildResourceSet()
          Build resource bundles for this ResourceInfo and all of its associated localizations.
protected  boolean containsCategory()
          Gets the category containment status of this ResourceInfo object.
(package private) static String directory(String name, boolean customization)
           
private  String filename(boolean customization)
          Determines the filename for storinh the Info.
static String filename(String name)
           
(package private) static String filename(String name, Locale locale, boolean customization)
           
protected  ResourceBuilder getBuilder()
          Gets the object for the association that plays role: builder.
 String[] getComments()
          Gets the value of the attribute: comments.
 ResourceValue getCustomizedValue(String key)
          Gets the object for the association that plays role: customizedValue.
 Enumeration getCustomizedValues()
          Get the set of customized values for the ResourceInfo.
 Enumeration getCustomizedView()
          Get the runtime view of the values for the ResourceInfo.
protected  ResourceInfo getDefaultInfo()
          Gets the object for the association that plays role: defaultInfo.
 String getExtendClass()
          Gets the value of the attribute: extendClass; The name of the class that the runtime built resource will extend.
 Locale getLocale()
          Gets the value of the attribute: locale; The locale that this resource applies to.
 ResourceInfo getLocalization(Locale locale)
          Gets the object for the association that plays role: localization.
 String getName()
          Gets the value of the attribute: name; The fully qualified name for this resource.
protected  String getResourceType()
          Gets the resource type.
 ResourceValue getValue(String key)
          Gets the object for the association that plays role: value.
 Enumeration getValues()
          Get the set of current values for the ResourceInfo.
 boolean isCustomizable()
          Gets the value of the attribute: customizable; Specifies if this resource can be customized.
 boolean isDeprecated()
          Gets the value of the attribute: deprecated; Specifies if this bundle is deprecated.
protected  boolean isEmpty(Dictionary a_value)
          Determine if a_value is empty (null or zero length).
protected static boolean isEmpty(String a_value)
          Determine if a_value is empty (null or zero length).
protected  boolean isFromDefault(Locale locale)
          Determine if a locale is one that will be built from the default file.
protected static boolean isPrimaryKey(String theKey)
           
 boolean isReplacement()
          Gets the value of the attribute: replacement; Specifies if this customization is a complete replacement of the base resource info.
protected  void load(Dictionary source, boolean customization)
          Load the state of this instance from the source.
protected  ResourceInfo loadAll()
          Construct a new instance of the current object's class.
(package private) static String localePattern(String name)
           
protected abstract  ResourceInfo makeInfo()
          Construct a new instance of the current object's class.
protected abstract  ResourceValue makeValue(String a_Key)
          Make a new ResourceValue, for this ResourceInfo.
private  void nameValidate(String a_Name)
           
protected  void notifyLocalizations(ResourceValue oldValue, ResourceValue a_Value)
           
 ResourceInfo obtainLocalization(Locale locale)
          Obtain a locale specific version of this ResourceInfo, by returning an existing instance for the locale, or by constructing a new instance if one does not exist.
 ResourceValue obtainValue(String a_Key, boolean customization)
          Obtain a ResourceValue, by returning a copy of an existing instance for a_Key, or by constructing a new instance if one does not exist.
protected  Dictionary order(Dictionary table)
           
protected  void populateResource(Dictionary keyValues, Dictionary constants, ResourceValue rv)
          Populate the resource with the values needed at run-time.
protected  void printFormat(PrintWriter output)
           
 void putCustomizedValue(String key, Object value)
          Make a new customized ResourceValue for this ResourceInfo, based on the key and value, and put it into the ResourceInfo.
 ResourceValue putCustomizedValue(String key, ResourceValue a_CustomizedValue)
          Sets the object for the association that plays role: customizedValue.
protected  ResourceInfo putLocalization(Locale locale, ResourceInfo a_Localization)
          Sets the object for the association that plays role: localization.
 void putValue(String key, Object value)
          Make a new ResourceValue for this ResourceInfo, based on the key and value, and put it into the ResourceInfo.
 ResourceValue putValue(String key, ResourceValue a_Value)
          Sets the object for the association that plays role: value.
 ResourceValue removeCustomizedValue(String key)
          Removes the value, for specified key, of the attribute: customizedValue.
protected  ResourceInfo removeLocalization(Locale locale)
          Removes the value, for specified key, of the attribute: localization.
 ResourceValue removeValue(String key)
          Removes the value, for specified key, of the attribute: value.
private  boolean resourceCompileNeeded()
           
private  boolean resourceCompileNeeded(File ootb_info, File custom_info, String name_only, Locale rb_locale)
           
 void setComments(String[] a_Comments)
          Sets the value of the attribute: comments.
protected  void setContainsCategory(boolean contains_category)
          Sets the category containment status of this ResourceInfo object.
 void setCustomizable(boolean a_Customizable)
          Sets the value of the attribute: customizable; Specifies if this resource can be customized.
 void setDeprecated(boolean a_Deprecated)
          Sets the value of the attribute: deprecated; Specifies if this bundle is deprecated.
 void setExtendClass(String a_ExtendClass)
          Sets the value of the attribute: extendClass; The name of the class that the runtime built resource will extend.
 void setLocale(Locale a_Locale)
          Sets the value of the attribute: locale; The locale that this resource applies to.
 void setName(String a_Name)
          Sets the value of the attribute: name; The fully qualified name for this resource.
 void setReplacement(boolean a_Replacement)
          Sets the value of the attribute: replacement; Specifies if this customization is a complete replacement of the base resource info.
 String toString()
           
 void write()
          Persist the current state of this ResourceInfo to a file.
protected  void write(Dictionary table, boolean customization)
           
 void writeSet()
          Persist the current state of this ResourceInfo and all of its associated localizations.
protected  void writeTranslationSupport(PrintWriter output, ResourceValue rv)
           
protected  void writeUnlocalizedValue(PrintWriter output, ResourceValue rv)
           
protected  void writeValue(PrintWriter output, ResourceValue rv)
          Write the state of a particular ResourceValue to the output target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

name

private String name

locale

private Locale locale

extendClass

private String extendClass

customizable

private boolean customizable

replacement

private boolean replacement

deprecated

private boolean deprecated

comments

private String[] comments

updated

private boolean updated

value

private com.objectspace.jgl.OrderedMap value

defaultInfo

private ResourceInfo defaultInfo

localization

private Hashtable localization

customizedValue

private com.objectspace.jgl.OrderedMap customizedValue

builder

private ResourceBuilder builder

COMPILE

protected static final String COMPILE

BACKUP

protected static final boolean BACKUP

DEL_SOURCE

protected static final boolean DEL_SOURCE

FORCE_COMPILE

protected static final boolean FORCE_COMPILE

TRANSLATION_SUPPORT

protected static final boolean TRANSLATION_SUPPORT

FROM_DEFAULT_FORCE

protected static final boolean FROM_DEFAULT_FORCE

FROM_DEFAULT_LOCALES

protected static final Locale[] FROM_DEFAULT_LOCALES

TRANSLATION_SECTION_MARKER

protected static final String TRANSLATION_SECTION_MARKER
See Also:
Constant Field Values

MSG_CAT

protected static final String MSG_CAT
See Also:
Constant Field Values

translationSectionStarted

protected boolean translationSectionStarted

baseHasChanged

protected boolean baseHasChanged

customHasChanged

protected boolean customHasChanged

containsCategory

private boolean containsCategory

EXTENSION

public static final String EXTENSION
See Also:
Constant Field Values
Constructor Detail

ResourceInfo

protected ResourceInfo()
Method Detail

getName

public String getName()
Gets the value of the attribute: name; The fully qualified name for this resource.

Supported API: false

Returns:
String

setName

public void setName(String a_Name)
             throws WTPropertyVetoException
Sets the value of the attribute: name; The fully qualified name for this resource.

Supported API: false

Parameters:
a_Name -
Throws:
WTPropertyVetoException

nameValidate

private void nameValidate(String a_Name)
                   throws WTPropertyVetoException
Parameters:
a_Name -
Throws:
WTPropertyVetoException

getLocale

public Locale getLocale()
Gets the value of the attribute: locale; The locale that this resource applies to.

Supported API: false

Returns:
Locale

setLocale

public void setLocale(Locale a_Locale)
               throws WTPropertyVetoException
Sets the value of the attribute: locale; The locale that this resource applies to.

Supported API: false

Parameters:
a_Locale -
Throws:
WTPropertyVetoException

getExtendClass

public String getExtendClass()
Gets the value of the attribute: extendClass; The name of the class that the runtime built resource will extend. If nothing is specified, resource will extend java.util.ListResourceBundle.

Supported API: false

Returns:
String

setExtendClass

public void setExtendClass(String a_ExtendClass)
                    throws WTPropertyVetoException
Sets the value of the attribute: extendClass; The name of the class that the runtime built resource will extend. If nothing is specified, resource will extend java.util.ListResourceBundle.

Supported API: false

Parameters:
a_ExtendClass -
Throws:
WTPropertyVetoException

isCustomizable

public boolean isCustomizable()
Gets the value of the attribute: customizable; Specifies if this resource can be customized.

Supported API: false

Returns:
boolean

setCustomizable

public void setCustomizable(boolean a_Customizable)
                     throws WTPropertyVetoException
Sets the value of the attribute: customizable; Specifies if this resource can be customized.

Supported API: false

Parameters:
a_Customizable -
Throws:
WTPropertyVetoException

isReplacement

public boolean isReplacement()
Gets the value of the attribute: replacement; Specifies if this customization is a complete replacement of the base resource info. If it is a replacement, the entries from the base resource info will not be compiled into the run-time resource.

Supported API: false

Returns:
boolean

setReplacement

public void setReplacement(boolean a_Replacement)
                    throws WTPropertyVetoException
Sets the value of the attribute: replacement; Specifies if this customization is a complete replacement of the base resource info. If it is a replacement, the entries from the base resource info will not be compiled into the run-time resource.

Supported API: false

Parameters:
a_Replacement -
Throws:
WTPropertyVetoException

isDeprecated

public boolean isDeprecated()
Gets the value of the attribute: deprecated; Specifies if this bundle is deprecated.

Supported API: false

Returns:
boolean

setDeprecated

public void setDeprecated(boolean a_Deprecated)
                   throws WTPropertyVetoException
Sets the value of the attribute: deprecated; Specifies if this bundle is deprecated.

Supported API: false

Parameters:
a_Deprecated -
Throws:
WTPropertyVetoException

getComments

public String[] getComments()
Gets the value of the attribute: comments.

Supported API: false

Returns:
String[]

setComments

public void setComments(String[] a_Comments)
                 throws WTPropertyVetoException
Sets the value of the attribute: comments.

Supported API: false

Parameters:
a_Comments -
Throws:
WTPropertyVetoException

getValue

public ResourceValue getValue(String key)
Gets the object for the association that plays role: value. Returns a clone, so changed ResourceValue needs to be put back into the ResourceInfo in order to register the changes.

Parameters:
key -
Returns:
If key found, a clone of the internally held ResourceValue otherwise, null.
See Also:
putValue(String,ResourceValue)

putValue

public ResourceValue putValue(String key,
                              ResourceValue a_Value)
                       throws WTPropertyVetoException
Sets the object for the association that plays role: value.

Supported API: false

Parameters:
key -
a_Value -
Returns:
ResourceValue
Throws:
WTPropertyVetoException

removeValue

public ResourceValue removeValue(String key)
Removes the value, for specified key, of the attribute: value.

Supported API: false

Parameters:
key -
Returns:
ResourceValue

getDefaultInfo

protected ResourceInfo getDefaultInfo()
Gets the object for the association that plays role: defaultInfo.

Supported API: false

Returns:
ResourceInfo

getLocalization

public ResourceInfo getLocalization(Locale locale)
Gets the object for the association that plays role: localization.

Supported API: false

Parameters:
locale -
Returns:
ResourceInfo

putLocalization

protected ResourceInfo putLocalization(Locale locale,
                                       ResourceInfo a_Localization)
                                throws WTPropertyVetoException
Sets the object for the association that plays role: localization.

Supported API: false

Parameters:
locale -
a_Localization -
Returns:
ResourceInfo
Throws:
WTPropertyVetoException

removeLocalization

protected ResourceInfo removeLocalization(Locale locale)
Removes the value, for specified key, of the attribute: localization.

Supported API: false

Parameters:
locale -
Returns:
ResourceInfo

getCustomizedValue

public ResourceValue getCustomizedValue(String key)
Gets the object for the association that plays role: customizedValue.

Supported API: false

Parameters:
key -
Returns:
ResourceValue

putCustomizedValue

public ResourceValue putCustomizedValue(String key,
                                        ResourceValue a_CustomizedValue)
                                 throws WTPropertyVetoException
Sets the object for the association that plays role: customizedValue.

Supported API: false

Parameters:
key -
a_CustomizedValue -
Returns:
ResourceValue
Throws:
WTPropertyVetoException

removeCustomizedValue

public ResourceValue removeCustomizedValue(String key)
Removes the value, for specified key, of the attribute: customizedValue.

Supported API: false

Parameters:
key -
Returns:
ResourceValue

getBuilder

protected ResourceBuilder getBuilder()
Gets the object for the association that plays role: builder.

Supported API: false

Returns:
ResourceBuilder

makeInfo

protected abstract ResourceInfo makeInfo()
                                  throws WTPropertyVetoException
Construct a new instance of the current object's class.

Supported API: false

Returns:
ResourceInfo
Throws:
WTPropertyVetoException

makeValue

protected abstract ResourceValue makeValue(String a_Key)
                                    throws WTPropertyVetoException
Make a new ResourceValue, for this ResourceInfo.

Supported API: false

Parameters:
a_Key -
Returns:
ResourceValue
Throws:
WTPropertyVetoException

obtainLocalization

public ResourceInfo obtainLocalization(Locale locale)
                                throws WTPropertyVetoException
Obtain a locale specific version of this ResourceInfo, by returning an existing instance for the locale, or by constructing a new instance if one does not exist.

Supported API: false

Parameters:
locale -
Returns:
ResourceInfo
Throws:
WTPropertyVetoException

obtainValue

public ResourceValue obtainValue(String a_Key,
                                 boolean customization)
                          throws WTPropertyVetoException
Obtain a ResourceValue, by returning a copy of an existing instance for a_Key, or by constructing a new instance if one does not exist.

Supported API: false

Parameters:
a_Key -
customization -
Returns:
ResourceValue
Throws:
WTPropertyVetoException

putValue

public void putValue(String key,
                     Object value)
              throws WTPropertyVetoException
Make a new ResourceValue for this ResourceInfo, based on the key and value, and put it into the ResourceInfo.

Supported API: false

Parameters:
key -
value -
Throws:
WTPropertyVetoException

putCustomizedValue

public void putCustomizedValue(String key,
                               Object value)
                        throws WTPropertyVetoException
Make a new customized ResourceValue for this ResourceInfo, based on the key and value, and put it into the ResourceInfo.

Supported API: false

Parameters:
key -
value -
Throws:
WTPropertyVetoException

buildResourceSet

public void buildResourceSet()
                      throws WTPropertyVetoException,
                             FileNotFoundException,
                             IOException
Build resource bundles for this ResourceInfo and all of its associated localizations. Example Bundle file names: C:\Windchill\codebase\wt\project\RoleRB.class C:\Windchill\codebase\wt\project\RoleRB_fr.class

Supported API: false

Throws:
WTPropertyVetoException
FileNotFoundException
IOException
See Also:
buildResource()

buildResource

public void buildResource()
                   throws WTPropertyVetoException,
                          FileNotFoundException,
                          IOException
Use this ResourceInfo to build a resource, which can be used at run-time, for resource value lookups. Example Bundle file names: C:\Windchill\codebase\wt\project\RoleRB.class C:\Windchill\codebase\wt\project\RoleRB_fr.class

Supported API: false

Throws:
WTPropertyVetoException
FileNotFoundException
IOException
See Also:
buildResourceSet()

populateResource

protected void populateResource(Dictionary keyValues,
                                Dictionary constants,
                                ResourceValue rv)
                         throws WTPropertyVetoException
Populate the resource with the values needed at run-time.

Supported API: false

Parameters:
keyValues -
constants -
rv -
Throws:
WTPropertyVetoException

writeSet

public void writeSet()
Persist the current state of this ResourceInfo and all of its associated localizations. Example Info storage file names: C:\Windchill\src\wt\project\Role.ResourceInfo C:\Windchill\src\wt\project\Role_fr.ResourceInfo C:\Windchill\custom\src\wt\project\Role.ResourceInfo

Supported API: false

See Also:
write()

write

public void write()
Persist the current state of this ResourceInfo to a file. Example Info storage file names: C:\Windchill\src\wt\project\Role.ResourceInfo C:\Windchill\src\wt\project\Role_fr.ResourceInfo C:\Windchill\custom\src\wt\project\Role.ResourceInfo

Supported API: false

See Also:
writeSet()

writeValue

protected void writeValue(PrintWriter output,
                          ResourceValue rv)
Write the state of a particular ResourceValue to the output target.

Supported API: false

Parameters:
output -
rv -

load

protected void load(Dictionary source,
                    boolean customization)
             throws WTPropertyVetoException
Load the state of this instance from the source.

Supported API: false

Parameters:
source -
customization -
Throws:
WTPropertyVetoException

getValues

public Enumeration getValues()
Get the set of current values for the ResourceInfo.

Supported API: false

Returns:
Enumeration

getCustomizedValues

public Enumeration getCustomizedValues()
Get the set of customized values for the ResourceInfo.

Supported API: false

Returns:
Enumeration

getCustomizedView

public Enumeration getCustomizedView()
Get the runtime view of the values for the ResourceInfo. This is the base values overlaid with the customized values.

Supported API: false

Returns:
Enumeration

order

protected Dictionary order(Dictionary table)

write

protected void write(Dictionary table,
                     boolean customization)

resourceCompileNeeded

private boolean resourceCompileNeeded()

resourceCompileNeeded

private boolean resourceCompileNeeded(File ootb_info,
                                      File custom_info,
                                      String name_only,
                                      Locale rb_locale)

filename

private String filename(boolean customization)
Determines the filename for storinh the Info. D:\Windchill\src\wt\tools\generation\test\TestEnum.rbInfo \\\.rbInfo \\\\_lo.rbInfo \custom\\\.rbInfo

Parameters:
customization - is
Returns:
the name of the file

filename

public static String filename(String name)

filename

static String filename(String name,
                       Locale locale,
                       boolean customization)

directory

static String directory(String name,
                        boolean customization)

localePattern

static String localePattern(String name)

loadAll

protected ResourceInfo loadAll()
                        throws WTPropertyVetoException
Construct a new instance of the current object's class.

Returns:
ResourceInfo
Throws:
WTPropertyVetoException

notifyLocalizations

protected void notifyLocalizations(ResourceValue oldValue,
                                   ResourceValue a_Value)
                            throws WTPropertyVetoException
Throws:
WTPropertyVetoException

writeTranslationSupport

protected void writeTranslationSupport(PrintWriter output,
                                       ResourceValue rv)

writeUnlocalizedValue

protected void writeUnlocalizedValue(PrintWriter output,
                                     ResourceValue rv)

printFormat

protected void printFormat(PrintWriter output)

isPrimaryKey

protected static boolean isPrimaryKey(String theKey)

setContainsCategory

protected void setContainsCategory(boolean contains_category)
Sets the category containment status of this ResourceInfo object.

Returns:
boolean True if ResourceInfo contain an entry, which has an assigned category.

containsCategory

protected boolean containsCategory()
Gets the category containment status of this ResourceInfo object.

Returns:
boolean True if ResourceInfo contain an entry, which has an assigned category.

getResourceType

protected String getResourceType()
Gets the resource type.

Returns:
String The values that maps to a ResourceBuilder to use to create the run-time bundle.

toString

public String toString()

isEmpty

protected static boolean isEmpty(String a_value)
Determine if a_value is empty (null or zero length).

Returns:
boolean true if a_value is empty (null or zero length)

isEmpty

protected boolean isEmpty(Dictionary a_value)
Determine if a_value is empty (null or zero length).

Returns:
boolean true if a_value is empty (null or zero length)

isFromDefault

protected boolean isFromDefault(Locale locale)
Determine if a locale is one that will be built from the default file.

Returns:
boolean true if locale will be built from the default file