com.bea.ales.management
Class ConstantManager

java.lang.Object
  |
  +--com.bea.ales.management.ConstantManager

public class ConstantManager
extends java.lang.Object

This class manages constants. You can use this class to create, delete, and find constants.


Method Summary
 Constant createConstant(java.lang.String name, java.util.Collection value, AttributeValueType type)
          Creates a new constant with list value.
 Constant createConstant(java.lang.String name, java.lang.String value, AttributeValueType type)
          Create a new constant with a single value.
 Constant getConstant(java.lang.String constantName)
          Get a constant with the specified name.
 ConstantQueryResult getConstantsByName(java.lang.String filterPattern)
          Find constants whose names matches the specified filter.
 ConstantQueryResult getConstantsByType(AttributeValueType type)
          Find all constants which has the specified type.
 ConstantQueryResult getConstantsByValue(java.lang.String filterPattern)
          Find constants whose values matches the specified filter.
 void removeConstant(java.lang.String name)
          Delete a constant with the specified name.
 void renameConstant(java.lang.String oldName, java.lang.String newName)
          Rename a constant.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createConstant

public Constant createConstant(java.lang.String name,
                               java.lang.String value,
                               AttributeValueType type)
                        throws java.lang.IllegalArgumentException,
                               ManagementException
Create a new constant with a single value.

Parameters:
name - name of the constant
value - value of the constant.
type - type of the constant.
Returns:
the constant created.
Throws:
java.lang.IllegalArgumentException - if name, value or type is invalid.
ManagementException - if fails to create the constant.

createConstant

public Constant createConstant(java.lang.String name,
                               java.util.Collection value,
                               AttributeValueType type)
                        throws java.lang.IllegalArgumentException,
                               ManagementException
Creates a new constant with list value. This method is used for the constant which has a list value. The constant created with this method will be list type even if there is only one element in the collection.

Parameters:
name - name of the constant
value - value of the constant. All elements in the collection will be treated as string.
type - type of the constant.
Returns:
the constant created.
Throws:
java.lang.IllegalArgumentException - if name, value or type is invalid.
ManagementException - if fail to create the constant.

getConstant

public Constant getConstant(java.lang.String constantName)
                     throws java.lang.IllegalArgumentException,
                            ManagementException
Get a constant with the specified name.

Parameters:
constantName - name of the constant.
Returns:
the constant with the specific name; or null if no such constant.
Throws:
java.lang.IllegalArgumentException - if the name is invalid.
ManagementException - if the operation fails.

getConstantsByName

public ConstantQueryResult getConstantsByName(java.lang.String filterPattern)
                                       throws java.lang.IllegalArgumentException,
                                              ManagementException
Find constants whose names matches the specified filter.

Parameters:
filterPattern - name pattern to match.
Returns:
a ConstantQueryResult object which contains the result.
Throws:
java.lang.IllegalArgumentException - if filterPattern is null.
ManagementException - if the operation fails.

getConstantsByValue

public ConstantQueryResult getConstantsByValue(java.lang.String filterPattern)
                                        throws java.lang.IllegalArgumentException,
                                               ManagementException
Find constants whose values matches the specified filter.

Parameters:
filterPattern - value pattern to match
Returns:
a ConstantQueryResult which contains the result.
Throws:
java.lang.IllegalArgumentException - if filterPattern is null.
ManagementException - if the operation fails.

getConstantsByType

public ConstantQueryResult getConstantsByType(AttributeValueType type)
                                       throws ManagementException
Find all constants which has the specified type.

Parameters:
type - type of the constant to match. When it is null indicate all types.
Returns:
a ConstantQueryResult which contains the result.
Throws:
ManagementException - if the operation fails.

removeConstant

public void removeConstant(java.lang.String name)
                    throws java.lang.IllegalArgumentException,
                           ManagementException
Delete a constant with the specified name.

Parameters:
name - name of the constant to be deleted.
Throws:
java.lang.IllegalArgumentException - if the name is invalid.
ManagementException - if the operation fails.

renameConstant

public void renameConstant(java.lang.String oldName,
                           java.lang.String newName)
                    throws ManagementException
Rename a constant.

Parameters:
oldName - The old name of the constant.
newName - The new name for the constant.
Throws:
ManagementException - if the operation fails.
java.lang.IllegalArgumentException - if either oldName or newName is null or empty.


Copyright © 2004-2008, Oracle and/or its affiliates. All rights reserved.