Class VersionsRootHelper
- java.lang.Object
-
- org.ametys.plugins.repository.migration.jcr.data.VersionsRootHelper
-
- All Implemented Interfaces:
Component
,Serviceable
public class VersionsRootHelper extends Object implements Component, Serviceable
A helper for the root versions object.
-
-
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver
_resolver
The Ametys object resolverstatic String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description VersionsRootHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VersionsAmetysObject
getRootObject()
Get or create the root object to store versions.boolean
hasKnownPlugins()
true
if the repository has registered plugins.boolean
hasRootObject()
true
if the root object to store versions is present.boolean
isAKnownPlugin(String plugin)
true
if the repository has already been launched with this plugin before.Boolean
isNewRepository()
Get true if this is the first launch of this repositoryvoid
service(ServiceManager manager)
void
setNotNewRepository()
Set the information thas this repository is not considered new anymorevoid
updateKnownPlugins()
Update the plugin names in the root versions object.
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
-
Constructor Detail
-
VersionsRootHelper
public VersionsRootHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
hasRootObject
public boolean hasRootObject() throws AmetysRepositoryException
true
if the root object to store versions is present. It's the node /ametys:versions.- Returns:
true
if the root object to store versions is present, otherwisefalse
.- Throws:
AmetysRepositoryException
- if an error occurs
-
getRootObject
public VersionsAmetysObject getRootObject() throws AmetysRepositoryException
Get or create the root object to store versions. It's the node /ametys:versions.- Returns:
- the root object to store versions
- Throws:
AmetysRepositoryException
- if an error occurs
-
hasKnownPlugins
public boolean hasKnownPlugins()
true
if the repository has registered plugins. Read the attribute /ametys:versions/@ametys:knownPlugins.- Returns:
true
if there is at least one registered plugin
-
isAKnownPlugin
public boolean isAKnownPlugin(String plugin)
true
if the repository has already been launched with this plugin before. Read the attribute /ametys:versions/@ametys:knownPlugins.- Parameters:
plugin
- the name of the plugin- Returns:
true
if the plugin is already known
-
updateKnownPlugins
public void updateKnownPlugins()
Update the plugin names in the root versions object. Write the attribute /ametys:versions/@ametys:knownPlugins. Make sure not to "forget" plugins that are not here anymore, for example if we are in safe mode, there can be less plugins and that might cause problem if some extensions have failOnOldData.
-
isNewRepository
public Boolean isNewRepository()
Get true if this is the first launch of this repository- Returns:
- true if this is the first launch of this repository
-
setNotNewRepository
public void setNotNewRepository() throws AmetysRepositoryException
Set the information thas this repository is not considered new anymore- Throws:
AmetysRepositoryException
- if an error occurs
-
-