|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opensaml.SAMLObject
org.opensaml.SAMLAttribute
Basic SAML Attribute implementation that handles rudimentary attribute value types
Field Summary | |
protected long |
lifetime
Effective lifetime of attribute's value(s) in seconds (0 means infinite) |
protected java.lang.String |
name
Name of attribute |
protected java.lang.String |
namespace
Namespace/qualifier of attribute |
protected QName |
type
The schema type of attribute value(s) |
protected java.util.ArrayList |
values
An array of attribute values |
Fields inherited from class org.opensaml.SAMLObject |
config, log, root |
Constructor Summary | |
SAMLAttribute()
Default constructor |
|
SAMLAttribute(org.w3c.dom.Element e)
Reconstructs an attribute from a DOM tree |
|
SAMLAttribute(java.io.InputStream in)
Reconstructs an attribute from a stream |
|
SAMLAttribute(java.lang.String name,
java.lang.String namespace,
QName type,
long lifetime,
java.util.Collection values)
Builds an Attribute out of its component parts |
Method Summary | |
boolean |
accept(org.w3c.dom.Element e)
Attribute acceptance hook used while consuming attributes from an assertion. |
boolean |
addValue(org.w3c.dom.Element e)
Imports a value to the state of the SAML Attribute, subject to acceptance. |
void |
addValue(java.lang.Object value)
Adds a value to the attribute |
void |
checkValidity()
Evaluates the object's content to see if it is currently valid if serialized. |
java.lang.Object |
clone()
Copies a SAML object such that no dependencies exist between the original and the copy. |
protected java.lang.String |
computeTypeDecl(org.w3c.dom.Element e)
Computes the xsi:type attribute on each AttributeValue element with any supporting declarations created. |
void |
fromDOM(org.w3c.dom.Element e)
Initialization of attribute from a DOM element. |
static SAMLAttribute |
getInstance(org.w3c.dom.Element e)
Locates an implementation class for an attribute and constructs it based on the DOM provided. |
static SAMLAttribute |
getInstance(java.io.InputStream in)
Locates an implementation class for an attribute and constructs it based on the stream provided. |
long |
getLifetime()
Gets the value's lifetime, in seconds |
java.lang.String |
getName()
Gets the AttributeName attribute of the SAML Attribute |
java.lang.String |
getNamespace()
Gets the AttributeNamespace attribute of the SAML Attribute |
QName |
getType()
Gets the value of the xsi:type attribute, if any, of the SAML Attribute |
java.util.Iterator |
getValues()
Gets the values of the SAML Attribute |
static void |
regFactory(java.lang.String name,
java.lang.String namespace,
java.lang.String className)
Registers a class to handle a specific SAML attribute when parsing XML |
void |
removeValue(int index)
Removes a value by position (zero-based) |
void |
setLifetime(long lifetime)
Sets the value's lifetime, in seconds |
void |
setName(java.lang.String name)
Sets the AttributeName attribute of the SAML Attribute |
void |
setNamespace(java.lang.String namespace)
Sets the AttributeNamespace attribute of the SAML Attribute |
void |
setType(QName type)
Sets the value of the xsi:type attribute, if any, of the SAML Attribute |
void |
setValues(java.util.Collection values)
Sets the values of the attribute |
org.w3c.dom.Node |
toDOM(org.w3c.dom.Document doc,
boolean xmlns)
Transforms the object into a DOM tree using an existing document context |
static void |
unregFactory(java.lang.String name,
java.lang.String namespace)
Unregisters a class to handle a specific SAML attribute when parsing XML |
protected void |
valueToDOM(java.lang.Object value,
org.w3c.dom.Element e)
Creates the DOM representation of an attribute value in the specified element. |
Methods inherited from class org.opensaml.SAMLObject |
fromStream, plantRoot, toBase64, toDOM, toDOM, toDOM, toStream, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String name
protected java.lang.String namespace
protected QName type
protected long lifetime
protected java.util.ArrayList values
Constructor Detail |
public SAMLAttribute()
public SAMLAttribute(java.lang.String name, java.lang.String namespace, QName type, long lifetime, java.util.Collection values) throws SAMLException
name
- Name of attributenamespace
- Namespace/qualifier of attributetype
- The schema type of attribute value(s)lifetime
- Effective lifetime of attribute's value(s) in
seconds (0 means infinite)values
- An array of attribute values
SAMLException
- Thrown if attribute cannot be built from the
supplied informationpublic SAMLAttribute(org.w3c.dom.Element e) throws SAMLException
e
- The root of a DOM tree
SAMLException
- Thrown if the object cannot be constructedpublic SAMLAttribute(java.io.InputStream in) throws SAMLException
in
- A stream containing XML
SAMLException
- Raised if an exception occurs while constructing
the object.Method Detail |
public static void regFactory(java.lang.String name, java.lang.String namespace, java.lang.String className)
name
- The attribute namenamespace
- The attribute namespaceclassName
- The Java class that handles this attributepublic static void unregFactory(java.lang.String name, java.lang.String namespace)
name
- The attribute namenamespace
- The attribute namespacepublic static SAMLAttribute getInstance(org.w3c.dom.Element e) throws SAMLException
e
- The root of a DOM containing the SAML attribute
SAMLException
- Thrown if an error occurs while constructing the objectpublic static SAMLAttribute getInstance(java.io.InputStream in) throws SAMLException
in
- The stream to deserialize from
SAMLException
- Thrown if an error occurs while constructing the objectprotected java.lang.String computeTypeDecl(org.w3c.dom.Element e)
e
- The root element of the attribute
protected void valueToDOM(java.lang.Object value, org.w3c.dom.Element e) throws SAMLException
The base implementation handles string values by creating a single Text node. Override this method in your subclass to perform more advanced processing.
value
- The attribute value to DOM-ifye
- The AttributeValue element to write into
SAMLException
- Raised if an error occurs while creating the DOMpublic void fromDOM(org.w3c.dom.Element e) throws SAMLException
Checks the attribute's syntactic validity. An exception is thrown if any problems are detected. The exception will contain a message describing the problem, and may wrap another exception.
Because attributes are generalized, this base method only handles attributes whose values are of uniform schema type. The attribute's schema type is set by the first xsi:type attribute found in the value list, if any.
The addValue method is used to actually process the values, and can be overridden to handle more complex values
fromDOM
in class SAMLObject
e
- Root element of a DOM tree
SAMLException
- Raised if an exception occurs while constructing the object.public java.lang.String getName()
public void setName(java.lang.String name)
name
- The name valuepublic java.lang.String getNamespace()
public void setNamespace(java.lang.String namespace)
namespace
- The name valuepublic QName getType()
public void setType(QName type)
type
- The schema type valuepublic long getLifetime()
public void setLifetime(long lifetime)
lifetime
- The effective lifetime of the attribute value, in seconds (0
means infinite)public java.util.Iterator getValues()
public boolean accept(org.w3c.dom.Element e)
e
- An AttributeValue element to check
public boolean addValue(org.w3c.dom.Element e)
The base version only supports a simple text node content model and uses Strings.
Override this method to perform advanced processing during XML import.
e
- The AttributeValue element containing the value to add
public void setValues(java.util.Collection values) throws SAMLException
values
- The values to use
SAMLException
- Raised if the value cannot be added to the attributepublic void addValue(java.lang.Object value) throws SAMLException
value
- The value to add
SAMLException
- Raised if the value cannot be properly addedpublic void removeValue(int index) throws java.lang.IndexOutOfBoundsException
index
- The position of the value to remove
java.lang.IndexOutOfBoundsException
public org.w3c.dom.Node toDOM(org.w3c.dom.Document doc, boolean xmlns) throws SAMLException
SAMLObject
toDOM
in class SAMLObject
doc
- A Document object to use in manufacturing the treexmlns
- Include namespace(s) on root element?
SAMLException
- Raised if the object is incompletely definedSAMLObject.toDOM(org.w3c.dom.Document,boolean)
public void checkValidity() throws SAMLException
SAMLObject
checkValidity
in class SAMLObject
SAMLException
- Raised if the serialized object would be invalid SAML,
excluding any embedded objectsSAMLObject.checkValidity()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class SAMLObject
java.lang.CloneNotSupportedException
Object.clone()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |