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
Modifier and TypeFieldDescriptionprotected String
The configured nodetypeprotected javax.jcr.Repository
JCR Repositoryprotected AmetysObjectResolver
The applicationAmetysObjectResolver
protected String
The configured schemestatic final String
Nodetype for resources collectionFields inherited from interface org.ametys.core.observation.Observer
MAX_PRIORITY, MIN_PRIORITY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration configuration) getAmetysObject
(javax.jcr.Node node, String parentPath) Creates aAmetysObject
from a persistent JCR node.getAmetysObjectById
(String id, javax.jcr.Session session) Retrieves anAmetysObject
with the provided JCR Session, given its id.
Id are like<protocol>://<protocol-specific-part>
.Opening a Atom Pub Connectionprotected CMISRootResourcesCollection
Retrieves anCMISRootResourcesCollection
, given its id.Retrieves the extension point with available data types forJCRResourcesCollection
protected javax.jcr.Node
Returns the JCR Node associated with the given object id.
This implementation assumes that the id is like<scheme>://<uuid>
Returns the nodetypes of theNode
associated with this factory.getParent
(CMISRootResourcesCollection object) Returns the parent of the givenAmetysObject
.int
getPriority
(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.boolean
Return true if the specified id correspond to an existingAmetysObject
.void
void
Observes an event.void
service
(ServiceManager manager) boolean
Checks 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:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getAmetysObject
public CMISRootResourcesCollection getAmetysObject(javax.jcr.Node node, String parentPath) throws AmetysRepositoryException, javax.jcr.RepositoryException Description copied from interface:JCRAmetysObjectFactory
Creates aAmetysObject
from a persistent JCR node.- Specified by:
getAmetysObject
in interfaceJCRAmetysObjectFactory<AmetysObject>
- Parameters:
node
- the JCR node to use.parentPath
- the parent Path in the Ametys hierarchy, may benull
if 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:
getAmetysObjectById
in 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:JCRAmetysObjectFactory
Retrieves anAmetysObject
with the provided JCR Session, given its id.
Id are like<protocol>://<protocol-specific-part>
.- Specified by:
getAmetysObjectById
in 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:AmetysObjectFactory
Return true if the specified id correspond to an existingAmetysObject
. Id are like<protocol>://<protocol-specific-part>
.- Specified by:
hasAmetysObjectForId
in 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:AmetysObjectFactory
Returns the protocol of this factory, used to construct unique ids.- Specified by:
getScheme
in interfaceAmetysObjectFactory<AmetysObject>
- Returns:
- the protocol of this factory.
-
getNodetypes
Description copied from interface:JCRAmetysObjectFactory
Returns the nodetypes of theNode
associated with this factory.- Specified by:
getNodetypes
in 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
null
if connection to CMIS server failed
-
getPriority
Description copied from interface:Observer
Retrieves the priority to observe this event.
This can be used to process a supported event before others observers.- Specified by:
getPriority
in 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:Observer
Checks if the event is supported. If true, the observe(Event) method will be called. -
observe
Description copied from interface:Observer
Observes an event.- Specified by:
observe
in 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
-