org.fcrepo.server.security.xacml.util
Class RelationshipResolverImpl

java.lang.Object
  extended by org.fcrepo.server.security.xacml.util.RelationshipResolverImpl
All Implemented Interfaces:
RelationshipResolver

public class RelationshipResolverImpl
extends Object
implements RelationshipResolver

A RelationshipResolver that resolves relationships via Management.getRelationships(org.fcrepo.server.Context, String, String).

Author:
Edwin Shin

Constructor Summary
RelationshipResolverImpl()
           
RelationshipResolverImpl(Map<String,String> options)
          Constructor that takes a map of parent-child predicates (relationships).
 
Method Summary
 String buildRESTParentHierarchy(String pid)
          Generates a REST based representation of an object and its parents.
 Set<String> getAttributesFromQuery(String query, String queryLang, String variable)
          Get attributes defined by a query.
protected  PID getNormalizedPID(String pid)
          Returns a PID object for the requested String.
 Set<String> getParents(String pid)
           
 Map<String,Set<String>> getRelationships(String subject)
          Retrieves the relationships for this subject.
 Map<String,Set<String>> getRelationships(String subject, String relationship)
          Retrieves relationships for this subject, relationship and object.
protected  String getSubjectURI(String subject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationshipResolverImpl

public RelationshipResolverImpl()

RelationshipResolverImpl

public RelationshipResolverImpl(Map<String,String> options)
Constructor that takes a map of parent-child predicates (relationships). ContextHandlerImpl builds the map from the relationship-resolver section of config-melcoe-pep.xml (in WEB-INF/classes).

Parameters:
options -
Throws:
MelcoePDPException
Method Detail

buildRESTParentHierarchy

public String buildRESTParentHierarchy(String pid)
                                throws MelcoeXacmlException
Description copied from interface: RelationshipResolver
Generates a REST based representation of an object and its parents. For example, given the parameter b, and if b belongs to collection a, then we will end up with /a/b

Specified by:
buildRESTParentHierarchy in interface RelationshipResolver
Parameters:
pid - the pid whose parents we need to find
Returns:
the REST representation of the pid and its parents
Throws:
MelcoeXacmlException

getParents

public Set<String> getParents(String pid)
                       throws MelcoeXacmlException
Throws:
MelcoeXacmlException

getSubjectURI

protected String getSubjectURI(String subject)
                        throws MalformedPIDException
Throws:
MalformedPIDException

getRelationships

public Map<String,Set<String>> getRelationships(String subject)
                                         throws MelcoeXacmlException
Description copied from interface: RelationshipResolver
Retrieves the relationships for this subject. Values for each relationship are placed in a map. Return empty map if none found

Specified by:
getRelationships in interface RelationshipResolver
Parameters:
subject - the subject to return relationships for - either ns:pid, ns:pid/datastream or the info:fedora/ forms
Returns:
The map of relationships and values.
Throws:
MelcoeXacmlException

getRelationships

public Map<String,Set<String>> getRelationships(String subject,
                                                String relationship)
                                         throws MelcoeXacmlException
Description copied from interface: RelationshipResolver
Retrieves relationships for this subject, relationship and object. Return empty map if none found. Null means any.

Specified by:
getRelationships in interface RelationshipResolver
Returns:
Throws:
MelcoeXacmlException

getNormalizedPID

protected PID getNormalizedPID(String pid)
Returns a PID object for the requested String. This method will return a PID for a variety of pid permutations, e.g. demo:1, info:fedora/demo:1, demo:1/DS1, info:fedora/demo:1/sdef:foo/sdep:bar/methodBaz.

Parameters:
pid -
Returns:
a PID object

getAttributesFromQuery

public Set<String> getAttributesFromQuery(String query,
                                          String queryLang,
                                          String variable)
                                   throws MelcoeXacmlException
Description copied from interface: RelationshipResolver
Get attributes defined by a query. The values returned are defined by the variable defined in the query Only distinct values are returned.

Specified by:
getAttributesFromQuery in interface RelationshipResolver
Parameters:
query - The query to run
queryLang - Language of the query - itql, sparql, spo
variable - - the output variable to return (for spo, specify "s", "p" or "o")
Returns:
Throws:
MelcoeXacmlException


Copyright © 2012 DuraSpace. All Rights Reserved.