Class SimpleAmetysObjectFactory
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
- All Implemented Interfaces:
AmetysObjectFactory<SimpleAmetysObject>,JCRAmetysObjectFactory<SimpleAmetysObject>,Component,Configurable,LogEnabled,Serviceable
- Direct Known Subclasses:
ActivityFactory,AmetysObjectCollectionFactory,CatalogFactory,ContentBackupAmetysObjectFactory,ContentConsistencyResultFactory,DefaultAliasFactory,DefaultAmetysObjectFactory,DefaultDefinitionFactory,DefaultThemeFactory,DefaultTraversableAmetysObjectFactory,DefaultZoneItemFactory,FormEntryFactory,FormPageRuleFactory,VersionFactory
public class SimpleAmetysObjectFactory
extends AbstractLogEnabled
implements JCRAmetysObjectFactory<SimpleAmetysObject>, Configurable, Serviceable
Default implementation of an
This implementation takes its scheme and nodetype through a configuration:
JCRAmetysObjectFactory,
handling SimpleAmetysObject.This implementation takes its scheme and nodetype through a configuration:
<extension point="org.ametys.plugins.repository.AmetysObjectFactoryExtensionPoint"
id="XXXX"
class="org.ametys.plugins.repository.DefaultAmetysObjectFactory">
<scheme>your_scheme</scheme>
<nodetype>your:nodetype</nodetype>
[<nodetype>your:nodetype2</nodetype>]
[...]
</extension>
This implementation manages only one nodetype.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AmetysObjectFactoryExtensionPointprotected ServiceManagerThe AvalonServiceManagerprotected StringThe configured nodetypeprotected javax.jcr.RepositoryJCR Repositoryprotected AmetysObjectResolverThe applicationAmetysObjectResolverprotected StringThe configured scheme -
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>.protected 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(SimpleAmetysObject object) Returns the parent of the givenSimpleAmetysObject.Returns the protocol of this factory, used to construct unique ids.protected javax.jcr.NodegetWorkspaceNode(SimpleAmetysObject object) Returns the JCR node backing thisSimpleAmetysObjectin the JCR workspace.booleanReturn true if the specified id correspond to an existingAmetysObject.voidservice(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_resolver
The applicationAmetysObjectResolver -
_ametysFactoryExtensionPoint
-
_scheme
The configured scheme -
_nodetype
The configured nodetype -
_repository
JCR Repository -
_manager
The AvalonServiceManager
-
-
Constructor Details
-
SimpleAmetysObjectFactory
public SimpleAmetysObjectFactory()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
getScheme
Description copied from interface:AmetysObjectFactoryReturns the protocol of this factory, used to construct unique ids.- Specified by:
getSchemein interfaceAmetysObjectFactory<SimpleAmetysObject>- Returns:
- the protocol of this factory.
-
getNodetypes
Description copied from interface:JCRAmetysObjectFactoryReturns the nodetypes of theNodeassociated with this factory.- Specified by:
getNodetypesin interfaceJCRAmetysObjectFactory<SimpleAmetysObject>- Returns:
- the nodetypes of the
Node.
-
getAmetysObject
public SimpleAmetysObject 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<SimpleAmetysObject>- 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<SimpleAmetysObject>- Parameters:
id- the identifier.- Returns:
- the corresponding
AmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.
-
getAmetysObjectById
public SimpleAmetysObject 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<SimpleAmetysObject>- 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.
-
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<SimpleAmetysObject>- Parameters:
id- the identifier.- Returns:
- true if the specified id correspond to an existing
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 objectsession- the JCR Session to use to retrieve the Node.- Returns:
- the JCR Node associated with the given id
-
getParent
Returns the parent of the givenSimpleAmetysObject.- Parameters:
object- aSimpleAmetysObject.- Returns:
- the parent of the given
SimpleAmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.
-
getWorkspaceNode
Returns the JCR node backing thisSimpleAmetysObjectin the JCR workspace. May be overridden to deal with e.g. versionning- Parameters:
object- aSimpleAmetysObject.- Returns:
- the JCR node backing this
SimpleAmetysObject.
-