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
Fields Modifier and Type Field Description protected Context_cocoonContextCocoon contextprotected Context_contextAvalon contextprotected Map<String,Path>_externalSkinModelsThe models declared as external: name of the models and file locationprotected ServiceManager_managerThe avalon service managerprotected Map<Path,SkinModel>_modelsThe set of templates classified by skinsprotected Map<String,Path>_resourcesSkinModelsThe models declared in jar filesprotected SkinsManager_skinsManagerThe sites managerprotected SourceResolver_sourceResolverThe excalibur source resolverstatic StringROLEThe avalon role name 
- 
Constructor Summary
Constructors Constructor Description SkinModelsManager() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextualize(Context context)voidgenerateModelFile(Path skinDir, String modelId)Generates the model.xml file for the skinvoidgenerateModelFile(Path skinDir, String modelId, String colorTheme)Generates the model.xml file for the skinPathgetLocalModelsLocation()Get the skins locationSkinModelgetModel(String id)Get a modelStringgetModelHash(String id)Get hash from modelStringgetModelOfSkin(Skin skin)Get the id of model associated to a skinSet<String>getModels()Get the list of existing modelsvoidinitialize()voidservice(ServiceManager manager)- 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger 
 - 
 
 - 
 
- 
- 
Field Detail
- 
_externalSkinModels
protected Map<String,Path> _externalSkinModels
The models declared as external: name of the models and file location 
- 
_resourcesSkinModels
protected Map<String,Path> _resourcesSkinModels
The models declared in jar files 
- 
_manager
protected ServiceManager _manager
The avalon service manager 
- 
_sourceResolver
protected SourceResolver _sourceResolver
The excalibur source resolver 
- 
_skinsManager
protected SkinsManager _skinsManager
The sites manager 
- 
_cocoonContext
protected Context _cocoonContext
Cocoon context 
 - 
 
- 
Constructor Detail
- 
SkinModelsManager
public SkinModelsManager()
 
 - 
 
- 
Method Detail
- 
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
 servicein interfaceServiceable- Throws:
 ServiceException
 
- 
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
 contextualizein interfaceContextualizable- Throws:
 ContextException
 
- 
initialize
public void initialize() throws Exception
- Specified by:
 initializein interfaceInitializable- Throws:
 Exception
 
- 
getModels
public Set<String> getModels()
Get the list of existing models- Returns:
 - A set of model names. Can be null if there is an error.
 
 
- 
getModel
public SkinModel getModel(String id)
Get a model- Parameters:
 id- The id of the model- Returns:
 - The model or null if the model does not exists
 
 
- 
getModelOfSkin
public String getModelOfSkin(Skin skin)
Get the id of model associated to a skin- Parameters:
 skin- The skin- Returns:
 - The id of the model or 
nullif there is no model for this skin 
 
- 
getModelHash
public String getModelHash(String id)
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
public Path getLocalModelsLocation()
Get the skins location- Returns:
 - the skin location
 
 
 - 
 
 -