org.sakaiproject.component.legacy.entity
Class ReferenceComponent

java.lang.Object
  extended byorg.sakaiproject.component.legacy.entity.ReferenceComponent
All Implemented Interfaces:
Reference

public class ReferenceComponent
extends Object
implements Reference

Implementation of the Reference API

Note: a Reference is immutable.

Version:
$Revision: 3596 $
Author:
Sakai Software Development Team

Field Summary
static String GRADEBOOK_ROOT
          These are some more services known.
static String GRADTOOLS_ROOT
           
protected  String m_container
          The reference containment ids.
protected  String m_context
          Another container, the context id.
protected  String m_id
          The reference primary id.
protected static org.apache.commons.logging.Log M_log
          Our logger.
protected  String m_reference
          The reference string.
protected  EntityProducer m_service
          The service owning the entity.
protected  boolean m_setAlready
          Set to true once the values are set.
protected  String m_subType
          The reference sub-type.
protected  String m_type
          The reference type (a service name string).
 
Constructor Summary
ReferenceComponent(Reference copyMe)
          Construct with a Reference.
ReferenceComponent(String ref)
          Construct with a reference string.
 
Method Summary
 void addSiteContextAuthzGroup(Collection rv)
          Add the AuthzGroup(s) for context as a site.
 void addUserAuthzGroup(Collection rv, String id)
          Add the AuthzGroup for this user id, or for the user's type template, or for the general template.
 void addUserTemplateAuthzGroup(Collection rv, String id)
          Add the AuthzGroup for this user id, or for the user's type template, or for the general template.
 String getContainer()
          Access a single container id, the from most general (or only)
 String getContext()
          Access the context id, if any.
 String getDescription()
           
 Entity getEntity()
          Find the Entity that is referenced.
 EntityProducer getEntityProducer()
          Access the entity producer responsible for the referenced entity.
 String getId()
          Access the primary id.
 ResourceProperties getProperties()
          Find the ResourceProperties object for this reference.
 Collection getRealms()
          Compute the set of AuthzGroup ids associated with this referenced resource.
 String getReference()
          Access the reference.
 String getSubType()
          Access the subType.
 String getType()
          Access the type, a service id string.
 String getUrl()
          Access the URL which can be used to access the referenced resource.
 boolean isKnownType()
          Check if the reference's type is known
protected  void parse()
           
 boolean set(String type, String subType, String id, String container, String context)
          Accept the settings for a reference - may be rejected if already set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M_log

protected static org.apache.commons.logging.Log M_log
Our logger.


m_reference

protected String m_reference
The reference string.


m_type

protected String m_type
The reference type (a service name string).


m_subType

protected String m_subType
The reference sub-type.


m_id

protected String m_id
The reference primary id.


m_container

protected String m_container
The reference containment ids.


m_context

protected String m_context
Another container, the context id.


m_setAlready

protected boolean m_setAlready
Set to true once the values are set.


m_service

protected EntityProducer m_service
The service owning the entity.


GRADEBOOK_ROOT

public static final String GRADEBOOK_ROOT
These are some more services known.

See Also:
Constant Field Values

GRADTOOLS_ROOT

public static final String GRADTOOLS_ROOT
See Also:
Constant Field Values
Constructor Detail

ReferenceComponent

public ReferenceComponent(String ref)
Construct with a reference string.

Parameters:
ref - The resource reference.

ReferenceComponent

public ReferenceComponent(Reference copyMe)
Construct with a Reference.

Method Detail

getReference

public String getReference()
Access the reference.

Specified by:
getReference in interface Reference
Returns:
The reference.

getType

public String getType()
Access the type, a service id string.

Specified by:
getType in interface Reference
Returns:
The type, a service id string.

isKnownType

public boolean isKnownType()
Check if the reference's type is known

Specified by:
isKnownType in interface Reference
Returns:
true if known, false if not.

getSubType

public String getSubType()
Access the subType.

Specified by:
getSubType in interface Reference
Returns:
The subType.

getId

public String getId()
Access the primary id.

Specified by:
getId in interface Reference
Returns:
The primary id.

getContainer

public String getContainer()
Access a single container id, the from most general (or only)

Specified by:
getContainer in interface Reference
Returns:
The single or most general container, if any.

getContext

public String getContext()
Access the context id, if any.

Specified by:
getContext in interface Reference
Returns:
the context id, if any.

getProperties

public ResourceProperties getProperties()
Find the ResourceProperties object for this reference.

Specified by:
getProperties in interface Reference
Returns:
A ResourcesProperties object found (or constructed) for this reference.

getEntity

public Entity getEntity()
Find the Entity that is referenced.

Specified by:
getEntity in interface Reference
Returns:
The Entity object that this references.

getUrl

public String getUrl()
Access the URL which can be used to access the referenced resource.

Specified by:
getUrl in interface Reference
Returns:
The URL which can be used to access the referenced resource.

getDescription

public String getDescription()
Specified by:
getDescription in interface Reference
Returns:
a description of the resource referenced.

getRealms

public Collection getRealms()
Compute the set of AuthzGroup ids associated with this referenced resource.

Specified by:
getRealms in interface Reference
Returns:
List of AuthzGroup ids (String) associated with this referenced resource.

addSiteContextAuthzGroup

public void addSiteContextAuthzGroup(Collection rv)
Add the AuthzGroup(s) for context as a site.

Specified by:
addSiteContextAuthzGroup in interface Reference
Parameters:
rv - The list.

addUserAuthzGroup

public void addUserAuthzGroup(Collection rv,
                              String id)
Add the AuthzGroup for this user id, or for the user's type template, or for the general template.

Specified by:
addUserAuthzGroup in interface Reference
Parameters:
rv - The list.
id - The user id.

addUserTemplateAuthzGroup

public void addUserTemplateAuthzGroup(Collection rv,
                                      String id)
Add the AuthzGroup for this user id, or for the user's type template, or for the general template.

Specified by:
addUserTemplateAuthzGroup in interface Reference
Parameters:
rv - The list.
id - The user id.

set

public boolean set(String type,
                   String subType,
                   String id,
                   String container,
                   String context)
Accept the settings for a reference - may be rejected if already set

Specified by:
set in interface Reference
Parameters:
type -
subType -
id -
container -
context -
Returns:
true if settings are accepted, false if not.

getEntityProducer

public EntityProducer getEntityProducer()
Description copied from interface: Reference
Access the entity producer responsible for the referenced entity.

Specified by:
getEntityProducer in interface Reference
Returns:
The EntityProducer responsible for the referenced entity, or null if there is none.

parse

protected void parse()