org.eclipse.higgins.idas.cp.jspolicy
Class JSPolicyEntity

java.lang.Object
  extended byorg.eclipse.higgins.idas.cp.jspolicy.JSPolicyEntity
All Implemented Interfaces:
org.eclipse.higgins.idas.api.IEntity, org.eclipse.higgins.idas.api.IHasAttributes, org.eclipse.higgins.idas.api.IHasMetadata

public class JSPolicyEntity
extends Object
implements org.eclipse.higgins.idas.api.IEntity, org.eclipse.higgins.idas.api.IHasMetadata

A Higgins Entity implementation allowing for javascript policy at critical points. Utilizing Mozilla's Rhino project, this code currently supports JavaScript PDPs at the following points:

Additional PDPs found in JSPolicyContext, JSPolicyEntity, and TODO add doc

Author:
dbuss@novell.com, tdoman@novell.com

Method Summary
 org.eclipse.higgins.idas.api.IAttribute addAttribute(org.eclipse.higgins.idas.api.IAttribute copyFrom)
          TODO there are three cases we have to deal with 1 - The attribute is a generic IAttribute created from some other iContext 2 - The attribute was returned from this Policy Context and the values are already mapped 3 - The attribute was created using addAttribute and values need to be mapped.
 org.eclipse.higgins.idas.api.IAttribute addAttribute(URI type)
           
 org.eclipse.higgins.idas.api.IMetadata addMetadata(org.eclipse.higgins.idas.api.IMetadata copyFrom)
           
 org.eclipse.higgins.idas.api.IMetadata addMetadata(URI type)
           
 boolean equals(org.eclipse.higgins.idas.api.IHasAttributes attributes)
           
 boolean equals(org.eclipse.higgins.idas.api.IHasMetadata metadataSet)
           
 org.eclipse.higgins.idas.api.IAttribute getAttribute(URI attributeID)
          This Context Provider allows Attribute types to be mapped from stored (real) values to what is presented by consumers of this Context Provider by inserting JavaScript into the configuration file.
 Iterator getAttributes()
          (non-Javadoc)
 org.eclipse.higgins.idas.api.IContext getContext()
           
 String getEntityID()
          Returns the Subject ID of this Entity.
 URI getEntityType()
          Returns the type of this Entity.
 org.eclipse.higgins.idas.api.IMetadata getMetadata(URI metadataID)
           
 Iterator getMetadataSet()
          TODO: this may return unmapped metadata, this should be fixed.
 org.eclipse.higgins.idas.api.model.IEntityModel getModel()
          TODO: implement this
 org.eclipse.higgins.idas.api.ISingleValuedAttribute getSingleValuedAttribute(URI attrType)
           
 void remove()
           
 void removeAttribute(URI attrType)
           
 void removeAttributeValue(org.eclipse.higgins.idas.api.IAttribute attr)
           
 void removeAttributeValue(URI attrType, Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContext

public org.eclipse.higgins.idas.api.IContext getContext()
                                                 throws org.eclipse.higgins.idas.api.IdASException
Specified by:
getContext in interface org.eclipse.higgins.idas.api.IEntity
Throws:
org.eclipse.higgins.idas.api.IdASException

getEntityID

public String getEntityID()
                   throws org.eclipse.higgins.idas.api.IdASException
Returns the Subject ID of this Entity. This Context Provider allows Entity IDs to be mapped from stored (real) values to what is presented by consumers of this Context Provider.

Please see JSPolicyContext.consumerEntityIDToProvider for usage and examples.

Specified by:
getEntityID in interface org.eclipse.higgins.idas.api.IEntity
Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
IEntity.getEntityID()

getEntityType

public URI getEntityType()
                  throws org.eclipse.higgins.idas.api.IdASException
Returns the type of this Entity. This Context Provider allows Entity types to be mapped from stored (real) values to what is presented by consumers of this Context Provider by inserting JavaScript into the configuration file.

Please see JSPolicyContext.consumerEntityIDToProvider

Specified by:
getEntityType in interface org.eclipse.higgins.idas.api.IEntity
Throws:
org.eclipse.higgins.idas.api.IdASException

getAttributes

public Iterator getAttributes()
                       throws org.eclipse.higgins.idas.api.IdASException
(non-Javadoc)

Specified by:
getAttributes in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
IHasAttributes.getAttributes()

getAttribute

public org.eclipse.higgins.idas.api.IAttribute getAttribute(URI attributeID)
                                                     throws org.eclipse.higgins.idas.api.IdASException
This Context Provider allows Attribute types to be mapped from stored (real) values to what is presented by consumers of this Context Provider by inserting JavaScript into the configuration file. Since one consumer type may map to more than one virtual type each potential type is examined to see if the provider object has values. Because of the error prone nature of this call it is recomended that it be used with extreme caution. The PDP described by JSPolicyContext.consumerATypeToProvider contains the type mappings.

TODO: Should we have a PDP just for this function which controls the behavior of error handling and type mapping?

Specified by:
getAttribute in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
IHasAttributes.getAttribute(java.net.URI)

getSingleValuedAttribute

public org.eclipse.higgins.idas.api.ISingleValuedAttribute getSingleValuedAttribute(URI attrType)
                                                                             throws org.eclipse.higgins.idas.api.IdASException,
                                                                                    org.eclipse.higgins.idas.api.NotSingleValuedAttributeException
Specified by:
getSingleValuedAttribute in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException
org.eclipse.higgins.idas.api.NotSingleValuedAttributeException

getMetadataSet

public Iterator getMetadataSet()
                        throws org.eclipse.higgins.idas.api.IdASException
TODO: this may return unmapped metadata, this should be fixed. (non-Javadoc)

Specified by:
getMetadataSet in interface org.eclipse.higgins.idas.api.IHasMetadata
Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
IHasMetadata.getMetadataSet()

getMetadata

public org.eclipse.higgins.idas.api.IMetadata getMetadata(URI metadataID)
                                                   throws org.eclipse.higgins.idas.api.IdASException
Specified by:
getMetadata in interface org.eclipse.higgins.idas.api.IHasMetadata
Throws:
org.eclipse.higgins.idas.api.IdASException

addMetadata

public org.eclipse.higgins.idas.api.IMetadata addMetadata(URI type)
                                                   throws org.eclipse.higgins.idas.api.IdASException,
                                                          org.eclipse.higgins.idas.api.InvalidTypeException
Specified by:
addMetadata in interface org.eclipse.higgins.idas.api.IHasMetadata
Throws:
org.eclipse.higgins.idas.api.IdASException
org.eclipse.higgins.idas.api.InvalidTypeException

addMetadata

public org.eclipse.higgins.idas.api.IMetadata addMetadata(org.eclipse.higgins.idas.api.IMetadata copyFrom)
                                                   throws org.eclipse.higgins.idas.api.IdASException
Specified by:
addMetadata in interface org.eclipse.higgins.idas.api.IHasMetadata
Throws:
org.eclipse.higgins.idas.api.IdASException

getModel

public org.eclipse.higgins.idas.api.model.IEntityModel getModel()
                                                         throws org.eclipse.higgins.idas.api.IdASException
TODO: implement this

Specified by:
getModel in interface org.eclipse.higgins.idas.api.IEntity
Throws:
org.eclipse.higgins.idas.api.IdASException

remove

public void remove()
            throws org.eclipse.higgins.idas.api.IdASException
Specified by:
remove in interface org.eclipse.higgins.idas.api.IEntity
Throws:
org.eclipse.higgins.idas.api.IdASException

addAttribute

public org.eclipse.higgins.idas.api.IAttribute addAttribute(URI type)
                                                     throws org.eclipse.higgins.idas.api.IdASException,
                                                            org.eclipse.higgins.idas.api.InvalidTypeException
Specified by:
addAttribute in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException
org.eclipse.higgins.idas.api.InvalidTypeException

addAttribute

public org.eclipse.higgins.idas.api.IAttribute addAttribute(org.eclipse.higgins.idas.api.IAttribute copyFrom)
                                                     throws org.eclipse.higgins.idas.api.IdASException
TODO there are three cases we have to deal with 1 - The attribute is a generic IAttribute created from some other iContext 2 - The attribute was returned from this Policy Context and the values are already mapped 3 - The attribute was created using addAttribute and values need to be mapped.

Specified by:
addAttribute in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
IHasAttributes.addAttribute(org.eclipse.higgins.idas.api.IAttribute)

equals

public boolean equals(org.eclipse.higgins.idas.api.IHasMetadata metadataSet)
               throws org.eclipse.higgins.idas.api.IdASException
Specified by:
equals in interface org.eclipse.higgins.idas.api.IHasMetadata
Throws:
org.eclipse.higgins.idas.api.IdASException

equals

public boolean equals(org.eclipse.higgins.idas.api.IHasAttributes attributes)
               throws org.eclipse.higgins.idas.api.IdASException
Specified by:
equals in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException

removeAttribute

public void removeAttribute(URI attrType)
                     throws org.eclipse.higgins.idas.api.IdASException
Specified by:
removeAttribute in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException

removeAttributeValue

public void removeAttributeValue(URI attrType,
                                 Object value)
                          throws org.eclipse.higgins.idas.api.IdASException
Specified by:
removeAttributeValue in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException

removeAttributeValue

public void removeAttributeValue(org.eclipse.higgins.idas.api.IAttribute attr)
                          throws org.eclipse.higgins.idas.api.IdASException
Specified by:
removeAttributeValue in interface org.eclipse.higgins.idas.api.IHasAttributes
Throws:
org.eclipse.higgins.idas.api.IdASException