Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.slide.store.txjndi
Class JNDIPrincipalStore  view JNDIPrincipalStore download JNDIPrincipalStore.java

java.lang.Object
  extended byorg.apache.slide.common.AbstractServiceBase
      extended byorg.apache.slide.common.AbstractXAService
          extended byorg.apache.slide.store.txjndi.JNDIPrincipalStore
All Implemented Interfaces:
org.apache.slide.store.ContentStore, org.apache.slide.store.LockStore, org.apache.slide.store.NodeStore, org.apache.slide.store.RevisionDescriptorsStore, org.apache.slide.store.RevisionDescriptorStore, org.apache.slide.store.SecurityStore, org.apache.slide.common.Service, javax.transaction.xa.XAResource

public class JNDIPrincipalStore
extends org.apache.slide.common.AbstractXAService
implements org.apache.slide.store.ContentStore, org.apache.slide.store.LockStore, org.apache.slide.store.NodeStore, org.apache.slide.store.RevisionDescriptorStore, org.apache.slide.store.RevisionDescriptorsStore, org.apache.slide.store.SecurityStore

This is a read-only Store implementation for retrieving Slide users and roles from an LDAP server. It has been tested with Novell's eDirectory version 8.6.2. Other LDAP servers should work.

Prerequisites

To use this Store your app server must be setup to authenticate users using the LDAP server. For Tomcat 5 see this. You cannot use the SlideRealm to authenticate users because this Store does not expose a password property.

Store Parameters

Parameters used in Domain.xml when setting up the Store.

cache.refresh.checkrate
How often, in seconds, the cache refresh thread should check for Uris in the cache that need to be refreshed. The default value is "15". See Cache Refreshing for more information.
cache.refresh.rate
How frequently, in seconds, Uris that are marked for refreshing should be refreshed. This value must be less than the TimeToLive and TimeToIdle (whichever is least) parameters specified for the EHCache in order for the items to never expire. The default value is "800". See Caching and Cache Refreshing for more information.
cache.refresh.threshold
The maximum amount of time, in milliseconds, that retrieve* methods can take before the Uri they are retrieving is scheduled for refreshing. By tuning this parameter you can keep smaller, infrequently accessed Uris from perpetually remaining in the cache. This may improve cache performance. See Cache Refreshing for more information.
jndi.container
The base LDAP context you wish to search. Example: ou=Users,o=Company
jndi.attributes.rdn
The attribute used to uniquely identify the objects you're fetching. Usually uid or cn.
jndi.attributes.userprincipalname
The attribute used to provide a user/role name which is mapped into Slide instead of the path name. This attribute is optional.
jndi.search.filter
The filter string to use for the search. Example: (objectClass=inetOrgPerson). The default value is (objectClass=*). See the DirContext.search() javadoc.
jndi.search.scope
The Scope of the search. Can be one of OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE. The default value is ONELEVEL_SCOPE. See the SearchControls javadoc.
jndi.search.attributes
A comma delimited list of the attributes you want returned with your search results. Example: givenName, uid, mail. The default value is cn.
java.naming.*
Parameters for connecting to the LDAP server. See the InitialContext javadoc.

Caching

This Store makes use of EHCache. You will need ehcache.jar in order to use this Store. When initialized the default CacheManager is used to find a Cache named "org.apache.slide.store.txjndi.JNDIPrincipalStore". If there is no Cache found with this name then a Cache is created with these default values:

To override these values you will need to create a configuration file for EHCache with a cache named "org.apache.slide.store.txjndi.JNDIPrincipalStore" that has the settings you wish. See the documentation at the EHCache website for instructions.

Cache Refreshing

Because the data delivered by this Store is managed externally to Slide the data cache must be periodically expired to pick up any changes. Because creating object Nodes can take a long time for LDAP queries that return a lot of objects, larger queries need to be preemptively refreshed before a user makes a request to an expired object.

The retrieveObject() and retrieveNodeDescriptor() methods monitor the amount of time it takes them to return for each Uri. If the method takes longer than a specified amount of time (configured with the cache.refresh.threshold parameter) the Uri is marked as needing to be refreshed. Upon initialization the Store spawns a child thread that periodically checks for Uris that need to be refreshed.

TODO:

  1. I'd like to see this implemented as a ResourceManager rather than a stand-alone Store. I think it would fit into Slide's framework better that way and mean less duplicated code.
  2. I think there's still room for a full-fledged LDAP store. The way LDAP exposes a directory as a graph-of-objects-with-properties and Slide exposes a repository as a graph-of-objects-with-properties seems very similar to me ;). However, adapting the structure of most LDAP servers to the user/role structure that Slide uses would be a bit of a pain, so I don't think this kind of Store would be useful for users/roles in Slide. I have heard of people using LDAP to keep track of server inventories and things like that, though, and I think it would work well there.


Nested Class Summary
protected  class JNDIPrincipalStore.Refreshee
          Implements Comparable so that the older the object, the sooner it needs to be refreshed, and therefor the "greater" it is.
protected  class JNDIPrincipalStore.RefreshThread
           
 
Field Summary
protected  Cache cache
           
static java.lang.String CACHE_DESCRIPTOR_PREFIX
           
static java.lang.String CACHE_NAME
           
static java.lang.String CACHE_OBJECT_PREFIX
           
protected  java.lang.String container
           
protected  java.util.Hashtable ctxParameters
           
static boolean DEFAULT_CACHE_ETERNAL
           
static boolean DEFAULT_CACHE_OVERFLOW_TO_DISK
           
static long DEFAULT_CACHE_REFRESH_CHECK_RATE
           
static long DEFAULT_CACHE_REFRESH_RATE
           
static long DEFAULT_CACHE_REFRESH_THRESHOLD
           
static int DEFAULT_CACHE_SIZE
           
static long DEFAULT_CACHE_TTI
           
static long DEFAULT_CACHE_TTL
           
static java.lang.String DEFAULT_JNDI_FILTER
           
static java.lang.String DEFAULT_JNDI_SEARCH_ATTRIBUTES
           
protected  java.lang.String[] descriptorAttributes
           
protected  java.lang.String filter
           
protected  java.lang.String groupMemberSet
           
protected  boolean isConnected
           
static java.lang.String JNDI_PROPERTY_PREFIX
           
static java.lang.String LDAP_NAMESPACE
           
static java.lang.String LOG_CHANNEL
           
protected  boolean logValidationErrors
           
private  java.lang.String name
           
private  java.util.Map objectNameMap
           
static java.lang.String PARAM_CACHE_REFRESH_CHECK_RATE
           
static java.lang.String PARAM_CACHE_REFRESH_RATE
           
static java.lang.String PARAM_CACHE_REFRESH_THRESHOLD
           
static java.lang.String PARAM_JNDI_CONTAINER
           
static java.lang.String PARAM_JNDI_FILTER
           
static java.lang.String PARAM_JNDI_GROUPMEMBERSET
           
static java.lang.String PARAM_JNDI_RDN_ATTRIBUTE
           
static java.lang.String PARAM_JNDI_SEARCH_ATTRIBUTES
           
static java.lang.String PARAM_JNDI_SEARCH_SCOPE
           
static java.lang.String PARAM_JNDI_USERPRINCIPALNAME
           
static java.lang.String PARAM_LOG_VALIDATION_ERRORS
           
protected  java.lang.String principalNameAttribute
           
protected  java.lang.String rdnAttribute
           
protected  JNDIPrincipalStore.RefreshThread refresher
           
protected  java.util.TreeSet refreshList
           
protected  long refreshRate
           
protected  long refreshThreadSleepTime
           
protected  long refreshThreshold
           
protected  int searchScope
           
private  java.lang.String usersPath
           
 
Fields inherited from class org.apache.slide.common.AbstractServiceBase
namespace, scope
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
JNDIPrincipalStore()
           
 
Method Summary
protected  void addRefreshee(org.apache.slide.common.Uri uri, int refreshType)
           
 boolean cacheResults()
          Idicates whether or not the objects managed by this service should be cached.
private  void closeContext(javax.naming.directory.DirContext ctx)
          Closes a JNDI connection.
 void commit(javax.transaction.xa.Xid txId, boolean onePhase)
           
 void connect()
          Connects to the underlying data source (if any is needed).
 void createObject(org.apache.slide.common.Uri uri, org.apache.slide.structure.ObjectNode object)
          Create a new object.
 void createRevisionContent(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor, org.apache.slide.content.NodeRevisionContent revisionContent)
          Create revision content.
 void createRevisionDescriptor(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor)
          Create a new revision descriptor.
 void createRevisionDescriptors(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionDescriptors revisionDescriptors)
          Create a new revision information object.
 void disconnect()
          Disconnects from the underlying data source.
 void end(javax.transaction.xa.Xid txId, int flags)
           
 java.util.Enumeration enumerateLocks(org.apache.slide.common.Uri uri)
          Enumerate locks on an object.
 java.util.Enumeration enumeratePermissions(org.apache.slide.common.Uri uri)
          Always returns read access for all users.
 void forget(javax.transaction.xa.Xid txId)
           
protected  Cache getCache()
           
private  javax.naming.directory.DirContext getContext()
          Gets a JNDI Context using the connection parameters specified for this Store in the Domain.
protected  JNDIPrincipalStore.Refreshee getNextRefreshee()
           
protected  org.apache.slide.structure.SubjectNode getObject(org.apache.slide.common.Uri uri)
           
protected  java.lang.String getObjectNameFromUri(org.apache.slide.common.Uri uri)
           
protected  org.apache.slide.content.NodeRevisionDescriptor getRevisionDescriptor(org.apache.slide.common.Uri uri)
           
 int getTransactionTimeout()
           
 void grantPermission(org.apache.slide.common.Uri uri, org.apache.slide.security.NodePermission permission)
          Grant a new permission.
 void initialize(org.apache.slide.common.NamespaceAccessToken token)
          Initializes service.
 boolean isConnected()
          This function tells whether or not the service is connected.
 boolean isSameRM(javax.transaction.xa.XAResource rm)
           
 void killLock(org.apache.slide.common.Uri uri, org.apache.slide.lock.NodeLock lock)
          Kill a lock.
protected  java.lang.String parseLdapName(java.lang.String name)
           
 int prepare(javax.transaction.xa.Xid txId)
           
 void putLock(org.apache.slide.common.Uri uri, org.apache.slide.lock.NodeLock lock)
          Create a new lock.
 javax.transaction.xa.Xid[] recover(int flag)
           
protected  void refreshCache()
           
 void removeLock(org.apache.slide.common.Uri uri, org.apache.slide.lock.NodeLock lock)
          Unlock.
 void removeObject(org.apache.slide.common.Uri uri, org.apache.slide.structure.ObjectNode object)
          Remove an object.
protected  void removeRefreshee(JNDIPrincipalStore.Refreshee refreshee)
           
 void removeRevisionContent(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor)
          Remove revision content.
 void removeRevisionDescriptor(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionNumber revisionNumber)
          Remove a revision descriptor.
 void removeRevisionDescriptors(org.apache.slide.common.Uri uri)
          Remove revision information.
 void renewLock(org.apache.slide.common.Uri uri, org.apache.slide.lock.NodeLock lock)
          Renew a lock.
 void reset()
          Deletes service underlying data source, if possible (and meaningful).
 org.apache.slide.structure.ObjectNode retrieveObject(org.apache.slide.common.Uri uri)
          Retrive an object.
 org.apache.slide.content.NodeRevisionContent retrieveRevisionContent(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor)
          Retrieve revision content.
 org.apache.slide.content.NodeRevisionDescriptor retrieveRevisionDescriptor(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionNumber revisionNumber)
          Retrieve an individual object's revision descriptor.
 org.apache.slide.content.NodeRevisionDescriptors retrieveRevisionDescriptors(org.apache.slide.common.Uri uri)
          Retrieve the revisions informations of an object.
 void revokePermission(org.apache.slide.common.Uri uri, org.apache.slide.security.NodePermission permission)
          Revoke a permission.
 void revokePermissions(org.apache.slide.common.Uri uri)
          Revoke all the permissions on an object.
 void rollback(javax.transaction.xa.Xid txId)
           
 void setParameters(java.util.Hashtable parameters)
          Initializes the service with a set of parameters.
 boolean setTransactionTimeout(int seconds)
           
 void start(javax.transaction.xa.Xid txId, int flags)
           
 void storeObject(org.apache.slide.common.Uri uri, org.apache.slide.structure.ObjectNode object)
          Update an object.
 void storeRevisionContent(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor, org.apache.slide.content.NodeRevisionContent revisionContent)
          Modify revision content.
 void storeRevisionDescriptor(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor)
          Update a revision descriptor.
 void storeRevisionDescriptors(org.apache.slide.common.Uri uri, org.apache.slide.content.NodeRevisionDescriptors revisionDescriptors)
          Update revision information.
protected  boolean validatePathName(java.lang.String name)
          Checks a String to make sure it is a valid path element.
 
Methods inherited from class org.apache.slide.common.AbstractServiceBase
connect, connectIfNeeded, connectIfNeeded, getLogger, setNamespace, setScope
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.slide.common.Service
connect, connectIfNeeded, connectIfNeeded, getLogger, setNamespace, setScope
 

Field Detail

CACHE_NAME

public static final java.lang.String CACHE_NAME

CACHE_OBJECT_PREFIX

public static final java.lang.String CACHE_OBJECT_PREFIX
See Also:
Constant Field Values

CACHE_DESCRIPTOR_PREFIX

public static final java.lang.String CACHE_DESCRIPTOR_PREFIX
See Also:
Constant Field Values

JNDI_PROPERTY_PREFIX

public static final java.lang.String JNDI_PROPERTY_PREFIX
See Also:
Constant Field Values

PARAM_CACHE_REFRESH_CHECK_RATE

public static final java.lang.String PARAM_CACHE_REFRESH_CHECK_RATE
See Also:
Constant Field Values

PARAM_CACHE_REFRESH_RATE

public static final java.lang.String PARAM_CACHE_REFRESH_RATE
See Also:
Constant Field Values

PARAM_CACHE_REFRESH_THRESHOLD

public static final java.lang.String PARAM_CACHE_REFRESH_THRESHOLD
See Also:
Constant Field Values

PARAM_JNDI_CONTAINER

public static final java.lang.String PARAM_JNDI_CONTAINER
See Also:
Constant Field Values

PARAM_JNDI_FILTER

public static final java.lang.String PARAM_JNDI_FILTER
See Also:
Constant Field Values

PARAM_JNDI_GROUPMEMBERSET

public static final java.lang.String PARAM_JNDI_GROUPMEMBERSET
See Also:
Constant Field Values

PARAM_JNDI_RDN_ATTRIBUTE

public static final java.lang.String PARAM_JNDI_RDN_ATTRIBUTE
See Also:
Constant Field Values

PARAM_JNDI_SEARCH_ATTRIBUTES

public static final java.lang.String PARAM_JNDI_SEARCH_ATTRIBUTES
See Also:
Constant Field Values

PARAM_JNDI_SEARCH_SCOPE

public static final java.lang.String PARAM_JNDI_SEARCH_SCOPE
See Also:
Constant Field Values

PARAM_JNDI_USERPRINCIPALNAME

public static final java.lang.String PARAM_JNDI_USERPRINCIPALNAME
See Also:
Constant Field Values

PARAM_LOG_VALIDATION_ERRORS

public static final java.lang.String PARAM_LOG_VALIDATION_ERRORS
See Also:
Constant Field Values

DEFAULT_CACHE_SIZE

public static final int DEFAULT_CACHE_SIZE
See Also:
Constant Field Values

DEFAULT_CACHE_OVERFLOW_TO_DISK

public static final boolean DEFAULT_CACHE_OVERFLOW_TO_DISK
See Also:
Constant Field Values

DEFAULT_CACHE_ETERNAL

public static final boolean DEFAULT_CACHE_ETERNAL
See Also:
Constant Field Values

DEFAULT_CACHE_TTL

public static final long DEFAULT_CACHE_TTL
See Also:
Constant Field Values

DEFAULT_CACHE_TTI

public static final long DEFAULT_CACHE_TTI
See Also:
Constant Field Values

DEFAULT_CACHE_REFRESH_CHECK_RATE

public static final long DEFAULT_CACHE_REFRESH_CHECK_RATE
See Also:
Constant Field Values

DEFAULT_CACHE_REFRESH_RATE

public static final long DEFAULT_CACHE_REFRESH_RATE
See Also:
Constant Field Values

DEFAULT_CACHE_REFRESH_THRESHOLD

public static final long DEFAULT_CACHE_REFRESH_THRESHOLD
See Also:
Constant Field Values

DEFAULT_JNDI_SEARCH_ATTRIBUTES

public static final java.lang.String DEFAULT_JNDI_SEARCH_ATTRIBUTES
See Also:
Constant Field Values

DEFAULT_JNDI_FILTER

public static final java.lang.String DEFAULT_JNDI_FILTER
See Also:
Constant Field Values

LDAP_NAMESPACE

public static final java.lang.String LDAP_NAMESPACE
See Also:
Constant Field Values

LOG_CHANNEL

public static final java.lang.String LOG_CHANNEL

ctxParameters

protected java.util.Hashtable ctxParameters

isConnected

protected boolean isConnected

logValidationErrors

protected boolean logValidationErrors

cache

protected Cache cache

refreshList

protected java.util.TreeSet refreshList

refreshRate

protected long refreshRate

refreshThreadSleepTime

protected long refreshThreadSleepTime

refreshThreshold

protected long refreshThreshold

refresher

protected JNDIPrincipalStore.RefreshThread refresher

container

protected java.lang.String container

descriptorAttributes

protected java.lang.String[] descriptorAttributes

filter

protected java.lang.String filter

groupMemberSet

protected java.lang.String groupMemberSet

rdnAttribute

protected java.lang.String rdnAttribute

searchScope

protected int searchScope

principalNameAttribute

protected java.lang.String principalNameAttribute

name

private java.lang.String name

usersPath

private java.lang.String usersPath

objectNameMap

private java.util.Map objectNameMap
Constructor Detail

JNDIPrincipalStore

public JNDIPrincipalStore()
Method Detail

initialize

public void initialize(org.apache.slide.common.NamespaceAccessToken token)
                throws org.apache.slide.common.ServiceInitializationFailedException
Description copied from interface: org.apache.slide.common.Service
Initializes service.

Specified by:
initialize in interface org.apache.slide.common.Service

setParameters

public void setParameters(java.util.Hashtable parameters)
                   throws org.apache.slide.common.ServiceParameterErrorException,
                          org.apache.slide.common.ServiceParameterMissingException
Description copied from interface: org.apache.slide.common.Service
Initializes the service with a set of parameters. Those could be :
  • User name, login info
  • Host name on which to connect
  • Remote port
  • JDBC driver whoich is to be used :-)
  • Anything else ...

    Specified by:
    setParameters in interface org.apache.slide.common.Service

  • cacheResults

    public boolean cacheResults()
    Description copied from interface: org.apache.slide.common.Service
    Idicates whether or not the objects managed by this service should be cached. Useful if the service is fast enough, and / or if it already includes its own custom caching mechanism, which might be more efficient than the default one provided by the helpers.

    Specified by:
    cacheResults in interface org.apache.slide.common.Service

    storeObject

    public void storeObject(org.apache.slide.common.Uri uri,
                            org.apache.slide.structure.ObjectNode object)
                     throws org.apache.slide.common.ServiceAccessException,
                            org.apache.slide.structure.ObjectNotFoundException
    Description copied from interface: org.apache.slide.store.NodeStore
    Update an object.

    Specified by:
    storeObject in interface org.apache.slide.store.NodeStore

    createObject

    public void createObject(org.apache.slide.common.Uri uri,
                             org.apache.slide.structure.ObjectNode object)
                      throws org.apache.slide.common.ServiceAccessException,
                             org.apache.slide.structure.ObjectAlreadyExistsException
    Description copied from interface: org.apache.slide.store.NodeStore
    Create a new object.

    Specified by:
    createObject in interface org.apache.slide.store.NodeStore

    removeObject

    public void removeObject(org.apache.slide.common.Uri uri,
                             org.apache.slide.structure.ObjectNode object)
                      throws org.apache.slide.common.ServiceAccessException,
                             org.apache.slide.structure.ObjectNotFoundException
    Description copied from interface: org.apache.slide.store.NodeStore
    Remove an object.

    Specified by:
    removeObject in interface org.apache.slide.store.NodeStore

    retrieveObject

    public org.apache.slide.structure.ObjectNode retrieveObject(org.apache.slide.common.Uri uri)
                                                         throws org.apache.slide.common.ServiceAccessException,
                                                                org.apache.slide.structure.ObjectNotFoundException
    Description copied from interface: org.apache.slide.store.NodeStore
    Retrive an object.

    Specified by:
    retrieveObject in interface org.apache.slide.store.NodeStore

    createRevisionDescriptor

    public void createRevisionDescriptor(org.apache.slide.common.Uri uri,
                                         org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor)
                                  throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.RevisionDescriptorStore
    Create a new revision descriptor.

    Specified by:
    createRevisionDescriptor in interface org.apache.slide.store.RevisionDescriptorStore

    storeRevisionDescriptor

    public void storeRevisionDescriptor(org.apache.slide.common.Uri uri,
                                        org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor)
                                 throws org.apache.slide.common.ServiceAccessException,
                                        org.apache.slide.content.RevisionDescriptorNotFoundException
    Description copied from interface: org.apache.slide.store.RevisionDescriptorStore
    Update a revision descriptor.

    Specified by:
    storeRevisionDescriptor in interface org.apache.slide.store.RevisionDescriptorStore

    removeRevisionDescriptor

    public void removeRevisionDescriptor(org.apache.slide.common.Uri uri,
                                         org.apache.slide.content.NodeRevisionNumber revisionNumber)
                                  throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.RevisionDescriptorStore
    Remove a revision descriptor.

    Specified by:
    removeRevisionDescriptor in interface org.apache.slide.store.RevisionDescriptorStore

    retrieveRevisionDescriptor

    public org.apache.slide.content.NodeRevisionDescriptor retrieveRevisionDescriptor(org.apache.slide.common.Uri uri,
                                                                                      org.apache.slide.content.NodeRevisionNumber revisionNumber)
                                                                               throws org.apache.slide.common.ServiceAccessException,
                                                                                      org.apache.slide.content.RevisionDescriptorNotFoundException
    Description copied from interface: org.apache.slide.store.RevisionDescriptorStore
    Retrieve an individual object's revision descriptor.

    Specified by:
    retrieveRevisionDescriptor in interface org.apache.slide.store.RevisionDescriptorStore

    retrieveRevisionDescriptors

    public org.apache.slide.content.NodeRevisionDescriptors retrieveRevisionDescriptors(org.apache.slide.common.Uri uri)
                                                                                 throws org.apache.slide.common.ServiceAccessException,
                                                                                        org.apache.slide.content.RevisionDescriptorNotFoundException
    Description copied from interface: org.apache.slide.store.RevisionDescriptorsStore
    Retrieve the revisions informations of an object.

    Specified by:
    retrieveRevisionDescriptors in interface org.apache.slide.store.RevisionDescriptorsStore

    createRevisionDescriptors

    public void createRevisionDescriptors(org.apache.slide.common.Uri uri,
                                          org.apache.slide.content.NodeRevisionDescriptors revisionDescriptors)
                                   throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.RevisionDescriptorsStore
    Create a new revision information object.

    Specified by:
    createRevisionDescriptors in interface org.apache.slide.store.RevisionDescriptorsStore

    storeRevisionDescriptors

    public void storeRevisionDescriptors(org.apache.slide.common.Uri uri,
                                         org.apache.slide.content.NodeRevisionDescriptors revisionDescriptors)
                                  throws org.apache.slide.common.ServiceAccessException,
                                         org.apache.slide.content.RevisionDescriptorNotFoundException
    Description copied from interface: org.apache.slide.store.RevisionDescriptorsStore
    Update revision information.

    Specified by:
    storeRevisionDescriptors in interface org.apache.slide.store.RevisionDescriptorsStore

    removeRevisionDescriptors

    public void removeRevisionDescriptors(org.apache.slide.common.Uri uri)
                                   throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.RevisionDescriptorsStore
    Remove revision information.

    Specified by:
    removeRevisionDescriptors in interface org.apache.slide.store.RevisionDescriptorsStore

    connect

    public void connect()
                 throws org.apache.slide.common.ServiceConnectionFailedException
    Description copied from interface: org.apache.slide.common.Service
    Connects to the underlying data source (if any is needed).

    Specified by:
    connect in interface org.apache.slide.common.Service

    disconnect

    public void disconnect()
                    throws org.apache.slide.common.ServiceDisconnectionFailedException
    Description copied from interface: org.apache.slide.common.Service
    Disconnects from the underlying data source.

    Specified by:
    disconnect in interface org.apache.slide.common.Service

    reset

    public void reset()
               throws org.apache.slide.common.ServiceResetFailedException
    Description copied from interface: org.apache.slide.common.Service
    Deletes service underlying data source, if possible (and meaningful).

    Specified by:
    reset in interface org.apache.slide.common.Service

    isConnected

    public boolean isConnected()
                        throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.common.Service
    This function tells whether or not the service is connected.

    Specified by:
    isConnected in interface org.apache.slide.common.Service

    getTransactionTimeout

    public int getTransactionTimeout()
                              throws javax.transaction.xa.XAException
    Specified by:
    getTransactionTimeout in interface javax.transaction.xa.XAResource

    setTransactionTimeout

    public boolean setTransactionTimeout(int seconds)
                                  throws javax.transaction.xa.XAException
    Specified by:
    setTransactionTimeout in interface javax.transaction.xa.XAResource

    isSameRM

    public boolean isSameRM(javax.transaction.xa.XAResource rm)
                     throws javax.transaction.xa.XAException
    Specified by:
    isSameRM in interface javax.transaction.xa.XAResource

    recover

    public javax.transaction.xa.Xid[] recover(int flag)
                                       throws javax.transaction.xa.XAException
    Specified by:
    recover in interface javax.transaction.xa.XAResource

    prepare

    public int prepare(javax.transaction.xa.Xid txId)
                throws javax.transaction.xa.XAException
    Specified by:
    prepare in interface javax.transaction.xa.XAResource

    forget

    public void forget(javax.transaction.xa.Xid txId)
                throws javax.transaction.xa.XAException
    Specified by:
    forget in interface javax.transaction.xa.XAResource

    rollback

    public void rollback(javax.transaction.xa.Xid txId)
                  throws javax.transaction.xa.XAException
    Specified by:
    rollback in interface javax.transaction.xa.XAResource

    end

    public void end(javax.transaction.xa.Xid txId,
                    int flags)
             throws javax.transaction.xa.XAException
    Specified by:
    end in interface javax.transaction.xa.XAResource

    start

    public void start(javax.transaction.xa.Xid txId,
                      int flags)
               throws javax.transaction.xa.XAException
    Specified by:
    start in interface javax.transaction.xa.XAResource

    commit

    public void commit(javax.transaction.xa.Xid txId,
                       boolean onePhase)
                throws javax.transaction.xa.XAException
    Specified by:
    commit in interface javax.transaction.xa.XAResource

    retrieveRevisionContent

    public org.apache.slide.content.NodeRevisionContent retrieveRevisionContent(org.apache.slide.common.Uri uri,
                                                                                org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor)
                                                                         throws org.apache.slide.common.ServiceAccessException,
                                                                                org.apache.slide.content.RevisionNotFoundException
    Description copied from interface: org.apache.slide.store.ContentStore
    Retrieve revision content.

    Specified by:
    retrieveRevisionContent in interface org.apache.slide.store.ContentStore

    createRevisionContent

    public void createRevisionContent(org.apache.slide.common.Uri uri,
                                      org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor,
                                      org.apache.slide.content.NodeRevisionContent revisionContent)
                               throws org.apache.slide.common.ServiceAccessException,
                                      org.apache.slide.content.RevisionAlreadyExistException
    Description copied from interface: org.apache.slide.store.ContentStore
    Create revision content.

    Notes:

    • If a content length is specified by the revisionDescriptor (ie, revisionDescriptor.getContentLength != -1), then the ContentStore MUST enforce it, and throw a ServiceAccessException if an incorrect number of bytes are read. It MUST also revert any changes made to the underlying repository.
    • If a content length is not specified by the revisionDescriptor (ie, revisionDescriptor.getContentLength == -1), then the ContentStore MUST read all the bytes available and then call revisionDescriptor.setContentLength(numberOfBytesRead).

    Specified by:
    createRevisionContent in interface org.apache.slide.store.ContentStore

    storeRevisionContent

    public void storeRevisionContent(org.apache.slide.common.Uri uri,
                                     org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor,
                                     org.apache.slide.content.NodeRevisionContent revisionContent)
                              throws org.apache.slide.common.ServiceAccessException,
                                     org.apache.slide.content.RevisionNotFoundException
    Description copied from interface: org.apache.slide.store.ContentStore
    Modify revision content.

    Notes:

    • If a content length is specified by the revisionDescriptor (ie, revisionDescriptor.getContentLength != -1), then the ContentStore MUST enforce it, and throw a ServiceAccessException if an incorrect number of bytes are read. It MUST also revert any changes made to the unedrlying repository.
    • If a content length is not specified by the revisionDescriptor (ie, revisionDescriptor.getContentLength == -1), then the ContentStore MUST read all the bytes available and then call revisionDescriptor.setContentLength(numberOfBytesRead).

    Specified by:
    storeRevisionContent in interface org.apache.slide.store.ContentStore

    removeRevisionContent

    public void removeRevisionContent(org.apache.slide.common.Uri uri,
                                      org.apache.slide.content.NodeRevisionDescriptor revisionDescriptor)
                               throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.ContentStore
    Remove revision content.

    Specified by:
    removeRevisionContent in interface org.apache.slide.store.ContentStore

    grantPermission

    public void grantPermission(org.apache.slide.common.Uri uri,
                                org.apache.slide.security.NodePermission permission)
                         throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.SecurityStore
    Grant a new permission.

    Specified by:
    grantPermission in interface org.apache.slide.store.SecurityStore

    revokePermission

    public void revokePermission(org.apache.slide.common.Uri uri,
                                 org.apache.slide.security.NodePermission permission)
                          throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.SecurityStore
    Revoke a permission.

    Specified by:
    revokePermission in interface org.apache.slide.store.SecurityStore

    revokePermissions

    public void revokePermissions(org.apache.slide.common.Uri uri)
                           throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.SecurityStore
    Revoke all the permissions on an object.

    Specified by:
    revokePermissions in interface org.apache.slide.store.SecurityStore

    enumeratePermissions

    public java.util.Enumeration enumeratePermissions(org.apache.slide.common.Uri uri)
                                               throws org.apache.slide.common.ServiceAccessException
    Always returns read access for all users.

    Specified by:
    enumeratePermissions in interface org.apache.slide.store.SecurityStore

    putLock

    public void putLock(org.apache.slide.common.Uri uri,
                        org.apache.slide.lock.NodeLock lock)
                 throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.LockStore
    Create a new lock.

    Specified by:
    putLock in interface org.apache.slide.store.LockStore

    renewLock

    public void renewLock(org.apache.slide.common.Uri uri,
                          org.apache.slide.lock.NodeLock lock)
                   throws org.apache.slide.common.ServiceAccessException,
                          org.apache.slide.lock.LockTokenNotFoundException
    Description copied from interface: org.apache.slide.store.LockStore
    Renew a lock.

    Specified by:
    renewLock in interface org.apache.slide.store.LockStore

    removeLock

    public void removeLock(org.apache.slide.common.Uri uri,
                           org.apache.slide.lock.NodeLock lock)
                    throws org.apache.slide.common.ServiceAccessException,
                           org.apache.slide.lock.LockTokenNotFoundException
    Description copied from interface: org.apache.slide.store.LockStore
    Unlock.

    Specified by:
    removeLock in interface org.apache.slide.store.LockStore

    killLock

    public void killLock(org.apache.slide.common.Uri uri,
                         org.apache.slide.lock.NodeLock lock)
                  throws org.apache.slide.common.ServiceAccessException,
                         org.apache.slide.lock.LockTokenNotFoundException
    Description copied from interface: org.apache.slide.store.LockStore
    Kill a lock.

    Specified by:
    killLock in interface org.apache.slide.store.LockStore

    enumerateLocks

    public java.util.Enumeration enumerateLocks(org.apache.slide.common.Uri uri)
                                         throws org.apache.slide.common.ServiceAccessException
    Description copied from interface: org.apache.slide.store.LockStore
    Enumerate locks on an object.

    Specified by:
    enumerateLocks in interface org.apache.slide.store.LockStore

    getObject

    protected org.apache.slide.structure.SubjectNode getObject(org.apache.slide.common.Uri uri)
                                                        throws org.apache.slide.structure.ObjectNotFoundException,
                                                               org.apache.slide.common.ServiceAccessException

    getRevisionDescriptor

    protected org.apache.slide.content.NodeRevisionDescriptor getRevisionDescriptor(org.apache.slide.common.Uri uri)
                                                                             throws org.apache.slide.content.RevisionDescriptorNotFoundException,
                                                                                    org.apache.slide.common.ServiceAccessException

    closeContext

    private void closeContext(javax.naming.directory.DirContext ctx)
    Closes a JNDI connection.


    getContext

    priva