Project Aristotle - ArisID Attribute Services

org.openliberty.arisid
Class SchemaManager

java.lang.Object
  extended by org.openliberty.arisid.SchemaManager

public class SchemaManager
extends java.lang.Object

SchemaManager is used to access and manipulate CarmlDoc schema such as Attributes, Predicates, Roles, and Policies.


Field Summary
static java.lang.String schemaElement
           
 
Constructor Summary
SchemaManager(ArisIdService svc, java.util.Collection<AttributeDef> attrDefs, java.util.Collection<PredicateDef> propDefs, java.util.Collection<RoleDef> roleDefs, java.util.Collection<IPolicy> policyDefs)
           
 
Method Summary
 void addExternalDataDef(java.net.URI carmlUri)
          Method to allow an external CARML file data definitions to be added to the current schema.
 void addPolicy(IPolicy policy)
          Adds a new WS-Policy object to the DataDefs.
 IPolicy addPolicyReference(java.net.URI policyUri)
          Adds a new WS-PolicyReference object to the DataDefs.
 void appendNode(org.w3c.dom.Node parent)
           
 AttributeDef createAttribute(java.lang.String nameId, java.net.URI dataType, java.lang.String friendlyName, java.lang.String description, java.lang.String cardinality)
          Creates an AttributeDef object (that can be retrieved by getAttribute(String) and returns the AttributeDefinition created.
 PredicateDef createPredicate(java.lang.String nameId, java.lang.String displayName, java.lang.String description)
          Creates an PredicateDef object (that can be retrieved by getPredicate(String) and returns the PredicateDef created.
 RoleDef createRole(java.lang.String nameId, java.lang.String displayName, java.lang.String description)
          Creates an RoleDef object (that can be retrieved by getRole(String) and returns the RoleDef created.
 AttributeDef getAttribute(java.lang.String nameId)
           
 java.util.Collection<AttributeDef> getAttributes()
           
 java.util.Collection<IPolicy> getPolicies()
          Returns an array of IPolicy objects representing the policies defined in the Carml/DataDef section.
 IPolicy getPolicy(java.lang.String nameId)
          Returns a IPolicy (e.g.
 PredicateDef getPredicate(java.lang.String nameId)
           
 java.util.Collection<PredicateDef> getPredicates()
           
 RoleDef getRole(java.lang.String nameId)
           
 java.util.Collection<RoleDef> getRoles()
           
 boolean isLocal(java.lang.Object schemaObject)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schemaElement

public static final java.lang.String schemaElement
See Also:
Constant Field Values
Constructor Detail

SchemaManager

public SchemaManager(ArisIdService svc,
                     java.util.Collection<AttributeDef> attrDefs,
                     java.util.Collection<PredicateDef> propDefs,
                     java.util.Collection<RoleDef> roleDefs,
                     java.util.Collection<IPolicy> policyDefs)
              throws InitializedException
Throws:
InitializedException
Method Detail

addExternalDataDef

public void addExternalDataDef(java.net.URI carmlUri)
                        throws java.io.FileNotFoundException,
                               java.lang.InstantiationException,
                               IGFException,
                               java.lang.IllegalAccessException
Method to allow an external CARML file data definitions to be added to the current schema. Note: definitions in current schema file take precedence over external definitions.

Parameters:
carmlUri - URI of a CARML document containing data definitions(schema) to be added
Throws:
java.io.FileNotFoundException
java.lang.InstantiationException
IGFException
java.lang.IllegalAccessException

addPolicy

public void addPolicy(IPolicy policy)
               throws InitializedException
Adds a new WS-Policy object to the DataDefs. These policy declarations are used in conjunction with specific attributes, predicates, or roles used in an interaction.

Policy added using this method will appear in the Carml doc DataDefs/Polcies element.

Parameters:
policy - A IPolicy object to be added.
Throws:
InitializedException

addPolicyReference

public IPolicy addPolicyReference(java.net.URI policyUri)
                           throws InitializedException
Adds a new WS-PolicyReference object to the DataDefs.

These policy declarations are used in conjunction with specific attributes, predicates, or roles used in an interaction.

Policy added using this method will appear in the Carml doc DataDefs/Polcies element.

Parameters:
policyUri - A URI to a WS-Policy.
Returns:
A PolicyRef wrapper container that holds the WS-Policy.
Throws:
InitializedException

getPolicy

public IPolicy getPolicy(java.lang.String nameId)
Returns a IPolicy (e.g. org.openliberty.arisid.policy.neethi.PolicyDef) object that holds a WS-Policy of a particular name.

Parameters:
nameId - The policy URI name to be returned (IPolicy.getName()).
Returns:
IPolicy object contains the Apache Neethi Policy java implementation of WS-Policy.

getPolicies

public java.util.Collection<IPolicy> getPolicies()
Returns an array of IPolicy objects representing the policies defined in the Carml/DataDef section.

Returns:
A Collection of IPolicy objects.

createAttribute

public AttributeDef createAttribute(java.lang.String nameId,
                                    java.net.URI dataType,
                                    java.lang.String friendlyName,
                                    java.lang.String description,
                                    java.lang.String cardinality)
                             throws InitializedException
Creates an AttributeDef object (that can be retrieved by getAttribute(String) and returns the AttributeDefinition created.

Parameters:
nameId - The unique IdName for the attribute being created
dataType - A URI for the data type that describes the base data type, formatting, etc of the attribute
friendlyName - A text name for the attribute that might be used for display purposes. (see baseAttribute.getFriendlyName()
description - A description of the attribute including any intended usage or formatting details that might not be covered by the definition asserted in the DataType URI.
cardinality - A type indicating the number of values the attribute has. Valid values are AttributeDef.CARD_MULTI, AttributeDef.CARD_SINGLE, and AttributeDef.CARD_NONE.
Returns:
The attribute definition created.
Throws:
InitializedException

getAttribute

public AttributeDef getAttribute(java.lang.String nameId)

getAttributes

public java.util.Collection<AttributeDef> getAttributes()

createPredicate

public PredicateDef createPredicate(java.lang.String nameId,
                                    java.lang.String displayName,
                                    java.lang.String description)
                             throws InitializedException
Creates an PredicateDef object (that can be retrieved by getPredicate(String) and returns the PredicateDef created.

Parameters:
nameId - The unique IdName for the predicate being created
displayName - A text name for the attribute that might be used for display purposes. (see baseAttribute.getFriendlyName()
description - A description of the attribute including any intended usage or formatting details that might not be covered by the definition asserted in the DataType URI.
Returns:
The predicate definition created.
Throws:
InitializedException

getPredicate

public PredicateDef getPredicate(java.lang.String nameId)

getPredicates

public java.util.Collection<PredicateDef> getPredicates()

createRole

public RoleDef createRole(java.lang.String nameId,
                          java.lang.String displayName,
                          java.lang.String description)
                   throws InitializedException
Creates an RoleDef object (that can be retrieved by getRole(String) and returns the RoleDef created.

Parameters:
nameId - The unique IdName for the role being created
displayName - A text name for the attribute that might be used for display purposes. (see baseAttribute.getFriendlyName()
description - A description of the attribute including any intended usage or formatting details that might not be covered by the definition asserted in the DataType URI.
Returns:
The role definition created.
Throws:
InitializedException

getRole

public RoleDef getRole(java.lang.String nameId)

getRoles

public java.util.Collection<RoleDef> getRoles()

isLocal

public boolean isLocal(java.lang.Object schemaObject)
Parameters:
schemaObject - AttributeDef, PredicateDef, RoleDef, IPolicy to be tested.
Returns:
true if the schema is part of the CARML file or false if it is imported schema from an external definition.

appendNode

public void appendNode(org.w3c.dom.Node parent)

OpenLiberty.org - Licensed under Apache APL 2.0