Class VueJsResourceHandler
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.resources.DefaultResourceHandler
-
- org.ametys.plugins.core.ui.resources.AbstractCompiledResourceHandler
-
- org.ametys.plugins.core.ui.resources.vuejs.VueJsResourceHandler
-
- All Implemented Interfaces:
ResourceHandler
,LogEnabled
,Component
,Contextualizable
,Serviceable
public class VueJsResourceHandler extends AbstractCompiledResourceHandler implements Contextualizable
Resource handler to compile any VueJS resource on the fly if needed, or serve it The sources have to be located in a directory X/vuejs, while the resources will be sought at X/resources/vuejs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
VueJsResourceHandler.LocationParser
(package private) class
VueJsResourceHandler.ReadStream
-
Field Summary
Fields Modifier and Type Field Description private Context
_context
private VueJsResourceHandler.LocationParser
_lp
private ProxiedContextPathProvider
_proxiedContextPathProvider
-
Fields inherited from class org.ametys.core.resources.DefaultResourceHandler
_objectModel, _parameters, _readForDownload, _requestedLocation, _resolver, _source
-
-
Constructor Summary
Constructors Constructor Description VueJsResourceHandler(Source source)
Constructor with an already resolvedSource
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_compile(Source binarySource)
private void
_executeCommandeLine(String[] command, File directory, String successLog, String errorKeyword, String errorLog)
private long
_getLastModified(Source inputSource)
private Source
_handleSouresFiles()
private void
_installDependencies()
private boolean
_isSourceDirectory(Source inputSource)
void
contextualize(Context context)
void
generate(OutputStream out)
Generate the resource configured during setup, and output itprotected List<String>
getDependenciesList(Source inputSource)
Calculate the list of dependencies for the given source, for validity calculations.long
getLastModified()
Get the resource last modified timevoid
service(ServiceManager manager)
Source
setup(String rawLocation, Map objectModel, Parameters parameters, boolean readForDownload)
Initialize the resource handler with a resource.-
Methods inherited from class org.ametys.plugins.core.ui.resources.AbstractCompiledResourceHandler
getKey, getValidity
-
Methods inherited from class org.ametys.core.resources.DefaultResourceHandler
getLength, getMimeType
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.core.resources.ResourceHandler
shouldUseSourceContentLength
-
-
-
-
Field Detail
-
_lp
private VueJsResourceHandler.LocationParser _lp
-
_proxiedContextPathProvider
private ProxiedContextPathProvider _proxiedContextPathProvider
-
-
Constructor Detail
-
VueJsResourceHandler
public VueJsResourceHandler(Source source)
Constructor with an already resolvedSource
.- Parameters:
source
- the source
-
-
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
- Overrides:
service
in classDefaultResourceHandler
- Throws:
ServiceException
-
setup
public Source setup(String rawLocation, Map objectModel, Parameters parameters, boolean readForDownload) throws IOException, ProcessingException
Description copied from interface:ResourceHandler
Initialize the resource handler with a resource.- Specified by:
setup
in interfaceResourceHandler
- Overrides:
setup
in classDefaultResourceHandler
- Parameters:
rawLocation
- The source uriobjectModel
- The object modelparameters
- The parametersreadForDownload
- if the resource is to be downloaded and not rendered.- Returns:
- the resolved source
- Throws:
IOException
- If an error occursProcessingException
- If an error occurs
-
_handleSouresFiles
private Source _handleSouresFiles() throws MalformedURLException, IOException
- Throws:
MalformedURLException
IOException
-
_executeCommandeLine
private void _executeCommandeLine(String[] command, File directory, String successLog, String errorKeyword, String errorLog) throws IOException, ProcessingException
- Throws:
IOException
ProcessingException
-
_compile
private void _compile(Source binarySource) throws IOException, ProcessingException
- Throws:
IOException
ProcessingException
-
_installDependencies
private void _installDependencies() throws IOException, ProcessingException
- Throws:
IOException
ProcessingException
-
generate
public void generate(OutputStream out) throws IOException, ProcessingException
Description copied from interface:ResourceHandler
Generate the resource configured during setup, and output it- Specified by:
generate
in interfaceResourceHandler
- Overrides:
generate
in classDefaultResourceHandler
- Parameters:
out
- The output stream to write to- Throws:
IOException
- If an error occursProcessingException
- If an error occurs
-
getLastModified
public long getLastModified()
Description copied from interface:ResourceHandler
Get the resource last modified time- Specified by:
getLastModified
in interfaceResourceHandler
- Overrides:
getLastModified
in classDefaultResourceHandler
- Returns:
- The last modified
-
_getLastModified
private long _getLastModified(Source inputSource)
-
getDependenciesList
protected List<String> getDependenciesList(Source inputSource)
Description copied from class:AbstractCompiledResourceHandler
Calculate the list of dependencies for the given source, for validity calculations.- Specified by:
getDependenciesList
in classAbstractCompiledResourceHandler
- Parameters:
inputSource
- The source- Returns:
- The list of uri
-
_isSourceDirectory
private boolean _isSourceDirectory(Source inputSource)
-
-