Package org.ametys.web.source
Class ServiceSourceFactory
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.source.ServiceSourceFactory
-
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
,SourceFactory
public class ServiceSourceFactory extends AbstractLogEnabled implements SourceFactory, Serviceable, Contextualizable
This factory looks for files in the current skin and fallback in the current plugin dir.<br> Use: service://path_to_file<br> Will first loon in the current template in the <i>stylesheets/services/{pluginName}</i> sub-directory => skins/{skin}/templates/{template}/stylesheets/services/{pluginName}/path_to_file<br> If not found, then it will look in the skin of the current site in the sub-directory services/{pluginName} => skins/{skin}/services/{currentPluginName}/path_to_file<br> And if the file does not exist will search in plugin:{currentPluginName}://path_to_file
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ServiceSourceFactory.ServiceSource
A wrapping source to know real locationstatic class
ServiceSourceFactory.SourceType
The enum of existing types of servicesources
-
Field Summary
Fields Modifier and Type Field Description private static Pattern
__SOURCE_PATTERN
private Context
_context
private ServiceManager
_manager
private SourceResolver
_resolver
private ServiceExtensionPoint
_sep
-
Fields inherited from interface org.apache.excalibur.source.SourceFactory
ROLE
-
-
Constructor Summary
Constructors Constructor Description ServiceSourceFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ElementDefinition
_findParameter(Service service, String parameterName, String location)
void
contextualize(Context context)
protected Map<ServiceSourceFactory.SourceType,String>
getLocations(String pluginName, String uri)
Returns the ordered list of URIs to be tested to find the service stylesheet.Source
getSource(String location, Map parameters)
void
release(Source source)
void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
__SOURCE_PATTERN
private static final Pattern __SOURCE_PATTERN
-
_resolver
private SourceResolver _resolver
-
_sep
private ServiceExtensionPoint _sep
-
_manager
private ServiceManager _manager
-
-
Constructor Detail
-
ServiceSourceFactory
public ServiceSourceFactory()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getSource
public Source getSource(String location, Map parameters) throws IOException, MalformedURLException
- Specified by:
getSource
in interfaceSourceFactory
- Throws:
IOException
MalformedURLException
-
_findParameter
private ElementDefinition _findParameter(Service service, String parameterName, String location) throws MalformedURLException
- Throws:
MalformedURLException
-
getLocations
protected Map<ServiceSourceFactory.SourceType,String> getLocations(String pluginName, String uri)
Returns the ordered list of URIs to be tested to find the service stylesheet.- Parameters:
pluginName
- the service plugin name.uri
- the service stylesheet.- Returns:
- a list of possible URIs (id is the source type associated).
-
release
public void release(Source source)
- Specified by:
release
in interfaceSourceFactory
-
-