Package org.ametys.plugins.explorer.cmis
Class CMISTreeFactory
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.explorer.cmis.CMISTreeFactory
- All Implemented Interfaces:
Observer,AmetysObjectFactory<AmetysObject>,JCRAmetysObjectFactory<AmetysObject>,LogEnabled,Initializable,Component,Configurable,Serviceable
public class CMISTreeFactory
extends AbstractLogEnabled
implements JCRAmetysObjectFactory<AmetysObject>, Configurable, Serviceable, Initializable, Observer
Create the Root of CMIS Resources Collections
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe configured nodetypeprotected javax.jcr.RepositoryJCR Repositoryprotected AmetysObjectResolverThe applicationAmetysObjectResolverprotected StringThe configured schemestatic final StringNodetype for resources collectionFields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Configuration configuration) getAmetysObject(javax.jcr.Node node, String parentPath) Creates aAmetysObjectfrom a persistent JCR node.getAmetysObjectById(String id, javax.jcr.Session session) Retrieves anAmetysObjectwith the provided JCR Session, given its id.
Id are like<protocol>://<protocol-specific-part>.Opening a Atom Pub Connectionprotected CMISRootResourcesCollectionRetrieves anCMISRootResourcesCollection, given its id.Retrieves the extension point with available data types forJCRResourcesCollectionprotected javax.jcr.NodeReturns the JCR Node associated with the given object id.
This implementation assumes that the id is like<scheme>://<uuid>Returns the nodetypes of theNodeassociated with this factory.getParent(CMISRootResourcesCollection object) Returns the parent of the givenAmetysObject.intgetPriority(Event event) Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.Returns the protocol of this factory, used to construct unique ids.booleanReturn true if the specified id correspond to an existingAmetysObject.voidvoidObserves an event.voidservice(ServiceManager manager) booleanChecks if the event is supported.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
CMIS_ROOT_COLLECTION_NODETYPE
Nodetype for resources collection- See Also:
-
_resolver
The applicationAmetysObjectResolver -
_scheme
The configured scheme -
_nodetype
The configured nodetype -
_repository
JCR Repository
-
-
Constructor Details
-
CMISTreeFactory
public CMISTreeFactory()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
initialize
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
getAmetysObject
public CMISRootResourcesCollection getAmetysObject(javax.jcr.Node node, String parentPath) throws AmetysRepositoryException, javax.jcr.RepositoryException Description copied from interface:JCRAmetysObjectFactoryCreates aAmetysObjectfrom a persistent JCR node.- Specified by:
getAmetysObjectin interfaceJCRAmetysObjectFactory<AmetysObject>- Parameters:
node- the JCR node to use.parentPath- the parent Path in the Ametys hierarchy, may benullif not known yet.- Returns:
- the object.
- Throws:
AmetysRepositoryException- if an error occurs.javax.jcr.RepositoryException- if a JCR error occurs.
-
getAmetysObjectById
Description copied from interface:AmetysObjectFactory- Specified by:
getAmetysObjectByIdin interfaceAmetysObjectFactory<AmetysObject>- Parameters:
id- the identifier.- Returns:
- the corresponding
AmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.
-
getAmetysObjectById
public AmetysObject getAmetysObjectById(String id, javax.jcr.Session session) throws AmetysRepositoryException, javax.jcr.RepositoryException Description copied from interface:JCRAmetysObjectFactoryRetrieves anAmetysObjectwith the provided JCR Session, given its id.
Id are like<protocol>://<protocol-specific-part>.- Specified by:
getAmetysObjectByIdin interfaceJCRAmetysObjectFactory<AmetysObject>- Parameters:
id- the identifier.session- the JCR Session to use to retrieve theAmetysObject.- Returns:
- the corresponding
AmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.javax.jcr.RepositoryException- if a JCR error occurs.
-
getCMISRootResourceCollection
protected CMISRootResourcesCollection getCMISRootResourceCollection(String id) throws AmetysRepositoryException Retrieves anCMISRootResourcesCollection, given its id.- Parameters:
id- the identifier.- Returns:
- the corresponding
CMISRootResourcesCollection. - Throws:
AmetysRepositoryException- if an error occurs.
-
hasAmetysObjectForId
Description copied from interface:AmetysObjectFactoryReturn true if the specified id correspond to an existingAmetysObject. Id are like<protocol>://<protocol-specific-part>.- Specified by:
hasAmetysObjectForIdin interfaceAmetysObjectFactory<AmetysObject>- Parameters:
id- the identifier.- Returns:
- true if the specified id correspond to an existing
AmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.
-
getScheme
Description copied from interface:AmetysObjectFactoryReturns the protocol of this factory, used to construct unique ids.- Specified by:
getSchemein interfaceAmetysObjectFactory<AmetysObject>- Returns:
- the protocol of this factory.
-
getNodetypes
Description copied from interface:JCRAmetysObjectFactoryReturns the nodetypes of theNodeassociated with this factory.- Specified by:
getNodetypesin interfaceJCRAmetysObjectFactory<AmetysObject>- Returns:
- the nodetypes of the
Node.
-
getParent
Returns the parent of the givenAmetysObject.- Parameters:
object- aAmetysObject.- Returns:
- the parent of the given
AmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.
-
getNode
Returns the JCR Node associated with the given object id.
This implementation assumes that the id is like<scheme>://<uuid>- Parameters:
id- the unique id of the object- Returns:
- the JCR Node associated with the given id
-
getAtomPubSession
Opening a Atom Pub Connection- Parameters:
root- the JCR root folder- Returns:
- The created session or
nullif connection to CMIS server failed
-
getPriority
Description copied from interface:ObserverRetrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriorityin interfaceObserver- Parameters:
event- the event.- Returns:
- the priority where 0 the max priority and Integer.MAX_VALUE the min priority.
-
supports
Description copied from interface:ObserverChecks if the event is supported. If true, the observe(Event) method will be called. -
observe
Description copied from interface:ObserverObserves an event.- Specified by:
observein interfaceObserver- Parameters:
event- the event.transientVars- transientVars passed from one Observer to another when processing a single Event. This may allow optimizations between observers.- Throws:
Exception- if an error occurs. All exceptions will be logged but not propagated, as the observation mechanism should never fail.
-
getDataTypesExtensionPoint
Retrieves the extension point with available data types forJCRResourcesCollection- Returns:
- the extension point with available data types for
JCRResourcesCollection
-