Package gw.config
Class Registry
- java.lang.Object
-
- gw.config.Registry
-
public class Registry extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<TypeLoaderSpec>_additionalTypeLoaderSpecsXMLNode specifications for additional typeloaders that will be created for this runtime environmentprivate boolean_bAllowDeprecatedReferencesIndicates if deprecated methods/properties s/b allowed.private boolean_bAllowEntityQueiresIndicates if Gosu query expressions can reference entities.private java.util.List<java.lang.String>_classpathEntriesClasspath entries from the registryprivate java.lang.String_commonServiceInitThe entity access class.private java.net.URL_registerUrlThe URL of the active registryprivate static java.lang.StringCOMMON_SERVICE_INITThe xml tag for indicating what class to use to initialize Gosu's Common Services with.private static Registryg_instanceThe singleton instance of this class.private static java.util.Listg_listenersA list of init listeners.static java.lang.StringTAG_ALLOW_DEPRECATED_REFERENCESThe xml tag for indicating if deprecated methods/properties s/b allowed.static java.lang.StringTAG_ALLOW_ENTITY_QUERIESThe xml tag for indicating if Gosu query expressions can reference entities.static java.lang.StringTAG_CLASSprivate static java.lang.StringTAG_CLASSPATHstatic java.lang.StringTAG_ENTRYprivate static java.lang.StringTAG_SERIALIZATIONstatic java.lang.StringTAG_SRCprivate static java.lang.StringTAG_TYPELOADERprivate static java.lang.StringTAG_TYPELOADERS
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddLocationListener(javax.swing.event.ChangeListener l)private booleancanWrite(java.io.File file)private voiddisableExternalEntities(javax.xml.parsers.DocumentBuilderFactory dbf)The purpose of this method is to prevent vulnerabilities related to XXE (XML external entity injection).private static voidfireLocationChanged()java.util.List<TypeLoaderSpec>getAdditionalTypeLoaders()java.util.List<java.lang.String>getClasspathEntries()java.lang.StringgetCommonServiceInit()private org.w3c.dom.DocumentgetDocument(java.net.URL registrURL)private org.w3c.dom.NodegetTag(org.w3c.dom.Document doc, java.lang.String tagName)static voidinitDefaults()/** Initialize with defaults.static Registryinstance()Get the singleton instance.booleanisAllowDeprecatedReferences()booleanisAllowEntityQueires()static voidremoveLocationListener(javax.swing.event.ChangeListener l)voidsetAllowDeprecatedReferences(boolean bAllowDeprecatedReferences)voidsetAllowEntityQueires(boolean bAllowEntityQueires)voidsetCommonServiceInit(java.lang.String commonServiceInit)static voidsetLocation(java.lang.String kernelInitClass)static voidsetLocation(java.net.URL registryURL)Sets the location of the registry file.static voidsetLocation(java.net.URL registryURL, java.lang.String strCommonServicesInitDefault)voidupdateClasspath(java.util.List<java.lang.String> classpath)
-
-
-
Field Detail
-
TAG_ALLOW_DEPRECATED_REFERENCES
public static final java.lang.String TAG_ALLOW_DEPRECATED_REFERENCES
The xml tag for indicating if deprecated methods/properties s/b allowed.- See Also:
- Constant Field Values
-
TAG_ALLOW_ENTITY_QUERIES
public static final java.lang.String TAG_ALLOW_ENTITY_QUERIES
The xml tag for indicating if Gosu query expressions can reference entities.- See Also:
- Constant Field Values
-
COMMON_SERVICE_INIT
private static final java.lang.String COMMON_SERVICE_INIT
The xml tag for indicating what class to use to initialize Gosu's Common Services with.- See Also:
- Constant Field Values
-
TAG_SERIALIZATION
private static final java.lang.String TAG_SERIALIZATION
- See Also:
- Constant Field Values
-
TAG_TYPELOADERS
private static final java.lang.String TAG_TYPELOADERS
- See Also:
- Constant Field Values
-
TAG_TYPELOADER
private static final java.lang.String TAG_TYPELOADER
- See Also:
- Constant Field Values
-
TAG_CLASSPATH
private static final java.lang.String TAG_CLASSPATH
- See Also:
- Constant Field Values
-
TAG_CLASS
public static final java.lang.String TAG_CLASS
- See Also:
- Constant Field Values
-
TAG_SRC
public static final java.lang.String TAG_SRC
- See Also:
- Constant Field Values
-
TAG_ENTRY
public static final java.lang.String TAG_ENTRY
- See Also:
- Constant Field Values
-
g_instance
private static Registry g_instance
The singleton instance of this class.
-
g_listeners
private static java.util.List g_listeners
A list of init listeners.
-
_bAllowDeprecatedReferences
private boolean _bAllowDeprecatedReferences
Indicates if deprecated methods/properties s/b allowed.
-
_bAllowEntityQueires
private boolean _bAllowEntityQueires
Indicates if Gosu query expressions can reference entities.
-
_additionalTypeLoaderSpecs
private java.util.List<TypeLoaderSpec> _additionalTypeLoaderSpecs
XMLNode specifications for additional typeloaders that will be created for this runtime environment
-
_classpathEntries
private java.util.List<java.lang.String> _classpathEntries
Classpath entries from the registry
-
_commonServiceInit
private java.lang.String _commonServiceInit
The entity access class.
-
_registerUrl
private java.net.URL _registerUrl
The URL of the active registry
-
-
Method Detail
-
initDefaults
public static void initDefaults()
/** Initialize with defaults. Guidewire applications should NEVER call this.
-
setLocation
public static void setLocation(java.lang.String kernelInitClass)
-
setLocation
public static void setLocation(java.net.URL registryURL)
Sets the location of the registry file. Initializes singleton registry.- Parameters:
registryURL-
-
setLocation
public static void setLocation(java.net.URL registryURL, java.lang.String strCommonServicesInitDefault)
-
addLocationListener
public static void addLocationListener(javax.swing.event.ChangeListener l)
-
removeLocationListener
public static void removeLocationListener(javax.swing.event.ChangeListener l)
-
fireLocationChanged
private static void fireLocationChanged()
-
getDocument
private org.w3c.dom.Document getDocument(java.net.URL registrURL) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException- Throws:
java.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionorg.xml.sax.SAXException
-
disableExternalEntities
private void disableExternalEntities(javax.xml.parsers.DocumentBuilderFactory dbf) throws javax.xml.parsers.ParserConfigurationExceptionThe purpose of this method is to prevent vulnerabilities related to XXE (XML external entity injection). Although the nature of Gosu's registry in this case is such that it is _not_ vulnerable, we configure the parser in this way to appease those who demand zero alarm results from static analysis tooling such as Veracode.- Throws:
javax.xml.parsers.ParserConfigurationException
-
getTag
private org.w3c.dom.Node getTag(org.w3c.dom.Document doc, java.lang.String tagName)
-
instance
public static Registry instance()
Get the singleton instance.- Returns:
- The one and only Registry.
-
getCommonServiceInit
public java.lang.String getCommonServiceInit()
- Returns:
-
setCommonServiceInit
public void setCommonServiceInit(java.lang.String commonServiceInit)
- Parameters:
commonServiceInit-
-
getAdditionalTypeLoaders
public java.util.List<TypeLoaderSpec> getAdditionalTypeLoaders()
-
getClasspathEntries
public java.util.List<java.lang.String> getClasspathEntries()
-
isAllowDeprecatedReferences
public boolean isAllowDeprecatedReferences()
- Returns:
-
setAllowDeprecatedReferences
public void setAllowDeprecatedReferences(boolean bAllowDeprecatedReferences)
-
isAllowEntityQueires
public boolean isAllowEntityQueires()
- Returns:
-
setAllowEntityQueires
public void setAllowEntityQueires(boolean bAllowEntityQueires)
-
updateClasspath
public void updateClasspath(java.util.List<java.lang.String> classpath)
-
canWrite
private boolean canWrite(java.io.File file)
-
-