|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.nds.dirxml.shimhost.ShimConfig
public class ShimConfig
Class encapsulating the DirXML shim configuration information necessary for running a shim.
The primary use of this class is the construction of initialization documents for the shiminit()
methods. However, it may also be useful as the back end
for a configuration editor.
The ShimConfig
class is designed to read and write all the configuration data from
a single XML document. However, ShimConfig
can also be used as an aggregator for configuration data
from multiple sources. In either case, a ShimConfig
instance can be used to
construct XML documents to be used as parameters to shim init()
methods.
Nested Class Summary | |
---|---|
static class |
ShimConfig.BadPasswordException
|
static class |
ShimConfig.RemoteLoaderConfig
Class encapsulating Remote Loader connection data. |
Field Summary | |
---|---|
static String |
ATTR_SECURE
Name for XML attribute 'secure'. |
static String |
ATTR_USE
Name for XML attribute 'use'. |
static String |
TAG_APP_PASSWORD
Tag name for XML element 'app-password'. |
static String |
TAG_APP_SCHEMA_DEF
Tag name for XML element 'app-schema-def'. |
static String |
TAG_AUTH_CONTEXT
Tag name for XML element 'auth-context'. |
static String |
TAG_AUTH_ID
Tag name for XML element 'auth-id'. |
static String |
TAG_CLASS_NAME
Tag name for XML element 'class-name'. |
static String |
TAG_CONNECTION_STRING
Tag name for XML element 'connection-string'. |
static String |
TAG_DESIGNER_APP_ID
Tag name for XML element 'designer-app-id' |
static String |
TAG_DIRXML_SCHEMA_DEF
Tag name for XML element 'dirxml-schema-def'. |
static String |
TAG_DRIVER_DN
Tag name for XML element 'driver-dn'. |
static String |
TAG_DRIVER_PASSWORD
Tag name for XML element 'driver-password'. |
static String |
TAG_LOADER_PASSWORD
Tag name for XML element 'loader-password'. |
static String |
TAG_PUBLISHER_DN
Tag name for XML element 'publisher-dn'. |
static String |
TAG_REMOTE_LOADER
Tag name for XML element 'remote-loader'. |
static String |
TAG_SECURE_HASH
Tag name for XML element 'secure-hash'. |
static String |
TAG_SHIM_CONFIG
Tag name for XML element 'shim-config'. |
static String |
TAG_SHIM_STATE
Tag name for XML element 'shim-state'. |
static String |
TAG_SUBSCRIBER_DN
Tag name for XML element 'subscriber-dn'. |
static String |
VAL_EMPTY_STRING
"" |
static String |
VAL_FALSE
"false" |
static String |
VAL_TRUE
"true" |
Constructor Summary | |
---|---|
ShimConfig()
Construct a default, empty ShimConfig object. |
|
ShimConfig(Node configParent)
Construct a ShimConfig object given parsed XML. |
|
ShimConfig(ShimConfig source)
Construct a copy of an existing ShimConfig object. |
|
ShimConfig(String configFilename)
Construct a ShimConfig object given a file name. |
Method Summary | |
---|---|
boolean |
checkDriverPassword(String password)
Method that will be called to handle a <check-password> command received on the Publisher channel. |
Document |
createGetSchemaInitDoc()
Create an XML Document suitable for passing to DriverShim.getSchema() . |
Document[] |
createInitDocs()
Create three XML Document s suitable for passing to the DriverShim ,
SubscriptionShim , and PublicationShim init() methods. |
Password |
getAppPassword()
Get the Password instance encapsulating the application password for the shim. |
SchemaDef |
getAppSchemaDef()
Get the application SchemaDef instance associated with this instance. |
String |
getAuthContext()
Return the "authorization context" from the configuration data. |
String |
getAuthID()
Return the "authorization ID" from the configuration data. |
String |
getClassName()
Return the class name from the configuration data. |
char[] |
getConfigPassword()
Return the configuration password. |
String |
getDesignerAppID()
Return the "Designer application ID" from the configuration data. |
SchemaDef |
getDirXMLSchemaDef()
Get the DirXML SchemaDef instance associated with this instance. |
String[] |
getFakeDNs()
Return an array of String s containing the "fake" DN values
in this configuration instance. |
Filter |
getFilter()
Get the Filter instance associated with this instance. |
GCDefinitions |
getGCVs()
Get the GCDefinitions instance associated with this instance. |
NamedPasswords |
getNamedPasswords()
Get the NamedPasswords instance associated with this instance. |
NameMap |
getNameMap()
Get the NameMap instance associated with this instance. |
GCValue |
getReferencedValue(String name)
Supply a value given the name of the referenced item. |
ShimConfig.RemoteLoaderConfig |
getRemoteLoaderConfig()
Get the RemoteLoaderConfig instance associated with this instance. |
String |
getShimClassName()
Return the class name of the shim. |
ShimConfigParams |
getShimConfigParams()
Get the ShimConfigParams instance associated with this instance. |
ShimState |
getShimState()
Get the ShimState instance associated with this instance. |
boolean |
hasBeenModified()
Return true if this instance has been modified. |
boolean |
isSecure()
Return true if the password data and any other sensitive data associated with this
instance is encrypted. |
void |
notifyShimState(Element[] stateElements)
Method that will be notified when a <driver-state>, <subscriber-state>, or a <publisher-state> element is found in a shim document. |
void |
resetModified()
Reset the modified flag for this instance such that hasBeenModified()
will return false . |
void |
resetSecure()
Set the sensitive data in this instance to be unencrypted. |
void |
setAppPassword(char[] newAppPassword)
Set a new app password value for this instance. |
void |
setAppSchemaDef(SchemaDef newSchemaDef)
Set a SchemaDef instance as application schema definition. |
void |
setAuthContext(String newAuthContext)
Set the "authorization context" for this instance. |
void |
setAuthID(String newAuthID)
Set the "authorization ID" for this instance. |
void |
setClassName(String newClassName)
Set the class name for this instance. |
void |
setConfigPassword(char[] newConfigPassword)
Set the password used to decrypt sensitive data in this instance. |
void |
setDesignerAppID(String newAppID)
Set the "Designer application ID" for this instance. |
void |
setDirXMLSchemaDef(SchemaDef newSchemaDef)
Set a SchemaDef instance as the DirXML schema definition. |
void |
setFakeDNs(String[] newFakeDNs)
Set the "fake" DNs to use in building init documents. |
void |
setFilter(Filter newFilter)
Set a Filter instance as the "live" data for this
instance. |
void |
setGCVs(GCDefinitions newGCVs)
Set a GCDefinitions instance as the "live" data for this
instance. |
void |
setNamedPasswords(NamedPasswords newNamedPasswords)
Set a NamedPasswords instance as the "live" data for this
instance. |
void |
setNameMap(NameMap newNameMap)
Set a NameMap instance as the "live" data for this
instance. |
void |
setRemoteLoaderConfig(ShimConfig.RemoteLoaderConfig newConfig)
Set a RemoteLoaderConfig instance as the "live" data for this
instance. |
void |
setSecure(char[] newConfigPassword)
Set the sensitive data in this instance to be encrypted. |
void |
setShimConfigParams(ShimConfigParams newConfigParams)
Set a ShimConfigParams instance as the "live" data for this
instance. |
void |
setShimState(ShimState newShimState)
Set a ShimState instance as the "live" data for this
instance. |
Element |
toXML(Node parent)
Construct an XML representation of the configuration data in this instance. |
void |
write(File file)
Serialize the configuration data in this instance as XML and write the bytes to a new file based on the passed File . |
void |
write(OutputStream outputStream)
Serialize the configuration data in this instance as XML and write the bytes to an OutputStream . |
void |
write(String filename)
Serialize the configuration data in this instance as XML and write the bytes to a new file with the passed file name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TAG_SHIM_CONFIG
public static final String TAG_CLASS_NAME
public static final String TAG_REMOTE_LOADER
public static final String TAG_CONNECTION_STRING
public static final String TAG_LOADER_PASSWORD
public static final String TAG_DRIVER_PASSWORD
public static final String TAG_AUTH_ID
public static final String TAG_AUTH_CONTEXT
public static final String TAG_APP_PASSWORD
public static final String TAG_DRIVER_DN
public static final String TAG_SUBSCRIBER_DN
public static final String TAG_PUBLISHER_DN
public static final String TAG_SHIM_STATE
public static final String TAG_APP_SCHEMA_DEF
public static final String TAG_DIRXML_SCHEMA_DEF
public static final String TAG_SECURE_HASH
public static final String TAG_DESIGNER_APP_ID
public static final String ATTR_SECURE
public static final String ATTR_USE
public static final String VAL_TRUE
public static final String VAL_FALSE
public static final String VAL_EMPTY_STRING
Constructor Detail |
---|
public ShimConfig()
ShimConfig
object.
public ShimConfig(ShimConfig source)
ShimConfig
object.
source
- existing ShimConfig
instancepublic ShimConfig(String configFilename) throws IOException, XMLException
ShimConfig
object given a file name.
configFilename
- name of file containing configuration XML.
IOException
- if an error occurs opening or reading the file
XMLException
- if an error occurs parsing the XMLpublic ShimConfig(Node configParent) throws XMLException
ShimConfig
object given parsed XML.
configParent
- DOM node that is the parent of the shim-config element.
XMLException
- if an error occurs parsing the XMLMethod Detail |
---|
public boolean hasBeenModified()
true
if this instance has been modified.
The instance is considered to have been modified if a change was made
that affects the persistent representation since:
resetModified()
was last called
hasBeenModified
in interface ConfigElement
true
or false
resetModified()
public void resetModified()
hasBeenModified()
will return false
.
resetModified
in interface ConfigElement
hasBeenModified()
public String getClassName()
getShimClassName()
.
null
)getShimClassName()
public String getShimClassName()
getClassName()
or ShimHost.REMOTE_SHIM_CLASS_NAME
if the Remote Loader is
being used.
null
, or ShimHost.REMOTE_SHIM_CLASS_NAME
getClassName()
public void setClassName(String newClassName)
newClassName
- class namepublic String getAuthID()
null
)public void setAuthID(String newAuthID)
newAuthID
- auth IDpublic String getAuthContext()
null
)public void setAuthContext(String newAuthContext)
newAuthContext
- auth contextpublic String getDesignerAppID()
null
)public void setDesignerAppID(String newAppID)
newAppID
- application ID Stringpublic Password getAppPassword()
null
)public void setAppPassword(char[] newAppPassword) throws IllegalStateException, CipherException
isSecure()
returns true
, the configuration password must have been
set via setConfigPassword()
if the newAppPassword
parameter is non-null
.
newAppPassword
- password characters (may be null)
IllegalStateException
- if isSecure()
returns true
and
no configuration password has been set.
CipherException
- if an error occurs while encrypting the new password valueisSecure()
,
setConfigPassword(char[])
public String[] getFakeDNs()
String
s containing the "fake" DN values
in this configuration instance. The fake DN values are
used for the "src-dn" attribute in configuration documents
for shim init()
methods.
String
s: 0 is driver DN, 1 is subscriber DN, 2 is publisher DNpublic void setFakeDNs(String[] newFakeDNs) throws IllegalArgumentException
newFakeDNs
- array of three String
s: 0 is driver DN, 1 is subscriber DN, 2 is publisher DN
(any or all of which may be null
, or the array itself may be null
)
IllegalArgumentException
- if the array parameter is less than 3 elements in lengthpublic ShimConfig.RemoteLoaderConfig getRemoteLoaderConfig()
RemoteLoaderConfig
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
null
)public void setRemoteLoaderConfig(ShimConfig.RemoteLoaderConfig newConfig)
RemoteLoaderConfig
instance as the "live" data for this
instance. Any changes made to the passed object will be reflected
in this instance's configuration data.
newConfig
- config instance to use (may be null
)public Filter getFilter()
Filter
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
null
)public void setFilter(Filter newFilter)
Filter
instance as the "live" data for this
instance. Any changes made to the passed object will be reflected
in this instance's configuration data.
newFilter
- filter instance to use (may be null
)public NameMap getNameMap()
NameMap
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
The NameMap
instance is used to map class and attribute names in the Filter
when constructing init documents.
NameMap
instance (may be null
)public void setNameMap(NameMap newNameMap)
NameMap
instance as the "live" data for this
instance. Any changes made to the passed object will be reflected
in this instance's configuration data.
The NameMap
instance is used to map class and attribute names in the Filter
when constructing init documents.
newNameMap
- NameMap
instance to use (may be null
)public ShimConfigParams getShimConfigParams()
ShimConfigParams
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
ShimConfigParams
instance (may be null
)public void setShimConfigParams(ShimConfigParams newConfigParams)
ShimConfigParams
instance as the "live" data for this
instance. Any changes made to the passed object will be reflected
in this instance's configuration data.
newConfigParams
- ShimConfigParams
instance to use (may be null
)public GCDefinitions getGCVs()
GCDefinitions
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
GCDefinitions
instance (may be null
)public void setGCVs(GCDefinitions newGCVs)
GCDefinitions
instance as the "live" data for this
instance. Any changes made to the passed object will be reflected
in this instance's configuration data.
newGCVs
- GCDefinitions
instance to use (may be null
)public NamedPasswords getNamedPasswords()
NamedPasswords
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
NamedPasswords
instance (may be null
)public void setNamedPasswords(NamedPasswords newNamedPasswords)
NamedPasswords
instance as the "live" data for this
instance. Any changes made to the passed object will be reflected
in this instance's configuration data.
newNamedPasswords
- NamedPasswords
instance to use (may be null
)public ShimState getShimState()
ShimState
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
ShimState
instance (may be null
)public void setShimState(ShimState newShimState)
ShimState
instance as the "live" data for this
instance. Any changes made to the passed object will be reflected
in this instance's configuration data.
newShimState
- ShimState
instance to use (may be null
)public SchemaDef getAppSchemaDef()
SchemaDef
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
SchemaDef
instance (may be null
)public void setAppSchemaDef(SchemaDef newSchemaDef)
SchemaDef
instance as application schema definition.
newSchemaDef
- SchemaDef
instance to use (may be null
)public SchemaDef getDirXMLSchemaDef()
SchemaDef
instance associated with this instance.
Note that if non-null
, the returned instance is "live" and changes
made to it will be reflected in this instance's configuration data.
SchemaDef
instance (may be null
)public void setDirXMLSchemaDef(SchemaDef newSchemaDef)
SchemaDef
instance as the DirXML schema definition.
newSchemaDef
- SchemaDef
instance to use (may be null
)public boolean isSecure()
true
if the password data and any other sensitive data associated with this
instance is encrypted.
true
or false
public void setSecure(char[] newConfigPassword) throws IllegalArgumentException, CipherException
setConfigPassword()
to supply the password for
already-encrypted data.
newConfigPassword
- password to use in encrypting the sensitive data
IllegalArgumentException
- if newConfigPassword
is null
CipherException
- if an error occurs during the encryption processsetConfigPassword(char[])
public void resetSecure() throws CipherException
CipherException
- if an error occurs during the decryption processpublic void setConfigPassword(char[] newConfigPassword) throws ShimConfig.BadPasswordException
setSecure()
to secure unencrypted
data.
newConfigPassword
- password
ShimConfig.BadPasswordException
- if this ShimConfig instance is secure and the passed
password isn't correctsetSecure(char[])
public final char[] getConfigPassword()
null
or array containing configuration passwordpublic void write(String filename) throws IOException
filename
- name of file
IOException
- if an error occurs while creating/opening or writing the filepublic void write(File file) throws IOException
File
. The XML is serialized with UTF-8 encoding.
file
- File
object representing the file to use
IOException
- if an error occurs while creating/opening or writing the filepublic void write(OutputStream outputStream) throws IOException
OutputStream
. The XML is serialized with UTF-8 encoding.
outputStream
- OutputStream
to which to write
IOException
- if an error occurs while writing to the OutputStream
public Element toXML(Node parent)
resetModified()
.
toXML
in interface ConfigElement
parent
- Node
under which to construct the XML representation
hasBeenModified()
,
resetModified()
public Document[] createInitDocs() throws ConfigException
Document
s suitable for passing to the DriverShim
,
SubscriptionShim
, and PublicationShim
init()
methods.
The created documents are returned in an array suitable for use as the parameter to
ShimHost.start()
.
DriverShim
, SubscriptionShim
, and PublicationShim
, respectively.
ConfigException
- if an error occurs while constructing the documents (e.g., a password
decryption error occurs)ShimHost.start(org.w3c.dom.Document[])
public Document createGetSchemaInitDoc() throws ConfigException
Document
suitable for passing to DriverShim.getSchema()
.
The created document is suitable for use as the parameter to ShimHost.getSchema()
.
Document
for use with DriverShim.getSchema()
ConfigException
- if an error occurs while constructing the documents (e.g., a password
decryption error occurs)ShimHost.getSchema(org.w3c.dom.Document)
public GCValue getReferencedValue(String name)
null
.
Implementation of ShimParams.ReferenceResolver
. This
will look for the named GCV in any GCV definition that exists as
part of this ShimConfig
instance.
getReferencedValue
in interface ShimParams.ReferenceResolver
name
- name of referenced item
null
or the referenced itemShimParams.ReferenceResolver
public void notifyShimState(Element[] stateElements)
notifyShimState
in interface ShimHost.StateListener
stateElements
- 3-element array containing 1 or more shim state
elements.ShimHost.StateListener
public boolean checkDriverPassword(String password)
checkDriverPassword
in interface ShimHost.DriverPasswordCheck
password
- value to check
true
if password matches; false
otherwiseShimHost.DriverPasswordCheck
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |