public class CMISTreeFactory extends AbstractLogEnabled implements JCRAmetysObjectFactory<AmetysObject>, Configurable, Serviceable, Initializable, Observer
| Modifier and Type | Field and Description | 
|---|---|
protected String | 
_nodetype
The configured nodetype 
 | 
private ObservationManager | 
_observationManager  | 
protected Repository | 
_repository
JCR Repository 
 | 
protected AmetysObjectResolver | 
_resolver
The application  
AmetysObjectResolver | 
protected String | 
_scheme
The configured scheme 
 | 
private Map<String,Session> | 
_sessionCache  | 
static String | 
CMIS_ROOT_COLLECTION_NODETYPE
Nodetype for resources collection 
 | 
MAX_PRIORITY, MIN_PRIORITY| Constructor and Description | 
|---|
CMISTreeFactory()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
configure(Configuration configuration)  | 
CMISRootResourcesCollection | 
getAmetysObject(Node node,
               String parentPath)
Creates a  
AmetysObject from a persistent JCR node. | 
AmetysObject | 
getAmetysObjectById(String id)
 | 
AmetysObject | 
getAmetysObjectById(String id,
                   Session session)
Retrieves an  
AmetysObject with the provided JCR Session, given its id.Id are like <protocol>://<protocol-specific-part>. | 
Session | 
getAtomPubSession(CMISRootResourcesCollection root)
Opening a Atom Pub Connection 
 | 
protected CMISRootResourcesCollection | 
getCMISRootResourceCollection(String id)
Retrieves an  
CMISRootResourcesCollection, given its id. | 
protected Node | 
getNode(String id)
Returns the JCR Node associated with the given object id. 
This implementation assumes that the id is like <scheme>://<uuid> | 
Collection<String> | 
getNodetypes()
Returns the nodetypes of the  
Node associated with this factory. | 
AmetysObject | 
getParent(CMISRootResourcesCollection object)
Returns the parent of the given  
AmetysObject . | 
int | 
getPriority(Event event)
Retrieves the priority to observe this event. 
This can be used to process a supported event before others observers.  | 
String | 
getScheme()
Returns the protocol of this factory, used to construct unique ids. 
 | 
boolean | 
hasAmetysObjectForId(String id)
Return true if the specified id correspond to an existing  
AmetysObject. | 
void | 
initialize()  | 
void | 
observe(Event event,
       Map<String,Object> transientVars)
Observes an event. 
 | 
void | 
service(ServiceManager manager)  | 
boolean | 
supports(Event event)
Checks if the event is supported. 
 | 
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerpublic static final String CMIS_ROOT_COLLECTION_NODETYPE
protected AmetysObjectResolver _resolver
AmetysObjectResolverprotected Repository _repository
private ObservationManager _observationManager
private Map<String,Session> _sessionCache
public CMISTreeFactory()
public void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionpublic void configure(Configuration configuration) throws ConfigurationException
configure in interface ConfigurableConfigurationExceptionpublic void initialize() throws Exception
initialize in interface InitializableExceptionpublic CMISRootResourcesCollection getAmetysObject(Node node, String parentPath) throws AmetysRepositoryException, RepositoryException
JCRAmetysObjectFactoryAmetysObject from a persistent JCR node.getAmetysObject in interface JCRAmetysObjectFactory<AmetysObject>node - the JCR node to use.parentPath - the parent Path in the Ametys hierarchy,
        may be null if not known yet.AmetysRepositoryException - if an error occurs.RepositoryException - if a JCR error occurs.public AmetysObject getAmetysObjectById(String id) throws AmetysRepositoryException
AmetysObjectFactorygetAmetysObjectById in interface AmetysObjectFactory<AmetysObject>id - the identifier.AmetysObject.AmetysRepositoryException - if an error occurs.public AmetysObject getAmetysObjectById(String id, Session session) throws AmetysRepositoryException, RepositoryException
JCRAmetysObjectFactoryAmetysObject with the provided JCR Session, given its id.<protocol>://<protocol-specific-part>.getAmetysObjectById in interface JCRAmetysObjectFactory<AmetysObject>id - the identifier.session - the JCR Session to use to retrieve the AmetysObject.AmetysObject.AmetysRepositoryException - if an error occurs.RepositoryException - if a JCR error occurs.protected CMISRootResourcesCollection getCMISRootResourceCollection(String id) throws AmetysRepositoryException
CMISRootResourcesCollection, given its id.id - the identifier.CMISRootResourcesCollection.AmetysRepositoryException - if an error occurs.public boolean hasAmetysObjectForId(String id) throws AmetysRepositoryException
AmetysObjectFactoryAmetysObject.
 Id are like <protocol>://<protocol-specific-part>.hasAmetysObjectForId in interface AmetysObjectFactory<AmetysObject>id - the identifier.AmetysObject.AmetysRepositoryException - if an error occurs.public String getScheme()
AmetysObjectFactorygetScheme in interface AmetysObjectFactory<AmetysObject>public Collection<String> getNodetypes()
JCRAmetysObjectFactoryNode associated with this factory.getNodetypes in interface JCRAmetysObjectFactory<AmetysObject>Node.public AmetysObject getParent(CMISRootResourcesCollection object) throws AmetysRepositoryException
AmetysObject .object - a AmetysObject.AmetysObject.AmetysRepositoryException - if an error occurs.protected Node getNode(String id)
<scheme>://<uuid>id - the unique id of the objectpublic Session getAtomPubSession(CMISRootResourcesCollection root)
root - the JCR root foldernull if connection to CMIS server failedpublic int getPriority(Event event)
ObservergetPriority in interface Observerevent - the event.public boolean supports(Event event)
Observerpublic void observe(Event event, Map<String,Object> transientVars) throws Exception
Observerobserve in interface Observerevent - the event.transientVars - transientVars passed from one Observer to another when processing a single Event. 
 This may allow optimizations between observers.Exception - if an error occurs. 
 All exceptions will be logged but not propagated, as the observation mechanism should never fail.