com.sapportals.wcm.crt.configuration

Class DefaultConfiguration

java.lang.Object
  extended by com.sapportals.wcm.crt.configuration.AbstractConfiguration
      extended by com.sapportals.wcm.crt.configuration.DefaultConfiguration
All Implemented Interfaces:
IConfiguration

public class DefaultConfiguration
extends AbstractConfiguration

This is the default implementation of a configuration node.

Copyright (c) SAP AG 2001-2002

Copyright (c) SAP AG 2001-2002


Field Summary
protected static String[] NO_ATTRIBUTES
           
protected static IConfiguration[] NO_CHILDREN
           
 
Constructor Summary
DefaultConfiguration(String name)
          Creates a new instance.
DefaultConfiguration(String name, String location)
          Creates a new instance.
DefaultConfiguration(String name, String location, HashMap attributes)
          Deprecated. as of NW04. Use DefaultConfiguration(final String name, final String location, Map attributes) instead.
DefaultConfiguration(String name, String location, Map attributes)
           
DefaultConfiguration(String name, String location, Map attributes, com.sapportals.config.fwk.IConfigurable configurable)
           
DefaultConfiguration(String name, String location, String namespace, String prefix)
          Creates a new instance.
 
Method Summary
 void addChild(IConfiguration childConfiguration)
          Adds a child configuration node to this node.
protected  void checkWriteable()
           
protected  StringBuffer dump(StringBuffer buffer, int in)
           
 String getAttribute(String name)
          Returns the string value of the specified attribute.
 String[] getAttributeNames()
          Returns an array of all attribute names.
 IConfiguration getChild(String name, boolean createNew)
          Returns the specified child node.
 int getChildCount()
          Returns the number of child nodes.
 IConfiguration[] getChildren()
          Returns an array of all child nodes.
 IConfiguration[] getChildren(String name)
          Returns an array of all child nodes with the specified name.
 String getLocation()
          Returns a string describing the location of the configuration data.
 String getName()
          Returns the name of the node (not null ).
 String getNamespace()
          Returns the namespace this configuration node belongs to.
protected  String getPrefix()
          Returns the prefix of the namespace.
 String getValue()
          Returns the string value of this node.
 boolean isEncryptedProperty(String name)
          Returns true if a corresponding configurable was provided for this DefaultConfiguration object and the corresponding config attribute is an encrypted one.
 void makeReadOnly()
          Sets the read-only flag for this node.
 void removeChild(IConfiguration childConfiguration)
          Removes the child configuration node from this node.
 void setAttribute(String name, String value)
           
 void setValue(String value)
           
 String toString()
           
 
Methods inherited from class com.sapportals.wcm.crt.configuration.AbstractConfiguration
getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsFloat, getAttributeAsInteger, getAttributeAsInteger, getAttributeAsLong, getAttributeAsLong, getChild, getValue, getValueAsBoolean, getValueAsBoolean, getValueAsFloat, getValueAsFloat, getValueAsInteger, getValueAsInteger, getValueAsLong, getValueAsLong
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_CHILDREN

protected static final IConfiguration[] NO_CHILDREN

NO_ATTRIBUTES

protected static final String[] NO_ATTRIBUTES
Constructor Detail

DefaultConfiguration

public DefaultConfiguration(String name)
Creates a new instance.

Parameters:
name - The name of the configuration node.

DefaultConfiguration

public DefaultConfiguration(String name,
                            String location,
                            Map attributes)

DefaultConfiguration

public DefaultConfiguration(String name,
                            String location,
                            Map attributes,
                            com.sapportals.config.fwk.IConfigurable configurable)

DefaultConfiguration

public DefaultConfiguration(String name,
                            String location,
                            HashMap attributes)
Deprecated. as of NW04. Use DefaultConfiguration(final String name, final String location, Map attributes) instead.


DefaultConfiguration

public DefaultConfiguration(String name,
                            String location)
Creates a new instance.

Parameters:
name - The name of the configuration node.
location - A client specific location string, examples: line number (for file-based persistence), identifier, URI, database table, ...

DefaultConfiguration

public DefaultConfiguration(String name,
                            String location,
                            String namespace,
                            String prefix)
Creates a new instance.

Parameters:
name - The name of the configuration node.
location - A client specific location string, examples: line number (for file-based persistence), identifier, URI, database table, ...
namespace - A namespace string
prefix -
Method Detail

getName

public String getName()
Description copied from interface: IConfiguration
Returns the name of the node (not null ).

Returns:
the name of the node (not null ).

getNamespace

public String getNamespace()
                    throws ConfigurationException
Description copied from interface: IConfiguration
Returns the namespace this configuration node belongs to.

Returns:
the namespace this configuration node belongs to.
Throws:
ConfigurationException - Exception raised in failure situation

getLocation

public String getLocation()
Description copied from interface: IConfiguration
Returns a string describing the location of the configuration data. This string is client specific, examples: line number (for file-based persistence), identifier, URI, database table, ...

Returns:
location

getValue

public String getValue()
                throws ConfigurationException
Description copied from interface: IConfiguration
Returns the string value of this node.

Returns:
the string value of this node.
Throws:
ConfigurationException

getAttributeNames

public String[] getAttributeNames()
Description copied from interface: IConfiguration
Returns an array of all attribute names. The order of attributes is the array is undefinded.

Returns:
an array of all attribute names.

getChildren

public IConfiguration[] getChildren()
Description copied from interface: IConfiguration
Returns an array of all child nodes. If the node has no children the array is empty.

Returns:
an array of all child nodes.

getAttribute

public String getAttribute(String name)
                    throws ConfigurationException
Description copied from interface: IConfiguration
Returns the string value of the specified attribute.

Parameters:
name - The name of the attribute.
Returns:
the string value of the specified attribute.
Throws:
ConfigurationException - If the attribute does not exist.

getChild

public IConfiguration getChild(String name,
                               boolean createNew)
Description copied from interface: IConfiguration
Returns the specified child node.

Parameters:
name - The name of the child node.
createNew - If true , an empty IConfiguration node will be created and returned if the specified child does not exist. If false , null will be returned if the specified child doesn't exist.
Returns:
<{IConfiguration}>

getChildren

public IConfiguration[] getChildren(String name)
Description copied from interface: IConfiguration
Returns an array of all child nodes with the specified name. If the node has no children with the specified name the array is empty.

Parameters:
name - the name of the nodes to be returned
Returns:
an array of all child nodes.

setValue

public void setValue(String value)

setAttribute

public void setAttribute(String name,
                         String value)

addChild

public void addChild(IConfiguration childConfiguration)
Adds a child configuration node to this node.

Parameters:
childConfiguration - child to be added

removeChild

public void removeChild(IConfiguration childConfiguration)
Removes the child configuration node from this node.

Parameters:
childConfiguration - The child node to remove.

getChildCount

public int getChildCount()
Returns the number of child nodes.

Returns:
the number of child nodes.

makeReadOnly

public void makeReadOnly()
Sets the read-only flag for this node. The add/remove methods will throw an IllegalStateException.


isEncryptedProperty

public boolean isEncryptedProperty(String name)
Returns true if a corresponding configurable was provided for this DefaultConfiguration object and the corresponding config attribute is an encrypted one. In this case any UI output should be avoided or replaced with password-textfield-style characters

Parameters:
name -
Returns:

dump

protected StringBuffer dump(StringBuffer buffer,
                            int in)

toString

public String toString()
Overrides:
toString in class Object

getPrefix

protected String getPrefix()
                    throws ConfigurationException
Description copied from class: AbstractConfiguration
Returns the prefix of the namespace. This is only used as a serialization hint, therefore is not part of the client API. It should be included in all Configuration implementations though.

Specified by:
getPrefix in class AbstractConfiguration
Returns:
A non-null String (defaults to "")
Throws:
ConfigurationException - if no prefix was defined (prefix is null .

checkWriteable

protected final void checkWriteable()
                             throws IllegalStateException
Throws:
IllegalStateException
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM


Copyright 2011 SAP AG Complete Copyright Notice