com.bea.ales.management
Class Resource

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

public class Resource
extends java.lang.Object
implements java.lang.Comparable

This class represents a resource object.


Field Summary
static int BINDING_NODE
           
static int INVALID_RESOURCE_NODE
           
static int ORGNIZATIONAL_NODE
           
static int RESOURCE_NODE
           
static java.lang.String ROOT_RESOURCE
           
 
Method Summary
 void addAttribute(AttributeElement attr)
          Add the attribute to this resource.
 Resource cloneTo(Resource destination)
          Clone the resource and all its children to be child of another resource.
 Resource createChild(java.lang.String name)
          Create a child node of this resource with relative name.Relative name the name has no parent resource info in it, For example, if fully qualified name is resources/aaa/bbb, then bbb is the relative name.
 Resource createChild(java.lang.String name, java.lang.String description, boolean isBinding, boolean isDistributionPoint, boolean isAllowVirtualResource)
          Create the child resource with relative name.
 AttributeElement getAttribute(java.lang.String attrName, int queryType)
          Get the specific attribute of this resource by attribute name
 AttributeQueryResult getAttributes(int attrQueryType)
          Get the attributes of this resource.
 java.lang.String getBoundSSM()
          Get the bound SSM to this resource.
 java.lang.String getDescription()
          Get the description of the resource
 ResourceQueryResult getDirectChildren(java.lang.String queryString)
          Get the direct children of this resource
 java.lang.String getName()
          Return the full qualified name of the resource.
 Resource getParent()
          Get the parent resource of this resource.
 java.lang.String getRelativeName()
          Get the relative name of the resource.
 java.lang.String getScopedName()
           
 int getType()
          Get the resource type
 boolean isBindingNode()
          Check whether this resource is a binding node.
 boolean isChildBindingNodeAllowed()
          Check if child resource can be a binding node.
 boolean isChildDistributionPointAllowed()
          Check if the child of this resource can be a distribution point.
 boolean isDistributionPoint()
          Check whether this resource is a distribution point.
 boolean isVirtualAllowed()
          Check whether this resources is virtual resource.
 void modifyAttribute(AttributeElement oldAttr, AttributeElement newAttr)
          Modify the resource attribute.
 void moveTo(Resource destination)
          Move the resource and all its children to be child of another resource.
 void moveTo(Resource destination, boolean isForced)
          Move the resource and all its children to be child of another resource.
 void removeAttribute(AttributeElement attr)
          Remove the resource attribute.
 void removeAttribute(java.lang.String attrName)
          Remove resource attribute with the specified name.
 void removeChild(Resource child)
          Remove the child resource.
 void removeChild(Resource child, boolean isCascade)
          Remove the child resource in cascading way.
 void removeChild(java.lang.String name)
          Remove the child resource by relative name.
 void removeChild(java.lang.String name, boolean isCascade)
          Remove the child resource by relative name in cascading way.
 void setBoundSSM(java.lang.String ssmName)
          Bind the SSM to this resource.
 void setDescription(java.lang.String description)
          Set the description of this resource.
 void setDistributionPoint(boolean isDistributionPoint)
          Set this resource to be a distribution point or not.
 void setRelativeName(java.lang.String newRelativeName)
          Rename the resource to the given name.
 void setVirtualResource(boolean virtualAllowed)
          Set the resource to be virtual resource or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_RESOURCE_NODE

public static final int INVALID_RESOURCE_NODE

ORGNIZATIONAL_NODE

public static final int ORGNIZATIONAL_NODE

BINDING_NODE

public static final int BINDING_NODE

RESOURCE_NODE

public static final int RESOURCE_NODE

ROOT_RESOURCE

public static final java.lang.String ROOT_RESOURCE
Method Detail

getName

public java.lang.String getName()
Return the full qualified name of the resource. Full qualified names in the entitlements are like //resources/.

Returns:
full qualified name of the resource

setRelativeName

public void setRelativeName(java.lang.String newRelativeName)
                     throws ManagementException
Rename the resource to the given name.

Parameters:
newRelativeName - new relative name. Relative name is the name without any path info. For example, relative name for //resources/aa/bb/cc is cc. This parameter can not be null or zero length string.
Throws:
ManagementException - if the operation fails.

getRelativeName

public java.lang.String getRelativeName()
Get the relative name of the resource. For example, if this resource's full name is //resources/webApp/servlet, then servlet will be returned.

Returns:
relative name of the resource

getParent

public Resource getParent()
                   throws ManagementException
Get the parent resource of this resource.

Returns:
parent resource, or null if this resource is the root resource
Throws:
ManagementException - if the operation fails.

getDirectChildren

public ResourceQueryResult getDirectChildren(java.lang.String queryString)
                                      throws ManagementException
Get the direct children of this resource

Parameters:
queryString - the filter against the children's name
Returns:
the ResourceQueryResult instance that contains all children whose name match the query string.
Throws:
ManagementException - if the operation fails

getAttributes

public AttributeQueryResult getAttributes(int attrQueryType)
                                   throws ManagementException
Get the attributes of this resource.

Parameters:
attrQueryType - either QueryType.DIRECT or QueryType.ALL
Returns:
the AttributeQueryResult instance that contains all attributes found.
Throws:
ManagementException - if the operation fails.

getAttribute

public AttributeElement getAttribute(java.lang.String attrName,
                                     int queryType)
                              throws ManagementException
Get the specific attribute of this resource by attribute name

Parameters:
attrName - the name of the attribute. It can not be null or zero length string.
queryType - either QueryType.DIRECT or QueryType.ALL
Returns:
the AttributeElement instance which has the given name.
Throws:
ManagementException - if the operation fails.

addAttribute

public void addAttribute(AttributeElement attr)
                  throws ManagementException
Add the attribute to this resource.

Parameters:
attr - the attributeElement to be added.
Throws:
ManagementException - if the operation fails.

modifyAttribute

public void modifyAttribute(AttributeElement oldAttr,
                            AttributeElement newAttr)
                     throws ManagementException
Modify the resource attribute.

Parameters:
oldAttr - the attribute to be modified
newAttr - the new attribute desired. It has the same name and type as the old one but with new vaule desired.
Throws:
ManagementException - if the operation fails.

removeAttribute

public void removeAttribute(java.lang.String attrName)
                     throws ManagementException
Remove resource attribute with the specified name.

Parameters:
attrName - name of the attribute to be removed. It can not be null or zero length string.
Throws:
ManagementException - if the operation fails.

removeAttribute

public void removeAttribute(AttributeElement attr)
                     throws ManagementException
Remove the resource attribute.

Parameters:
attr - the attribute to be removed. It can not be null.
Throws:
ManagementException - if the operation fails.

getDescription

public java.lang.String getDescription()
                                throws ManagementException
Get the description of the resource

Returns:
a string description for the resource
Throws:
ManagementException - if the operation fails.

setDescription

public void setDescription(java.lang.String description)
                    throws ManagementException
Set the description of this resource.

Parameters:
description - the description to set.
Throws:
ManagementException - if the operation fails.

isBindingNode

public boolean isBindingNode()
                      throws ManagementException
Check whether this resource is a binding node.

Returns:
true if this resource is a binding code, or false if not.
Throws:
ManagementException - if the operation fails.

isDistributionPoint

public boolean isDistributionPoint()
                            throws ManagementException
Check whether this resource is a distribution point.

Returns:
true if this resource is a distribution point, or false if not.
Throws:
ManagementException - if the operation fails.

setDistributionPoint

public void setDistributionPoint(boolean isDistributionPoint)
                          throws ManagementException
Set this resource to be a distribution point or not.

Parameters:
isDistributionPoint - true to set the resource to be a distribution point, or false to set it not to be.
Throws:
ManagementException - if the operation fails.

isVirtualAllowed

public boolean isVirtualAllowed()
                         throws ManagementException
Check whether this resources is virtual resource.

Returns:
true if the resource is virtual resource, or false if not.
Throws:
ManagementException - if the operation fails.

setVirtualResource

public void setVirtualResource(boolean virtualAllowed)
                        throws ManagementException
Set the resource to be virtual resource or not.

Parameters:
virtualAllowed - true for virtual resource, or false for non virtual resource.
Throws:
ManagementException - if the operation fails.

getBoundSSM

public java.lang.String getBoundSSM()
                             throws ManagementException
Get the bound SSM to this resource.

Returns:
the bound SSM name, or null if not bound to SSM.
Throws:
ManagementException - if the operation fails.

setBoundSSM

public void setBoundSSM(java.lang.String ssmName)
                 throws ManagementException
Bind the SSM to this resource. This resource must to be a binding node.

Parameters:
ssmName - the name of SSM to be bound, null to remove bound ssm.
Throws:
ManagementException - if the operation fails.

removeChild

public void removeChild(java.lang.String name)
                 throws ManagementException
Remove the child resource by relative name. All children of the child resources will also be removed. If there are policies on the child resource, the operation will fail.

Parameters:
name - the relative name of the child resource to be removed.
Throws:
ManagementException - if the operation fails.

removeChild

public void removeChild(java.lang.String name,
                        boolean isCascade)
                 throws ManagementException
Remove the child resource by relative name in cascading way.

Parameters:
name - the relative name of the child resource to remove.
isCascade - If true, the child resource, all its children and all policies on them will be removed. If If false, policies on the children of the child resources are not allowed to remove. If there are policies on the child resource and its children, the operation will fail.
Throws:
ManagementException - if the operation fails.

removeChild

public void removeChild(Resource child)
                 throws ManagementException
Remove the child resource. All children of the child resources will also be removed. If there are policies on the child resource, the operation will fail.

Parameters:
child - the child resource to be removed.
Throws:
ManagementException - if the operation fails.

removeChild

public void removeChild(Resource child,
                        boolean isCascade)
                 throws ManagementException
Remove the child resource in cascading way.

Parameters:
the - child resource to be removed.
isCascade - If true, the child resource, all its children and all policies on them will be removed. If If false, policies on the children of the child resources are not allowed to remove. If there are policies on the child resource and its children, the operation will fail.
Throws:
ManagementException -  

createChild

public Resource createChild(java.lang.String name)
                     throws ManagementException
Create a child node of this resource with relative name.Relative name the name has no parent resource info in it, For example, if fully qualified name is resources/aaa/bbb, then bbb is the relative name. The created child node is not a binding node, it is organizational or basic resource instead, is not a distribution point, and does not allow virtual resource.

Parameters:
name - The relative name of the child to create
Returns:
A resource representing the newly created child.
Throws:
ManagementException -  

createChild

public Resource createChild(java.lang.String name,
                            java.lang.String description,
                            boolean isBinding,
                            boolean isDistributionPoint,
                            boolean isAllowVirtualResource)
                     throws ManagementException
Create the child resource with relative name.

Parameters:
name - relative name of the child resource to be created
description - description for the new resource
isBinding - true if the resource is binding node, or false for none binding node.
isDistributionPoint - true if the resource is distribution point, or false for none distribution point.
isAllowVirtualResource - true if the resource is virtual resource, or false for none virtual resource.
Returns:
the child resource instance to be created
Throws:
ManagementException - if the operation fails.

moveTo

public void moveTo(Resource destination,
                   boolean isForced)
            throws ManagementException
Move the resource and all its children to be child of another resource.

Parameters:
destination - destination resource
isForced - true for removing those polcies and move if there are policies on the resource or its descendants; false for not allowing removing those polices when moving, if there are policies on the resource or its descendants, the operation fails. fail.
Throws:
ManagementException - if the operation fails.

moveTo

public void moveTo(Resource destination)
            throws ManagementException
Move the resource and all its children to be child of another resource. If there are policies on the resource or its descendants, the moving will fail.

Parameters:
destination - destination resource
Throws:
ManagementException - if the operation fails.

cloneTo

public Resource cloneTo(Resource destination)
                 throws ManagementException
Clone the resource and all its children to be child of another resource.

Parameters:
destination - destination resource
Returns:
resource the new cloned resource
Throws:
ManagementException - if the operation fails.

isChildBindingNodeAllowed

public boolean isChildBindingNodeAllowed()
                                  throws ManagementException
Check if child resource can be a binding node. If this resource or any of its ancestors is binding node, then its child resource can not be binding node any more.

Returns:
true or false
Throws:
ManagementException - if the operation fails.

getType

public int getType()
            throws ManagementException
Get the resource type

Returns:
INVALID_RESOURCE_NODE, BINDING_NODE, RESOURCE_NODE, ORGNIZATIONAL_NODE
Throws:
ManagementException - if the operation fails.

isChildDistributionPointAllowed

public boolean isChildDistributionPointAllowed()
                                        throws ManagementException
Check if the child of this resource can be a distribution point. Only organization resource and binding node can be a distribution point.

Returns:
true if the child can be distribution point, or false if the child can not.
Throws:
ManagementException - if the operation fails

getScopedName

public java.lang.String getScopedName()



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