Package com.sun.solaris.service.pools
Class Element
- java.lang.Object
-
- com.sun.solaris.service.pools.Element
-
- All Implemented Interfaces:
Property
,PropertyWalk
- Direct Known Subclasses:
Component
,Configuration
,Pool
,Resource
public abstract class Element extends java.lang.Object implements Property, PropertyWalk
TheElement
class represents a pools configuration element. The class is an abstract, base class for concrete implementation elements, such as pool and resource.
-
-
Field Summary
Fields Modifier and Type Field Description protected Configuration
_conf
The configuration to which this element belongs.
-
Constructor Summary
Constructors Constructor Description Element()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
getBoolProperty(java.lang.String name)
Get a boolean property.double
getDoubleProperty(java.lang.String name)
Get a double property.protected abstract long
getElem()
Return the pointer to this subtype as an element.abstract java.lang.String
getInformation(int deep)
Returns a descriptive string which describes the element.long
getLongProperty(java.lang.String name)
Get a long property.protected Value
getProperty(java.lang.String name, long proxy)
Get the property with the supplied name using the supplied proxy.java.lang.String
getStringProperty(java.lang.String name)
Get a String property.void
putProperty(java.lang.String name, Value value)
Put the supplied value as an element property with the supplied name.void
rmProperty(java.lang.String name)
Remove the element property with the supplied name.java.lang.String
toString()
Returns a string representation of this element.int
walk(Element elem, Value val, java.lang.Object user)
Walk all properties of the invoking object.int
walkProperties(PropertyWalk handler, java.lang.Object user)
Walk all the properties of this element.
-
-
-
Field Detail
-
_conf
protected Configuration _conf
The configuration to which this element belongs.
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns a string representation of this element.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this element.
-
getInformation
public abstract java.lang.String getInformation(int deep) throws PoolsException
Returns a descriptive string which describes the element.- Parameters:
deep
- Whether the information should contain information about all contained elements.- Returns:
- a descriptive string which describes the element.
- Throws:
PoolsException
- If the element cannot be located.
-
getProperty
protected Value getProperty(java.lang.String name, long proxy) throws PoolsException
Get the property with the supplied name using the supplied proxy.- Parameters:
name
- The name of the property to be retrieved.proxy
- The proxy item used to retrieve the property.- Returns:
- a value containing the property details.
- Throws:
PoolsException
- If there is an error accessing the property.
-
putProperty
public void putProperty(java.lang.String name, Value value) throws PoolsException
Put the supplied value as an element property with the supplied name.- Specified by:
putProperty
in interfaceProperty
- Parameters:
name
- The name of the property to be updated.value
- The value of the property to be updated.- Throws:
PoolsException
- If there is an error accessing the property.
-
rmProperty
public void rmProperty(java.lang.String name) throws PoolsException
Remove the element property with the supplied name.- Specified by:
rmProperty
in interfaceProperty
- Parameters:
name
- The name of the property to be removed.- Throws:
PoolsException
- If there is an error removing the property.
-
getStringProperty
public java.lang.String getStringProperty(java.lang.String name) throws PoolsException
Get a String property. If the type of the property does not match, i.e. it's not a String, or the element does not have such a property then a PoolsException is thrown.- Specified by:
getStringProperty
in interfaceProperty
- Parameters:
name
- The name of the property to be retrieved.- Throws:
PoolsException
- If getting the String property fails.
-
getLongProperty
public long getLongProperty(java.lang.String name) throws PoolsException
Get a long property. If the type of the property does not match, i.e. it's not a long, or the element does not have such a property then a PoolsException is thrown.- Specified by:
getLongProperty
in interfaceProperty
- Parameters:
name
- The name of the property to be retrieved.- Throws:
PoolsException
- If getting the long property fails.
-
getDoubleProperty
public double getDoubleProperty(java.lang.String name) throws PoolsException
Get a double property. If the type of the property does not match, i.e. it's not a double, or the element does not have such a property then a PoolsException is thrown.- Specified by:
getDoubleProperty
in interfaceProperty
- Parameters:
name
- The name of the property to be retrieved.- Throws:
PoolsException
- If getting the double property fails.
-
getBoolProperty
public boolean getBoolProperty(java.lang.String name) throws PoolsException
Get a boolean property. If the type of the property does not match, i.e. it's not a boolean, or the element does not have such a property then a PoolsException is thrown.- Specified by:
getBoolProperty
in interfaceProperty
- Parameters:
name
- The name of the property to be retrieved.- Throws:
PoolsException
- If getting the boolean property fails.
-
walk
public int walk(Element elem, Value val, java.lang.Object user) throws PoolsException
Walk all properties of the invoking object.- Specified by:
walk
in interfacePropertyWalk
- Parameters:
elem
- The element to whom the property belongs.val
- The value representing the current element.user
- User supplied data, provided when the walk is invoked.- Returns:
- 0 to continue the walk, anything else to terminate it.
- Throws:
PoolsException
- If there is an error walking the property.
-
getElem
protected abstract long getElem() throws PoolsException
Return the pointer to this subtype as an element.- Returns:
- The pointer to the native subtype which this object wraps.
- Throws:
PoolsException
- If there is an error converting the native subtype pointer to a native elem pointer.
-
walkProperties
public int walkProperties(PropertyWalk handler, java.lang.Object user) throws PoolsException
Walk all the properties of this element.- Parameters:
handler
- The object which will receive the callbacks.user
- Data supplied by the user for use in the callback.- Returns:
- 0 for a successful walk, else 1.
- Throws:
PoolsException
- If there is an error during the walk.
-
-