***  This class provides Binary Compatibility only, not Source Compatibility  ***

com.sas.services.information.metadata.dav
Class DAVEntity

com.sas.services.information.metadata.dav.DAVEntity
All Implemented Interfaces:
AttributesInterface, DAVEntityInterface, java.io.Serializable
Direct Known Subclasses:
DAVFolder, DAVItem

public class DAVEntity
implements DAVEntityInterface, java.io.Serializable

DAVEntity is a common class for DAVFolder and DAVItem. It implements the functions that are common to both sub-classes. In addition to these functions, a DAV entity has a set of properties, manipulated through the AttributesInterface.

Since:
1.0
See Also:
Serialized Form

Field Summary
protected  java.lang.String _acl
          A serialized XML string from the ACL property on the resource
protected  java.lang.String _descAttribute
           
protected  java.lang.String _fullUrl
           
protected  java.lang.String _name
           
protected  java.lang.String _nameAttribute
           
protected  java.lang.String _objectClass
           
protected  java.util.Map _properties
           
protected  RepositoryInterface _repos
           
protected  java.lang.String _reposId
           
protected  DAVResource _resource
           
protected  java.util.Map _schemaProperties
           
protected  java.util.List aclList
          A list containing the access control entries from the ACL property on the resource.
protected  byte[] content
           
protected  boolean hasBeenFetched
           
static int LOCAL
          The variable has been set by the local client, and has not been saved in the persisten store.
static int STORE
          The value reflects the current value from the persistent store.
static int UNSET
          A variable is unset from either the persistent store or locally from the client.
 
Constructor Summary
DAVEntity(com.sas.services.information.RepositoryData entity)
          Creates a new DAVEntity from the entity (property map)
DAVEntity(RepositoryInterface repos, java.lang.String reposId)
          Creates a new DAVEntity for the entity with a repository id reposId in the repository repos
DAVEntity(java.lang.String url, java.util.Map properties)
          Creates a new DAVEntity from the url and a property map
 
Method Summary
 void addAccessControlEntry(AccessControlEntryInterface ace)
          Add an access control entry to the ACL
 void addAttribute(java.lang.String key, java.lang.Object value)
          Add an attribute with the given name and value
 void addAttributes(java.util.Map attributeMap)
          Add a number of attributes - names and values are given in the map.
protected  void addUpdateMultiple(java.lang.String attributeName, java.util.ArrayList newValue)
          Add a multivalued property update.
protected  void addUpdateSingle(java.lang.String attributeName, java.lang.String newValue)
          Add a single valued property update
 void clearLocalLists()
          Clear the set and remove update lists.
 void commitUpdates()
          Commit the pending updates to the repository (setting or removing properties)
 DAVEntityInterface copy(DAVFolderInterface folder)
          Copy the entity to another folder.
 void delete()
          Delete this entity
 void deleteAttribute(java.lang.String key)
          Delete a specific attribute
 void deleteAttributes(java.util.List attributes)
          Delete a list of attributes.
 void fetchEntity()
          Physically retrieve the entity from the repository and update the properties.
 java.util.List getAccessControlList()
           
 java.lang.String getACL()
          Get the ACL for this entity
 java.lang.String getAttribute(java.lang.String key)
          Get the value of the attribute with the given key/name.
 java.util.Map getAttributes()
          Get a list of all the attributes.
 java.lang.String getCreateDate()
          Returns the creation date, if it exists, null otherwise
 DAVResource getDAVResource()
          Return the underlying DAVResource for this entity, if it exists (that is if it has been fetched)
 java.lang.String getDescription()
          Return the entity's description property
 DAVFolderInterface getFolder()
          Get the folder that contains this entity.
 java.lang.String getGUID()
          Return the GUID for this entity, if one has been set.
 java.lang.String getModifyDate()
          Returns the last modified date, if it exists, null otherwise
 java.lang.String getName()
          Get the name of the entity.
 java.lang.String getObjectClass()
          Return the type (object class) of this entity.
 java.util.Map getProperties()
          Get properties/attributes for this entity
 java.lang.String[] getRemarksKeys()
          Get a list of entity keys for the remarks or dicussion threads relating to this object.
 java.util.Map getRemoveUpdates()
          If there are any updates to remove properties, then return this list
 java.lang.String getReposId()
          Get the repository identifier for this entity.
 RepositoryInterface getRepository()
          Get the repository associated with this entity
 java.util.Map getSetUpdates()
          If there are any updates to set property values, then return this list
 java.lang.String getType()
          Get the entity's object type.
 java.lang.String getUpdateableACL()
           
 java.lang.String getUrl()
          Get the url for this entity.
 java.lang.String getURL()
          Return the full url as represented in a repository for this entity
 boolean isCollection()
          Is this DAVEntity a collection (folder) or not?
 boolean isDeleted()
          Has this entity been deleted?
 boolean isUpdatePending()
          Are there any updates pending for this entity.
 DAVEntityInterface move(DAVFolderInterface folder)
          Move the entity to another folder.
 void refresh()
          Refresh this entity.
 void refresh(DAVEntityInterface entity)
          Refresh this entity from the parameter.
 void removeAccessControlEntry(AccessControlEntryInterface ace)
          Remove an access control entry from the ACL
 void setAccessControls(java.util.List aclList)
           
 void setACL(java.lang.String acl)
          Set the ACL for this entity
 void setAttribute(java.lang.String key, java.lang.Object value)
          Set the value of an attribute to the given value
 void setAttributes(java.util.Map attributeMap)
          Set a number of attributes - names and values are given in the map
 void setContentClass(java.lang.String contentClass)
          Set the contentClass for a paricular resource.
 void setDeleted()
          Mark the entity as having been deleted.
 void setDescription(java.lang.String desc)
          Set the entity's description property
 void setGUID(java.lang.String guid)
          Set the GUID on this entity.
 void setName(java.lang.String name)
          Set the name attribute
 void setRemarksKeys(java.lang.String[] keys)
          Set the remarks or discussion threads relating to this object
 void setReposId(java.lang.String reposId)
          Set the repository identifier for this entity.
 void setRepository(RepositoryInterface repos)
          Set the repository associated with this entity.
 java.lang.String toString()
           
 void update()
          Persist any changes to the metadata back to the backing store.
 

Field Detail

_properties

protected java.util.Map _properties

_schemaProperties

protected java.util.Map _schemaProperties

_repos

protected RepositoryInterface _repos

_resource

protected DAVResource _resource

_name

protected java.lang.String _name

_fullUrl

protected java.lang.String _fullUrl

_reposId

protected java.lang.String _reposId

content

protected byte[] content

_acl

protected java.lang.String _acl
A serialized XML string from the ACL property on the resource


aclList

protected java.util.List aclList
A list containing the access control entries from the ACL property on the resource. This format is easier to manipulate and is then converted to and from the serialized XML string when necessary


hasBeenFetched

protected boolean hasBeenFetched

UNSET

public static final int UNSET
A variable is unset from either the persistent store or locally from the client.

See Also:
Constant Field Values

LOCAL

public static final int LOCAL
The variable has been set by the local client, and has not been saved in the persisten store.

See Also:
Constant Field Values

STORE

public static final int STORE
The value reflects the current value from the persistent store.

See Also:
Constant Field Values

_nameAttribute

protected java.lang.String _nameAttribute

_descAttribute

protected java.lang.String _descAttribute

_objectClass

protected java.lang.String _objectClass
Constructor Detail

DAVEntity

public DAVEntity(java.lang.String url,
                 java.util.Map properties)
Creates a new DAVEntity from the url and a property map

Parameters:
url -
properties -

DAVEntity

public DAVEntity(com.sas.services.information.RepositoryData entity)
Creates a new DAVEntity from the entity (property map)

Parameters:
entity -

DAVEntity

public DAVEntity(RepositoryInterface repos,
                 java.lang.String reposId)
Creates a new DAVEntity for the entity with a repository id reposId in the repository repos

Parameters:
repos -
reposId -
Method Detail

delete

public void delete()
            throws ServiceException,
                   java.rmi.RemoteException
Delete this entity

Specified by:
delete in interface DAVEntityInterface
Throws:
ServiceException
java.rmi.RemoteException

copy

public DAVEntityInterface copy(DAVFolderInterface folder)
Copy the entity to another folder.

Specified by:
copy in interface DAVEntityInterface
Parameters:
folder - destination folder
Returns:
DAVEntityInterface The new DAVEntity

move

public DAVEntityInterface move(DAVFolderInterface folder)
Move the entity to another folder.

Specified by:
move in interface DAVEntityInterface
Parameters:
folder - destination folder
Returns:
DAVEntityInterface The new DAVEntity

getUrl

public java.lang.String getUrl()
Get the url for this entity.

Specified by:
getUrl in interface DAVEntityInterface
Returns:
String the full url for the entity

getFolder

public DAVFolderInterface getFolder()
Get the folder that contains this entity.

Specified by:
getFolder in interface DAVEntityInterface
Returns:
DAVFolderInterface

getName

public java.lang.String getName()
Get the name of the entity.

Specified by:
getName in interface DAVEntityInterface
Returns:
String The name of the entity

getAttribute

public java.lang.String getAttribute(java.lang.String key)
Get the value of the attribute with the given key/name.

Specified by:
getAttribute in interface AttributesInterface
Parameters:
key - The name of the attribute/property
Returns:
String The value of the attribute with the given name

getAttributes

public java.util.Map getAttributes()
Get a list of all the attributes.

Specified by:
getAttributes in interface AttributesInterface
Returns:
The map containing all the key/value name pairs

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Set the value of an attribute to the given value

Specified by:
setAttribute in interface AttributesInterface
Parameters:
key - The key/name for this attribute
value - The value of this attribute, generally a String

addAttribute

public void addAttribute(java.lang.String key,
                         java.lang.Object value)
Add an attribute with the given name and value

Specified by:
addAttribute in interface AttributesInterface
Parameters:
key - The key/name for this attribute
value - The value of this attribute, generally a String

deleteAttribute

public void deleteAttribute(java.lang.String key)
Delete a specific attribute

Specified by:
deleteAttribute in interface AttributesInterface
Parameters:
key - The name of the attribute to delete

setAttributes

public void setAttributes(java.util.Map attributeMap)
Set a number of attributes - names and values are given in the map

Specified by:
setAttributes in interface AttributesInterface
Parameters:
attributeMap - Map containing the name/value pairs to set

addAttributes

public void addAttributes(java.util.Map attributeMap)
Add a number of attributes - names and values are given in the map.

Specified by:
addAttributes in interface AttributesInterface
Parameters:
attributeMap - Map containing the name/value pairs to add

deleteAttributes

public void deleteAttributes(java.util.List attributes)
Delete a list of attributes.

Specified by:
deleteAttributes in interface AttributesInterface
Parameters:
attributes - List (of String) property names

getType

public java.lang.String getType()
Get the entity's object type.

Specified by:
getType in interface DAVEntityInterface
Returns:
String Entity's object type

setReposId

public void setReposId(java.lang.String reposId)
Set the repository identifier for this entity.

Specified by:
setReposId in interface DAVEntityInterface
Parameters:
reposId - Repository identifier for this entity

getReposId

public java.lang.String getReposId()
Get the repository identifier for this entity. If the repository has not been set, then use the fullurl as an identifier.

Specified by:
getReposId in interface DAVEntityInterface
Returns:
String Entity's repository identifier

setRepository

public void setRepository(RepositoryInterface repos)
Set the repository associated with this entity.

Parameters:
repos - The repository that holds this entity

isCollection

public boolean isCollection()
Is this DAVEntity a collection (folder) or not?

Specified by:
isCollection in interface DAVEntityInterface
Returns:
boolean true if this is a collection, false otherwise

isUpdatePending

public boolean isUpdatePending()
Are there any updates pending for this entity. Any attribute sets or removes create a pending update.

Specified by:
isUpdatePending in interface DAVEntityInterface
Returns:
boolean true is there are updates pending, false otherwise

clearLocalLists

public void clearLocalLists()
Clear the set and remove update lists. Usually called when the entity is persisted or the updates are no longer required/


refresh

public void refresh(DAVEntityInterface entity)
Refresh this entity from the parameter. Reset any pending updates as these don't apply any longer.

Specified by:
refresh in interface DAVEntityInterface
Parameters:
entity - A DAVEntity from which to obtain the latest properties

refresh

public void refresh()
Refresh this entity. This means getting a fresh copy from the repository

Specified by:
refresh in interface DAVEntityInterface

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addUpdateSingle

protected void addUpdateSingle(java.lang.String attributeName,
                               java.lang.String newValue)
Add a single valued property update

Parameters:
attributeName - Attribute to be changed
newValue - New atrribute value

addUpdateMultiple

protected void addUpdateMultiple(java.lang.String attributeName,
                                 java.util.ArrayList newValue)
Add a multivalued property update. This is not supported in DAV


commitUpdates

public void commitUpdates()
                   throws ServiceException,
                          java.rmi.RemoteException
Commit the pending updates to the repository (setting or removing properties)

Throws:
ServiceException - If a service level error occurs.
java.rmi.RemoteException - In the event of remote object failure.

update

public void update()
            throws ServiceException,
                   java.rmi.RemoteException
Persist any changes to the metadata back to the backing store. Build an update list by checking the states of the local variables. Then commit any changes to the store, and get rid of the change list.

Specified by:
update in interface DAVEntityInterface
Throws:
ServiceException - in the case of a services failure
java.rmi.RemoteException - in the case of network failures

setContentClass

public void setContentClass(java.lang.String contentClass)
Set the contentClass for a paricular resource. This will only work once (preferably at object creation time). After that, the contentClass cannot be changed.

Specified by:
setContentClass in interface DAVEntityInterface
Parameters:
contentClass - The content class to set for this entity

getRepository

public RepositoryInterface getRepository()
Get the repository associated with this entity

Specified by:
getRepository in interface DAVEntityInterface
Returns:
RepositoryInterface The repository associated with this entity

setName

public void setName(java.lang.String name)
Set the name attribute

Specified by:
setName in interface DAVEntityInterface
Parameters:
name - Value for the name attribute

getDescription

public java.lang.String getDescription()
Return the entity's description property

Specified by:
getDescription in interface DAVEntityInterface
Returns:
String The description for the entity

setDescription

public void setDescription(java.lang.String desc)
Set the entity's description property

Specified by:
setDescription in interface DAVEntityInterface
Parameters:
desc - The value for the description property of the entity

getObjectClass

public java.lang.String getObjectClass()
Return the type (object class) of this entity.

Returns:
String Object class for this entity

getURL

public java.lang.String getURL()
Return the full url as represented in a repository for this entity

Specified by:
getURL in interface DAVEntityInterface
Returns:
String The url of the entity

getProperties

public java.util.Map getProperties()
Get properties/attributes for this entity

Specified by:
getProperties in interface DAVEntityInterface
Returns:
Map (of properties to values) Entity's properties

getSetUpdates

public java.util.Map getSetUpdates()
If there are any updates to set property values, then return this list

Specified by:
getSetUpdates in interface DAVEntityInterface
Returns:
Map (of properties to property values) Properties to be set

getRemoveUpdates

public java.util.Map getRemoveUpdates()
If there are any updates to remove properties, then return this list

Specified by:
getRemoveUpdates in interface DAVEntityInterface
Returns:
Map (of properties to null) Properties to be removed

getDAVResource

public DAVResource getDAVResource()
Return the underlying DAVResource for this entity, if it exists (that is if it has been fetched)

Specified by:
getDAVResource in interface DAVEntityInterface

fetchEntity

public void fetchEntity()
Physically retrieve the entity from the repository and update the properties. The content may be fetched later when required to improve performance


getCreateDate

public java.lang.String getCreateDate()
Description copied from interface: DAVEntityInterface
Returns the creation date, if it exists, null otherwise

Specified by:
getCreateDate in interface DAVEntityInterface
Returns:
String The creation date

getModifyDate

public java.lang.String getModifyDate()
Description copied from interface: DAVEntityInterface
Returns the last modified date, if it exists, null otherwise

Specified by:
getModifyDate in interface DAVEntityInterface
Returns:
String The last modified date

getRemarksKeys

public java.lang.String[] getRemarksKeys()
Description copied from interface: DAVEntityInterface
Get a list of entity keys for the remarks or dicussion threads relating to this object.

Specified by:
getRemarksKeys in interface DAVEntityInterface
Returns:
String[] An array of entity keys

setRemarksKeys

public void setRemarksKeys(java.lang.String[] keys)
Description copied from interface: DAVEntityInterface
Set the remarks or discussion threads relating to this object

Specified by:
setRemarksKeys in interface DAVEntityInterface
Parameters:
keys - An array of entity keys for the remarks relating to this object.

setACL

public void setACL(java.lang.String acl)
Description copied from interface: DAVEntityInterface
Set the ACL for this entity

Specified by:
setACL in interface DAVEntityInterface
Parameters:
acl - An XML element string that defines the WebDAV ACL for this resource

getACL

public java.lang.String getACL()
Description copied from interface: DAVEntityInterface
Get the ACL for this entity

Specified by:
getACL in interface DAVEntityInterface
Returns:
String The ACL element that describes the WebDAV ACL for this resource

getAccessControlList

public java.util.List getAccessControlList()
Specified by:
getAccessControlList in interface DAVEntityInterface

setAccessControls

public void setAccessControls(java.util.List aclList)

getUpdateableACL

public java.lang.String getUpdateableACL()
Specified by:
getUpdateableACL in interface DAVEntityInterface

isDeleted

public boolean isDeleted()
Description copied from interface: DAVEntityInterface
Has this entity been deleted?

Specified by:
isDeleted in interface DAVEntityInterface
Returns:
boolean Whether entity has been deleted or not

setDeleted

public void setDeleted()
Description copied from interface: DAVEntityInterface
Mark the entity as having been deleted.

Specified by:
setDeleted in interface DAVEntityInterface

getGUID

public java.lang.String getGUID()
Return the GUID for this entity, if one has been set.

Specified by:
getGUID in interface DAVEntityInterface
Returns:
String The GUID for this entity

setGUID

public void setGUID(java.lang.String guid)
Set the GUID on this entity.

Specified by:
setGUID in interface DAVEntityInterface
Parameters:
guid - The GUID to be set on this entity

addAccessControlEntry

public void addAccessControlEntry(AccessControlEntryInterface ace)
Description copied from interface: DAVEntityInterface
Add an access control entry to the ACL

Specified by:
addAccessControlEntry in interface DAVEntityInterface
Parameters:
ace - Access control entry to be added to the ACL

removeAccessControlEntry

public void removeAccessControlEntry(AccessControlEntryInterface ace)
Description copied from interface: DAVEntityInterface
Remove an access control entry from the ACL

Specified by:
removeAccessControlEntry in interface DAVEntityInterface
Parameters:
ace - Access control entry to be removed from the ACL

***  This class provides Binary Compatibility only, not Source Compatibility  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.