com.tivoli.pd.jadmin
Class PDProtObject

java.lang.Object
  |
  +--com.tivoli.pd.jadmin.PDProtObject
All Implemented Interfaces:
java.lang.Cloneable

public class PDProtObject
extends java.lang.Object
implements java.lang.Cloneable

Policy Director Protected Object class.

Protected objects are objects in the protected namespace that have an ACL attached to them. Each is uniquely identified by its namespace ID.

Unlike the PDAdmin C API, there is no type associated with a protected object. Extended attributes need to be used instead.


Constructor Summary
PDProtObject(PDContext context, java.lang.String id, PDAttrs inData, PDAttrs outData, PDMessages messages)
          Constructs a local object of a protected object that already exists in the Management Server.
 
Method Summary
 void attachAcl(PDContext context, java.lang.String aclId, PDMessages messages)
          Attaches an ACL to a protected object in the Management Server, and in this object.
static void attachAcl(PDContext context, java.lang.String id, java.lang.String aclId, PDMessages messages)
          Attaches an ACL to a protected object in the Management Server.
 java.lang.Object clone()
          Returns a copy of this object.
static void createProtObject(PDContext context, java.lang.String id, java.lang.String description, boolean isPolicyAttachable, java.lang.String aclId, PDAttrs attributes, PDMessages messages)
          Creates a protected object in the Management Server.
 void deleteAttribute(PDContext context, java.lang.String attributeName, PDMessages messages)
          Deletes the extended attribute for this protected object in the Management Server and also in this object.
static void deleteAttribute(PDContext context, java.lang.String id, java.lang.String attributeName, PDMessages messages)
          Deletes the extended attribute for a protected object in the Management Server.
 void deleteAttributeValue(PDContext context, java.lang.String attributeName, java.lang.String attributeValue, PDMessages messages)
          Deletes a value for an extended attribute for this protected object in the Management Server and also in this object.
static void deleteAttributeValue(PDContext context, java.lang.String id, java.lang.String attributeName, java.lang.String attributeValue, PDMessages messages)
          Deletes a value for an extended attribute for a protected object in the Management Server.
static void deleteProtObject(PDContext context, java.lang.String id, PDMessages messages)
          Deletes a protected object in the Management Server.
 void detachAcl(PDContext context, PDMessages messages)
          Detaches an ACL from a protected object in the Management Server, and in this object.
static void detachAcl(PDContext context, java.lang.String id, PDMessages messages)
          Detaches an ACL from a protected object in the Management Server.
 boolean equals(java.lang.Object obj)
          Determines whether this PDProtObject is equivalent to the input object.
 PDAcl getAcl()
          Gets the ACL of this protected object.
 java.util.ArrayList getAttributeNames()
          Gets the names of the extended attributes for this protected object.
 java.util.ArrayList getAttributeValues(java.lang.String attributeName)
          Gets the value(s) of an extended attribute for this protected object.
 java.lang.String getDescription()
          Gets the description of this protected object.
 java.lang.String getId()
          Gets the name of this protected object.
 boolean isPolicyAttachable()
          Gets the isPolicyAttachable flag of this protected object.
static java.util.ArrayList listProtObjects(PDContext context, java.lang.String id, PDAttrs inData, PDAttrs outData, PDMessages messages)
          Returns a list of protected objects under the specified directory in the Management Server.
static java.util.ArrayList listProtObjectsByAcl(PDContext context, java.lang.String aclId, PDMessages messages)
          Returns a list of protected objects that exist in the Management Server and have the specified ACL attached.
 void setAttributeValue(PDContext context, java.lang.String attributeName, java.lang.String attributeValue, PDMessages messages)
          Sets the value of an extended attribute for this protected object in the Management Server and also in this object.
static void setAttributeValue(PDContext context, java.lang.String id, java.lang.String attributeName, java.lang.String attributeValue, PDMessages messages)
          Sets the value of an extended attribute for a protected object in the Management Server.
 void setDescription(PDContext context, java.lang.String newDescription, PDMessages messages)
          Sets the descriptive string for a protected object in the Management Server, and in this object.
static void setDescription(PDContext context, java.lang.String id, java.lang.String newDescription, PDMessages messages)
          Sets the descriptive string for a protected object in the Management Server.
 void setPolicyAttachable(PDContext context, boolean isPolicyAttachable, PDMessages messages)
          Sets whether policy can be attached to a protected object in the Management Server, and in this object.
static void setPolicyAttachable(PDContext context, java.lang.String id, boolean isPolicyAttachable, PDMessages messages)
          Sets whether policy can be attached to a protected object in the Management Server.
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDProtObject

public PDProtObject(PDContext context,
                    java.lang.String id,
                    PDAttrs inData,
                    PDAttrs outData,
                    PDMessages messages)
             throws PDException
Constructs a local object of a protected object that already exists in the Management Server.

This constructor is equivalent to the ivadmin_protobj_get2() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object to be constructed. Cannot be null.
inData - Input attribute list. Will be supported in the future. For now, pass a null value for this parameter.
outData - Output attribute list. Will be supported in the future. For now, pass a null value for this parameter.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.
Method Detail

setDescription

public void setDescription(PDContext context,
                           java.lang.String newDescription,
                           PDMessages messages)
                    throws PDException
Sets the descriptive string for a protected object in the Management Server, and in this object.

This method implements the function provided by the ivadmin_protobj_setdesc() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
newDescription - descriptive string for the protected object. Cannot be null; use the empty String to clear the existing description.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

setPolicyAttachable

public void setPolicyAttachable(PDContext context,
                                boolean isPolicyAttachable,
                                PDMessages messages)
                         throws PDException
Sets whether policy can be attached to a protected object in the Management Server, and in this object.

This method implements the function provided by the ivadmin_protobj_setpolicyattachable() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
isPolicyAttachable - True if a policy can be attached to the protected object, False otherwise. Protected Object Policies (POPs) will be supported in the future (equivalent to the ivadmin_pop_* C APIs).
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

attachAcl

public void attachAcl(PDContext context,
                      java.lang.String aclId,
                      PDMessages messages)
               throws PDException
Attaches an ACL to a protected object in the Management Server, and in this object. If an ACL is already attached to the protected object in question, the currently-specified ACL replaces the old one.

This method implements the function provided by the ivadmin_protobj_attachacl() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
aclId - name of the ACL to attach. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

detachAcl

public void detachAcl(PDContext context,
                      PDMessages messages)
               throws PDException
Detaches an ACL from a protected object in the Management Server, and in this object. Since there can only be one ACL attached at a time to an object, the currently attached ACL is detached. Returns error if there is no ACL attached.

This method implements the function provided by the ivadmin_protobj_detachacl() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

setAttributeValue

public void setAttributeValue(PDContext context,
                              java.lang.String attributeName,
                              java.lang.String attributeValue,
                              PDMessages messages)
                       throws PDException
Sets the value of an extended attribute for this protected object in the Management Server and also in this object.

Creates the attribute if it does not exist, and sets the specified value. If the attribute already exists, adds the specified value as an additional value for this attribute.

This method implements the function provided by the ivadmin_protobj_attrput() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
attributeName - name of the extended attribute. Cannot be null.
attributeValue - string value of the attribute. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

deleteAttribute

public void deleteAttribute(PDContext context,
                            java.lang.String attributeName,
                            PDMessages messages)
                     throws PDException
Deletes the extended attribute for this protected object in the Management Server and also in this object. Returns error if the attribute does not exist.

This method implements the function provided by the ivadmin_protobj_attrdelkey() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
attributeName - name of the extended attribute. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

deleteAttributeValue

public void deleteAttributeValue(PDContext context,
                                 java.lang.String attributeName,
                                 java.lang.String attributeValue,
                                 PDMessages messages)
                          throws PDException
Deletes a value for an extended attribute for this protected object in the Management Server and also in this object. Returns error if the attribute does not exist.

This method implements the function provided by the ivadmin_protobj_attrdelval() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
attributeName - name of the extended attribute. Cannot be null.
attributeValue - string value of the extended attribute. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

getId

public java.lang.String getId()
                       throws PDException
Gets the name of this protected object.

This method implements the function provided by the ivadmin_protobj_getid() C API.

Returns:
String that is the name of this protected object. Cannot be null.
Throws:
PDException - if an error occurs.

getDescription

public java.lang.String getDescription()
                                throws PDException
Gets the description of this protected object.

This method implements the function provided by the ivadmin_protobj_getdescription() C API.

Returns:
String that is the description of this protected object. Cannot be null.
Throws:
PDException - if an error occurs.

isPolicyAttachable

public boolean isPolicyAttachable()
                           throws PDException
Gets the isPolicyAttachable flag of this protected object.

This method implements the function provided by the ivadmin_protobj_getpolicyattachable() C API.

Returns:
isPolicyAttachable flag of this protected object. True if a policy can be attached to the protected object, False otherwise. Protected Object Policies (POPs) will be supported in the future (equivalent to the ivadmin_pop_* C APIs).
Throws:
PDException - if an error occurs.

getAcl

public PDAcl getAcl()
             throws PDException
Gets the ACL of this protected object.

This method implements the function provided by the ivadmin_protobj_getacl() C API.

Returns:
a PDAcl object attached to this protected object. Returns null if no Acl is currently attached.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

getAttributeNames

public java.util.ArrayList getAttributeNames()
                                      throws PDException
Gets the names of the extended attributes for this protected object.

This method implements the function provided by the ivadmin_protobj_attrlist() C API.

Returns:
an ArrayList of strings that represent the names of the extended attributes of this protected object. Empty ArrayList if this object has no extended attributes.
Throws:
PDException - if an error occurs.

getAttributeValues

public java.util.ArrayList getAttributeValues(java.lang.String attributeName)
                                       throws PDException
Gets the value(s) of an extended attribute for this protected object.

This method implements the function provided by the ivadmin_protobj_attrget() C API.

Parameters:
attributeName - name of the extended attribute
Returns:
an ArrayList of strings that represent the values for the specified extended attribute of this protected object. Empty ArrayList if there are no values for the specified attribute name.
Throws:
PDException - if an error occurs.

toString

public java.lang.String toString()
Returns a String representation of this object.
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Returns a copy of this object.

equals

public boolean equals(java.lang.Object obj)
Determines whether this PDProtObject is equivalent to the input object.
Overrides:
equals in class java.lang.Object

createProtObject

public static void createProtObject(PDContext context,
                                    java.lang.String id,
                                    java.lang.String description,
                                    boolean isPolicyAttachable,
                                    java.lang.String aclId,
                                    PDAttrs attributes,
                                    PDMessages messages)
                             throws PDException
Creates a protected object in the Management Server.

This method is equivalent to the ivadmin_protobj_create() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object. A valid name needs to start with the name of an existing PDProtObjectSpace followed by a forward slash and one or more characters. Cannot be null.
description - description of the protected object. If null, an empty string is assumed. The input parameter is not changed.
isPolicyAttachable - can policy be attached to this protected object?
aclId - name of the ACL to be attached. Will be supported in the future. For now, pass a null value for this parameter. Use the attachAcl() method to set the ACL for the protected object.
attributes - extended attributes for this protected object. Will be supported in the future. For now, pass a null value for this parameter. Use the setAttributeValue() method to set the attributes for the protected object.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

listProtObjects

public static java.util.ArrayList listProtObjects(PDContext context,
                                                  java.lang.String id,
                                                  PDAttrs inData,
                                                  PDAttrs outData,
                                                  PDMessages messages)
                                           throws PDException
Returns a list of protected objects under the specified directory in the Management Server. It only returns objects immediately under this directory and does not include subdirectories.

This method is equivalent to the ivadmin_protobj_list3() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - Parent directory within the protected objectspace. Cannot be null.
inData - Input attribute list. Will be supported in the future. For now, pass a null value for this parameter.
outData - Output attribute list. Will be supported in the future. For now, pass a null value for this parameter.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Returns:
an ArrayList of Strings that represent the names of all the protected objects under the specified directory. Empty ArrayList if no such protected objects exist.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

listProtObjectsByAcl

public static java.util.ArrayList listProtObjectsByAcl(PDContext context,
                                                       java.lang.String aclId,
                                                       PDMessages messages)
                                                throws PDException
Returns a list of protected objects that exist in the Management Server and have the specified ACL attached.

This method is equivalent to the ivadmin_protobj_listbyacl() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
aclId - name of the ACL. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Returns:
an ArrayList of Strings that represent the names of all the protected objects that have the specified ACL attached to them. Empty ArrayList if no such protected objects exist.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

deleteProtObject

public static void deleteProtObject(PDContext context,
                                    java.lang.String id,
                                    PDMessages messages)
                             throws PDException
Deletes a protected object in the Management Server.

This method is equivalent to the ivadmin_protobj_delete() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object to be deleted. A valid name is that of a protected object that already exists. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

setDescription

public static void setDescription(PDContext context,
                                  java.lang.String id,
                                  java.lang.String newDescription,
                                  PDMessages messages)
                           throws PDException
Sets the descriptive string for a protected object in the Management Server.

This method implements the function provided by the ivadmin_protobj_setdesc() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object. Cannot be null.
newDescription - descriptive string for the protected object. Cannot be null; use the empty String to clear the existing description.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

setPolicyAttachable

public static void setPolicyAttachable(PDContext context,
                                       java.lang.String id,
                                       boolean isPolicyAttachable,
                                       PDMessages messages)
                                throws PDException
Sets whether policy can be attached to a protected object in the Management Server.

This method implements the function provided by the ivadmin_protobj_setpolicyattachable() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object. Cannot be null.
isPolicyAttachable - True if a policy can be attached to the protected object, False otherwise. Protected Object Policies (POPs) will be supported in the future (equivalent to the ivadmin_pop_* C APIs).
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

attachAcl

public static void attachAcl(PDContext context,
                             java.lang.String id,
                             java.lang.String aclId,
                             PDMessages messages)
                      throws PDException
Attaches an ACL to a protected object in the Management Server. If an ACL is already attached to the protected object in question, the currently-specified ACL replaces the old one.

This method implements the function provided by the ivadmin_protobj_attachacl() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object. Cannot be null.
aclId - name of the ACL to attach. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

detachAcl

public static void detachAcl(PDContext context,
                             java.lang.String id,
                             PDMessages messages)
                      throws PDException
Detaches an ACL from a protected object in the Management Server. Since there can only be one ACL attached at a time to an object, the currently attached ACL is detached. Returns error if there is no ACL attached.

This method implements the function provided by the ivadmin_protobj_detachacl() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

setAttributeValue

public static void setAttributeValue(PDContext context,
                                     java.lang.String id,
                                     java.lang.String attributeName,
                                     java.lang.String attributeValue,
                                     PDMessages messages)
                              throws PDException
Sets the value of an extended attribute for a protected object in the Management Server.

Creates the attribute if it does not exist, and sets the specified value. If the attribute already exists, adds the specified value as an additional value for this attribute.

This method implements the function provided by the ivadmin_protobj_attrput() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object. Cannot be null.
attributeName - name of the extended attribute. Cannot be null.
attributeValue - string value of the attribute. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

deleteAttribute

public static void deleteAttribute(PDContext context,
                                   java.lang.String id,
                                   java.lang.String attributeName,
                                   PDMessages messages)
                            throws PDException
Deletes the extended attribute for a protected object in the Management Server. Returns error if the attribute does not exist.

This method implements the function provided by the ivadmin_protobj_attrdelkey() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object. Cannot be null.
attributeName - name of the extended attribute. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.

deleteAttributeValue

public static void deleteAttributeValue(PDContext context,
                                        java.lang.String id,
                                        java.lang.String attributeName,
                                        java.lang.String attributeValue,
                                        PDMessages messages)
                                 throws PDException
Deletes a value for an extended attribute for a protected object in the Management Server. Returns error if the attribute does not exist.

This method implements the function provided by the ivadmin_protobj_attrdelval() C API.

Parameters:
context - PDContext to be used to communicate with the Management Server. Cannot be null.
id - name of the protected object. Cannot be null.
attributeName - name of the extended attribute. Cannot be null.
attributeValue - value of the extended attribute. Cannot be null.
messages - in/out parameter; empty PDMessages on input; may contain zero or more informational or warning messages on output. Cannot be null.
Throws:
PDException - if an error occurs. This exception may contain error and message codes defined in the product Error Message Reference document.