eu.semiramis.policyManager.util.opensaml
Class XACMLUtils

java.lang.Object
  extended by eu.semiramis.policyManager.util.opensaml.XACMLUtils

public class XACMLUtils
extends java.lang.Object

The XACMLUtils class contains some utility method that helps in building XACML objects.

Author:
Paolo Roccetti

Constructor Summary
XACMLUtils()
           
 
Method Summary
static
<T extends org.opensaml.xml.XMLObject>
T
create(java.lang.Class<T> cls, javax.xml.namespace.QName qname)
          Creates a new XMLObject from its Class object and QName.
static org.opensaml.xacml.ctx.ActionType createAction(org.opensaml.xacml.ctx.AttributeType... attributes)
          Creates an ActionType object containing the given attributes
static org.opensaml.xacml.ctx.AttributeType createAttribute(java.lang.String attributeId, org.opensaml.xacml.ctx.AttributeValueType... values)
          Creates an AttributeType object containing the given values
static org.opensaml.xacml.ctx.AttributeValueType createAttributeValue(java.lang.String attributeValue)
          Creates an AttributeValueType object with the given value
static org.opensaml.xacml.ctx.ResourceType createResource(org.opensaml.xacml.ctx.AttributeType... attributes)
          Creates a ResourceType object containing the given attributes
static org.opensaml.xacml.ctx.SubjectType createSubject(org.opensaml.xacml.ctx.AttributeType... attributes)
          Creates a SubjectType object containing the given attributes
static
<T extends org.opensaml.xml.XMLObject>
org.w3c.dom.Element
marshall(T xmlObject)
          Marshal an XMLObject to a W3C DOM Element.
static
<T extends org.opensaml.xml.XMLObject>
java.lang.String
printXMLObject(T xmlObject)
          Marshall and print an extension of XMLObject to a String.
static
<T extends org.opensaml.xml.XMLObject>
T
unmarshall(org.w3c.dom.Document document)
          Unmarshall an extension of a XMLObject from its Document representation
static
<T extends org.opensaml.xml.XMLObject>
T
unmarshall(java.lang.String strXMLDocument)
          Unmarshall an extension of a XMLObject from its String representation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XACMLUtils

public XACMLUtils()
Method Detail

createSubject

public static org.opensaml.xacml.ctx.SubjectType createSubject(org.opensaml.xacml.ctx.AttributeType... attributes)
Creates a SubjectType object containing the given attributes

Parameters:
attributes - the attributes to be added to the subject object
Returns:
the SubjectType object created

createResource

public static org.opensaml.xacml.ctx.ResourceType createResource(org.opensaml.xacml.ctx.AttributeType... attributes)
Creates a ResourceType object containing the given attributes

Parameters:
attributes - the attributes to be added to the resource object
Returns:
the ResourceType object created

createAttribute

public static org.opensaml.xacml.ctx.AttributeType createAttribute(java.lang.String attributeId,
                                                                   org.opensaml.xacml.ctx.AttributeValueType... values)
Creates an AttributeType object containing the given values

Parameters:
attributeId - the attribute id
values - the attribute values
Returns:
the AttributeType object created

createAttributeValue

public static org.opensaml.xacml.ctx.AttributeValueType createAttributeValue(java.lang.String attributeValue)
Creates an AttributeValueType object with the given value

Parameters:
attributeValue - the attribute value
Returns:
the AttributeValueType object created

createAction

public static org.opensaml.xacml.ctx.ActionType createAction(org.opensaml.xacml.ctx.AttributeType... attributes)
Creates an ActionType object containing the given attributes

Parameters:
attributes - the attributes to be added to the ActionType object
Returns:
the ActionType object created

create

public static <T extends org.opensaml.xml.XMLObject> T create(java.lang.Class<T> cls,
                                                              javax.xml.namespace.QName qname)
Creates a new XMLObject from its Class object and QName.

Parameters:
cls - the Class of the new XMLObject
qname - the QName of the new XMLObject
Returns:
the new XMLObject created

marshall

public static <T extends org.opensaml.xml.XMLObject> org.w3c.dom.Element marshall(T xmlObject)
                                    throws org.opensaml.xml.io.MarshallingException
Marshal an XMLObject to a W3C DOM Element.

Parameters:
xmlObject - the object extending XMLObject to marshall
Returns:
the W3C DOM element representing this XML element
Throws:
org.opensaml.xml.io.MarshallingException - if the marshalling process fails

printXMLObject

public static <T extends org.opensaml.xml.XMLObject> java.lang.String printXMLObject(T xmlObject)
                                       throws org.opensaml.xml.io.MarshallingException
Marshall and print an extension of XMLObject to a String.

Parameters:
xmlObject - the xml object extending XMLObject
Returns:
the string of the marshalled object
Throws:
org.opensaml.xml.io.MarshallingException - if the marshalling process fails

unmarshall

public static <T extends org.opensaml.xml.XMLObject> T unmarshall(org.w3c.dom.Document document)
                                                       throws org.opensaml.xml.io.UnmarshallingException
Unmarshall an extension of a XMLObject from its Document representation

Parameters:
document - the Document to unmarshall
Returns:
the XMLObject from the unmashalled Document
Throws:
org.opensaml.xml.io.UnmarshallingException - if the unmarshalling process fails

unmarshall

public static <T extends org.opensaml.xml.XMLObject> T unmarshall(java.lang.String strXMLDocument)
                                                       throws org.opensaml.xml.parse.XMLParserException,
                                                              org.opensaml.xml.io.UnmarshallingException
Unmarshall an extension of a XMLObject from its String representation

Parameters:
strXMLDocument - the String containing the XML representation of the XMLObject to unmarshall
Returns:
the XMLObject from the given String
Throws:
org.opensaml.xml.parse.XMLParserException - in case the XML string cannot be properly parsed to a Document
org.opensaml.xml.io.UnmarshallingException - if the unmarshalling process fails