Package org.ametys.web.skin
Class SkinModelsManager
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.web.skin.SkinModelsManager
- All Implemented Interfaces:
Initializable
,Component
,Contextualizable
,LogEnabled
,Serviceable
,ThreadSafe
public class SkinModelsManager
extends AbstractLogEnabled
implements ThreadSafe, Serviceable, Component, Contextualizable, Initializable
Manages the models of skin
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
Cocoon contextprotected Context
Avalon contextThe models declared as external: name of the models and file locationprotected ServiceManager
The avalon service managerThe set of templates classified by skinsThe models declared in jar filesprotected SkinsManager
The sites managerprotected SourceResolver
The excalibur source resolverstatic final String
The avalon role name -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contextualize
(Context context) void
generateModelFile
(Path skinDir, String modelId) Generates the model.xml file for the skinvoid
generateModelFile
(Path skinDir, String modelId, String colorTheme) Generates the model.xml file for the skinGet the skins locationGet a modelgetModelHash
(String id) Get hash from modelgetModelOfSkin
(Skin skin) Get the id of model associated to a skinGet the list of existing modelsvoid
void
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The avalon role name -
_models
The set of templates classified by skins -
_externalSkinModels
The models declared as external: name of the models and file location -
_resourcesSkinModels
The models declared in jar files -
_manager
The avalon service manager -
_sourceResolver
The excalibur source resolver -
_skinsManager
The sites manager -
_context
Avalon context -
_cocoonContext
Cocoon context
-
-
Constructor Details
-
SkinModelsManager
public SkinModelsManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getModels
Get the list of existing models- Returns:
- A set of model names. Can be null if there is an error.
-
getModel
Get a model- Parameters:
id
- The id of the model- Returns:
- The model or null if the model does not exists
-
getModelOfSkin
Get the id of model associated to a skin- Parameters:
skin
- The skin- Returns:
- The id of the model or
null
if there is no model for this skin
-
getModelHash
Get hash from model- Parameters:
id
- The id of the model- Returns:
- unique has
-
generateModelFile
public void generateModelFile(Path skinDir, String modelId, String colorTheme) throws IOException, SAXException, TransformerConfigurationException Generates the model.xml file for the skin- Parameters:
skinDir
- The skin directorymodelId
- The model idcolorTheme
- The id of color theme. Can be null.- Throws:
IOException
- if an I/O exception occurs during generationSAXException
- if an error occurs during generationTransformerConfigurationException
- if an error occurs during generation
-
generateModelFile
public void generateModelFile(Path skinDir, String modelId) throws IOException, SAXException, TransformerConfigurationException Generates the model.xml file for the skin- Parameters:
skinDir
- The skin directorymodelId
- The model id- Throws:
IOException
- if an I/O exception occurs during generationSAXException
- if an error occurs during generationTransformerConfigurationException
- if an error occurs during generation
-
getLocalModelsLocation
Get the skins location- Returns:
- the skin location
-