public class ShimConfigParams extends java.lang.Object implements ConfigElement
init()
methods defined
by shim authors. There are two types of these shim parameters:
"old-style" parameters and GCV-style parameters. This class hides
the difference when possible.
When GCV-style parameters reference actual GCVs, there are two ways of handling
the references:
setGCVResolver()
can be called to set a resolver object that will be used
instead of the default behavior.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_NAME
Name of the XML 'name' attribute.
|
static int |
DRIVER_OPTIONS
Constant specifying the options for the
DriverShim.init() method. |
static int |
PUBLISHER_OPTIONS
Constant specifying the options for the
PublicationShim.init() method. |
static int |
SUBSCRIBER_OPTIONS
Constant specifying the options for the
SubscriptionShim.init() method. |
static java.lang.String |
TAG_DRIVER_CONFIG
Tag name of the <driver-config> element.
|
static java.lang.String |
TAG_DRIVER_OPTIONS
Tag name of the <driver-options> element.
|
static java.lang.String |
TAG_PUBLISHER_OPTIONS
Tag name of the <publisher-options> element.
|
static java.lang.String |
TAG_SUBSCRIBER_OPTIONS
Tag name of the <subscriber-options> element.
|
Constructor and Description |
---|
ShimConfigParams()
Construct an empty
ShimConfigParams instance. |
ShimConfigParams(org.w3c.dom.Element driverConfig)
Construct a new ShimConfigParams instance from an XML
<driver-config> element.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Get name of these parameters
|
ConfigElement |
getParams(int type)
Return the parameter set for a particular shim (driver, subscriber, publisher).
|
boolean |
hasBeenModified()
Return
true if this instance has been modified. |
void |
resetModified()
Reset the modified flag for this instance such that
hasBeenModified()
will return false . |
void |
setGCVResolver(ShimParams.ReferenceResolver resolver)
Set a resolver object for resolving GCV references in GCV-style
configuration parameters.
|
void |
setName(java.lang.String newName)
Set name of these parameters
|
org.w3c.dom.Element |
toInitDoc(org.w3c.dom.Node parent,
int shimType)
Create an XML representation of one of the sets of parameters suitable
for use with a shim init document.
|
org.w3c.dom.Element |
toXML(org.w3c.dom.Node parent)
Create an XML representation of the shim configuration parameters.
|
public static final java.lang.String TAG_DRIVER_CONFIG
public static final java.lang.String TAG_DRIVER_OPTIONS
public static final java.lang.String TAG_SUBSCRIBER_OPTIONS
public static final java.lang.String TAG_PUBLISHER_OPTIONS
public static final java.lang.String ATTR_NAME
public static final int DRIVER_OPTIONS
DriverShim.init()
method. Used
as a parameter toInitDoc()
. Value of 0.public static final int SUBSCRIBER_OPTIONS
SubscriptionShim.init()
method. Used
as a parameter toInitDoc()
. Value of 1.public static final int PUBLISHER_OPTIONS
PublicationShim.init()
method. Used
as a parameter toInitDoc()
. Value of 2.public ShimConfigParams()
ShimConfigParams
instance.public ShimConfigParams(org.w3c.dom.Element driverConfig) throws XMLException
driverConfig
- Element containing XML representationXMLException
- if the XML representation is incorrectpublic 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 calledhasBeenModified
in interface ConfigElement
true
or false
resetModified()
public void resetModified()
hasBeenModified()
will return false
.resetModified
in interface ConfigElement
hasBeenModified()
public ConfigElement getParams(int type) throws java.lang.IllegalArgumentException
type
- one of DRIVER_OPTIONS
, SUBSCRIBER_OPTIONS
, PUBLISHER_OPTIONS
null
, an OldStyleParams
instance, or a ShimParams
instance.java.lang.IllegalArgumentException
- thrown if type
parameter is incorrectpublic org.w3c.dom.Element toXML(org.w3c.dom.Node parent)
resetModified()
.toXML
in interface ConfigElement
parent
- Node
under which to create the XML representationElement
hasBeenModified()
,
resetModified()
public org.w3c.dom.Element toInitDoc(org.w3c.dom.Node parent, int shimType) throws java.lang.IllegalArgumentException
parent
- Node
under which to construct the XML representationshimType
- one of DRIVER_OPTIONS
, SUBSCRIBER_OPTIONS
,
or PUBLISHER_OPTIONS
Element
java.lang.IllegalArgumentException
public java.lang.String getName()
public void setName(java.lang.String newName)
newName
- namepublic void setGCVResolver(ShimParams.ReferenceResolver resolver)
null
is passed then a default (fake)
GCV resolver is used which will resolve all GCVs, but not necessarily
to the type expected (all resolutions are to string-type GCVs with
the same value).resolver
- implementation to resolve <gcv-ref> elements in
GCV-style init params