public class SimpleAmetysObjectFactory extends AbstractLogEnabled implements JCRAmetysObjectFactory<SimpleAmetysObject>, Configurable, Serviceable
JCRAmetysObjectFactory,
handling SimpleAmetysObject.
<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.
| Modifier and Type | Field and Description |
|---|---|
protected AmetysObjectFactoryExtensionPoint |
_ametysFactoryExtensionPoint
|
protected ServiceManager |
_manager
The Avalon
ServiceManager |
protected String |
_nodetype
The configured nodetype
|
protected Repository |
_repository
JCR Repository
|
protected AmetysObjectResolver |
_resolver
The application
AmetysObjectResolver |
protected String |
_scheme
The configured scheme
|
| Constructor and Description |
|---|
SimpleAmetysObjectFactory() |
| Modifier and Type | Method and Description |
|---|---|
(package private) AmetysObjectResolver |
_getResolver() |
void |
configure(Configuration configuration) |
SimpleAmetysObject |
getAmetysObject(Node node,
String parentPath)
Creates a
AmetysObject from a persistent JCR node. |
SimpleAmetysObject |
getAmetysObjectById(String id)
|
SimpleAmetysObject |
getAmetysObjectById(String id,
Session session)
Retrieves an
AmetysObject with the provided JCR Session, given its id.Id are like <protocol>://<protocol-specific-part>. |
protected Node |
getNode(String id,
Session session)
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(SimpleAmetysObject object)
Returns the parent of the given
SimpleAmetysObject . |
String |
getScheme()
Returns the protocol of this factory, used to construct unique ids.
|
protected Node |
getWorkspaceNode(SimpleAmetysObject object)
Returns the JCR node backing this
SimpleAmetysObject in the JCR workspace. |
boolean |
hasAmetysObjectForId(String id)
Return true if the specified id correspond to an existing
AmetysObject. |
void |
service(ServiceManager manager) |
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerprotected AmetysObjectResolver _resolver
AmetysObjectResolverprotected AmetysObjectFactoryExtensionPoint _ametysFactoryExtensionPoint
protected Repository _repository
protected ServiceManager _manager
ServiceManagerpublic SimpleAmetysObjectFactory()
public void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionpublic void configure(Configuration configuration) throws ConfigurationException
configure in interface ConfigurableConfigurationExceptionAmetysObjectResolver _getResolver()
public String getScheme()
AmetysObjectFactorygetScheme in interface AmetysObjectFactory<SimpleAmetysObject>public Collection<String> getNodetypes()
JCRAmetysObjectFactoryNode associated with this factory.getNodetypes in interface JCRAmetysObjectFactory<SimpleAmetysObject>Node.public SimpleAmetysObject getAmetysObject(Node node, String parentPath) throws AmetysRepositoryException, RepositoryException
JCRAmetysObjectFactoryAmetysObject from a persistent JCR node.getAmetysObject in interface JCRAmetysObjectFactory<SimpleAmetysObject>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 SimpleAmetysObject getAmetysObjectById(String id) throws AmetysRepositoryException
AmetysObjectFactorygetAmetysObjectById in interface AmetysObjectFactory<SimpleAmetysObject>id - the identifier.AmetysObject.AmetysRepositoryException - if an error occurs.public SimpleAmetysObject 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<SimpleAmetysObject>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.public boolean hasAmetysObjectForId(String id) throws AmetysRepositoryException
AmetysObjectFactoryAmetysObject.
Id are like <protocol>://<protocol-specific-part>.hasAmetysObjectForId in interface AmetysObjectFactory<SimpleAmetysObject>id - the identifier.AmetysObject.AmetysRepositoryException - if an error occurs.protected Node getNode(String id, Session session)
<scheme>://<uuid>id - the unique id of the objectsession - the JCR Session to use to retrieve the Node.public AmetysObject getParent(SimpleAmetysObject object) throws AmetysRepositoryException
SimpleAmetysObject .object - a SimpleAmetysObject.SimpleAmetysObject.AmetysRepositoryException - if an error occurs.protected Node getWorkspaceNode(SimpleAmetysObject object)
SimpleAmetysObject in the JCR workspace. May be overridden to deal with e.g. versionningobject - a SimpleAmetysObject.SimpleAmetysObject.