netapp.manage
Class NaElement

java.lang.Object
  extended bynetapp.manage.NaElement

public class NaElement
extends java.lang.Object

This class is one element of a XML-like tree of elements.


Constructor Summary
NaElement(java.lang.String name)
          Construct a NaElement with the specified name.
NaElement(java.lang.String name, java.lang.String content)
          Construct a NaElement with the specified name and content.
 
Method Summary
 void addChildElem(NaElement elem)
          Add a child element.
 void addNewChild(java.lang.String name, java.lang.String content)
          Add a new child element with a given name and content.
 void addNewEncryptedChild(java.lang.String name, java.lang.String content)
          Encrypts data contained in content.
 void childAdd(NaElement n)
          Deprecated. As of SDK version 1.4, replaced by addChildElem(NaElement).
 NaElement childAddString(java.lang.String name, java.lang.String val)
          Deprecated. As of SDK version 1.4, replaced by addNewChild(String,String).
 NaElement childGet(java.lang.String n)
          Deprecated. As of SDK version 1.4, replaced by getChildByName(String).
 int childGetInt(java.lang.String name, int defVal)
          Deprecated. As of SDK version 1.4, replaced by getChildIntValue(String,int).
 java.lang.String childGetString(java.lang.String name)
          Deprecated. As of SDK version 1.4, replaced by getChildContent(String).
 java.util.Vector childrenGet()
          Deprecated. As of SDK version 1.4, replaced by getChildren().
 java.lang.String getAttr(java.lang.String name)
          Get the value of an attribute.
 NaElement getChildByName(java.lang.String name)
          Find and return the child element with a specified name.
 java.lang.String getChildContent(java.lang.String name)
          Find a child with the specified name and return its string content.
 java.lang.String getChildEncryptContent(java.lang.String name)
          Finds a child with the specified name , decrypts it's string content and returns decrypted content.
 int getChildIntValue(java.lang.String name, int defVal)
          Find a child with the specified name and return its content as as an int value.
 long getChildLongValue(java.lang.String name, long defVal)
          Find a child with the specified name and return its content as as an int value.
 java.util.List getChildren()
          Get the list of children.
 java.lang.String getContent()
          Get the value of the content of this element.
 java.lang.String getEncryptContent()
          Decrypts and returns the value of content of this element.
 java.lang.String getName()
          Get the name of this element.
 boolean hasChildren()
          Determine if there are children.
 int resultsErrno()
          Deprecated. As of SDK version 1.4, always returns 0. NaServer.invoke() now throws NaAPIFailedException from which errno is available using getErrno().
 java.lang.String resultsReason()
          Deprecated. As of SDK version 1.4, always returns null. NaServer.invoke() now throws NaAPIFailedException from which reason is available using getReason().
 boolean resultsStatus()
          Deprecated. As of SDK version 1.4, always returns true
 void setContent(java.lang.String content)
          Set the value of the content of this element.
 void setName(java.lang.String name)
          Set the name of this element.
 java.lang.String toPrettyString(java.lang.String prefix)
          Convert an element and all its children to a pretty XML string.
 java.lang.String toPrettyString(java.lang.String prefix, int maxDepth)
          Convert an element and all its children to a pretty XML string.
 java.lang.String toString()
          Convert an element and all its children to a single string, formatted as XML.
 java.lang.String toString(java.lang.String prefix)
          Deprecated. As of SDK version 1.4, replaced by toPrettyString(String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NaElement

public NaElement(java.lang.String name)
Construct a NaElement with the specified name.

Parameters:
name - the element name.

NaElement

public NaElement(java.lang.String name,
                 java.lang.String content)
Construct a NaElement with the specified name and content.

Parameters:
name - the element name.
content - the element content.
Method Detail

toPrettyString

public java.lang.String toPrettyString(java.lang.String prefix,
                                       int maxDepth)
Convert an element and all its children to a pretty XML string. Readable/indented output is produced, with a prefix at the beginning of each line. XML tags deeper than the maximum nesting level are represented with "...".

Parameters:
prefix - string to add to the beginning of each line.
maxDepth - maximum nesting level to stringify.
Returns:
string value containing XML.

toPrettyString

public java.lang.String toPrettyString(java.lang.String prefix)
Convert an element and all its children to a pretty XML string. Readable/indented output is produced, with a prefix at the beginning of each line.

Parameters:
prefix - string to add to the beginning of each line.
Returns:
string value containing XML.

toString

public java.lang.String toString()
Convert an element and all its children to a single string, formatted as XML.

Returns:
String value containing XML.

setName

public void setName(java.lang.String name)
Set the name of this element.

Parameters:
name - the new name.

getName

public java.lang.String getName()
Get the name of this element.

Returns:
name of the element.

getChildContent

public java.lang.String getChildContent(java.lang.String name)
Find a child with the specified name and return its string content. Returns null if it's unable to find child with the specified name.

Parameters:
name - name of the desired child.
Returns:
content of the child.

getChildIntValue

public int getChildIntValue(java.lang.String name,
                            int defVal)
Find a child with the specified name and return its content as as an int value.

Parameters:
name - name of the desired child.
defVal - if the named child does not exist, this value is returned.
Returns:
String value of that child.

getChildLongValue

public long getChildLongValue(java.lang.String name,
                              long defVal)
Find a child with the specified name and return its content as as an int value.

Parameters:
name - name of the desired child.
defVal - if the named child does not exist, this value is returned.
Returns:
long value of that child.

getChildren

public java.util.List getChildren()
Get the list of children.

Returns:
List containing NaElement values.

getChildByName

public NaElement getChildByName(java.lang.String name)
Find and return the child element with a specified name. The value returned is the actual child, not a cloned copy, so modifications to it will affect the actual child. Returns null if it's unable to find child element with specified name.

Parameters:
name - rhe name of the child to find.
Returns:
a NaElement which is the child.

hasChildren

public boolean hasChildren()
Determine if there are children.

Returns:
false if there are no children, true otherwise.

setContent

public void setContent(java.lang.String content)
Set the value of the content of this element.

Parameters:
content - the content.

getContent

public java.lang.String getContent()
Get the value of the content of this element.

Returns:
the content.

addNewChild

public void addNewChild(java.lang.String name,
                        java.lang.String content)
Add a new child element with a given name and content.

Parameters:
name - The name of the new child element.
content - The content value of the new child element.

addChildElem

public void addChildElem(NaElement elem)
Add a child element.

Parameters:
elem - the child elemet to add.

getAttr

public java.lang.String getAttr(java.lang.String name)
Get the value of an attribute.

Parameters:
name - attribute name.
Returns:
value of the attribute (or null). Returns null if it's unable to get value for a given attribute.

addNewEncryptedChild

public void addNewEncryptedChild(java.lang.String name,
                                 java.lang.String content)
Encrypts data contained in content. Adds a new child element with a given name and encrypted content.

Parameters:
name - The name of new child element.
content - The content value of new child element.

getChildEncryptContent

public java.lang.String getChildEncryptContent(java.lang.String name)
Finds a child with the specified name , decrypts it's string content and returns decrypted content.

Parameters:
name - The name of child element.
Returns:
The content of child element.

getEncryptContent

public java.lang.String getEncryptContent()
Decrypts and returns the value of content of this element.

Returns:
The content of this element.

toString

public java.lang.String toString(java.lang.String prefix)
Deprecated. As of SDK version 1.4, replaced by toPrettyString(String).


childGetString

public java.lang.String childGetString(java.lang.String name)
Deprecated. As of SDK version 1.4, replaced by getChildContent(String).


childGetInt

public int childGetInt(java.lang.String name,
                       int defVal)
Deprecated. As of SDK version 1.4, replaced by getChildIntValue(String,int).


childrenGet

public java.util.Vector childrenGet()
Deprecated. As of SDK version 1.4, replaced by getChildren().


childGet

public NaElement childGet(java.lang.String n)
Deprecated. As of SDK version 1.4, replaced by getChildByName(String).


childAddString

public NaElement childAddString(java.lang.String name,
                                java.lang.String val)
Deprecated. As of SDK version 1.4, replaced by addNewChild(String,String).


childAdd

public void childAdd(NaElement n)
Deprecated. As of SDK version 1.4, replaced by addChildElem(NaElement).


resultsReason

public java.lang.String resultsReason()
Deprecated. As of SDK version 1.4, always returns null. NaServer.invoke() now throws NaAPIFailedException from which reason is available using getReason().


resultsErrno

public int resultsErrno()
Deprecated. As of SDK version 1.4, always returns 0. NaServer.invoke() now throws NaAPIFailedException from which errno is available using getErrno().


resultsStatus

public boolean resultsStatus()
Deprecated. As of SDK version 1.4, always returns true