@Path(value="/plugin") @Component @Produces(value="application/json") public class PluginResource extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.ligoj.bootstrap.core.dao.csv.CsvForJpa |
csvForJpa |
protected javax.persistence.EntityManager |
em |
| Constructor and Description |
|---|
PluginResource() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configurePluginEntities(org.ligoj.app.api.FeaturePlugin plugin,
List<Class<?>> csvEntities)
Insert the configuration entities of the plug-in.
|
protected void |
configurePluginEntity(Stream<URL> csv,
Class<?> entityClass,
String pluginLocation) |
protected void |
configurePluginInstall(org.ligoj.app.api.FeaturePlugin plugin)
Configure the new plug-in in this order :
The required entities for the plug-in are persisted.
|
protected void |
configurePluginUpdate(org.ligoj.app.api.FeaturePlugin plugin,
Plugin entity)
Configure the updated plug-in in this order :
The required entities for the plug-in are persisted.
|
protected PluginType |
determinePluginType(org.ligoj.app.api.ServicePlugin plugin)
Determine the plug-in type and check it regarding the contact and the convention.
|
List<PluginVo> |
findAll()
Return all plug-ins with details.
|
protected String |
getLastModifiedTime(org.ligoj.app.api.FeaturePlugin plugin)
Returns a plug-in's last modified time.
|
protected org.ligoj.app.model.Node |
getParentNode(String key)
Return the parent node from a key.
|
protected PluginsClassLoader |
getPluginClassLoader() |
protected URL |
getPluginLocation(org.ligoj.app.api.FeaturePlugin plugin) |
protected String |
getVersion(org.ligoj.app.api.FeaturePlugin plugin)
Return a fail-safe computed version of the given
FeaturePlugin |
void |
install(String artifact)
Install the last available version of given plug-in from the remote server.
|
void |
install(String artifact,
String version)
Install the specific version of given plug-in from the remote server.
|
protected org.ligoj.app.model.Node |
newNode(org.ligoj.app.api.ServicePlugin service)
Build a new
Node from the given plug-in instance using the naming convention to link the parent. |
void |
refreshPlugins(org.springframework.context.event.ContextRefreshedEvent event)
Handle the newly installed plug-ins implementing
FeaturePlugin, and that's includes
ServicePlugin. |
void |
remove(String artifact)
Remove all versions the specified plug-in.
|
@Autowired protected org.ligoj.bootstrap.core.dao.csv.CsvForJpa csvForJpa
@Autowired protected javax.persistence.EntityManager em
@GET public List<PluginVo> findAll()
@POST
@Path(value="{artifact:[\\w-]+}")
public void install(@PathParam(value="artifact")
String artifact)
artifact - The Maven artifact identifier and also corresponding to the plug-in simple name.@DELETE
@Path(value="{artifact:[\\w-]+}")
public void remove(@PathParam(value="artifact")
String artifact)
throws IOException
artifact - The Maven artifact identifier and also corresponding to the plug-in simple name.IOException@POST
@Path(value="{artifact:[\\w-]+}/{version:[\\w-]+}")
public void install(@PathParam(value="artifact")
String artifact,
@PathParam(value="version")
String version)
artifact - The Maven artifact identifier and also corresponding to the plug-in simple name.version - The vrsion to install.protected PluginsClassLoader getPluginClassLoader()
@EventListener public void refreshPlugins(org.springframework.context.event.ContextRefreshedEvent event)
FeaturePlugin, and that's includes
ServicePlugin. Note the plug-ins are installed in a natural order based on their key's name to ensure the
parents plug-ins are configured first. event - The Spring event.protected String getLastModifiedTime(org.ligoj.app.api.FeaturePlugin plugin) throws IOException, URISyntaxException
plugin - The plug-in class. Will be used to find the related container archive or class file.String representing the time the file was last modified, or a default time stamp to indicate
the time of last modification is not supported by the file systemURISyntaxException - if an I/O error occursIOException - if an I/O error occursSecurityException - In the case of the default provider, and a security manager is
installed, its checkRead
method denies read access to the file.protected void configurePluginUpdate(org.ligoj.app.api.FeaturePlugin plugin,
Plugin entity)
FeaturePlugin.getInstalledEntities() and related CSV files are load in the data base.Plugin is updated to reflect the new version.plugin - The newly discovered plug-in.protected void configurePluginInstall(org.ligoj.app.api.FeaturePlugin plugin)
FeaturePlugin.getInstalledEntities() and related CSV files are load in the data base. Note that there is
at least one Node records added and related to the plug-in key.Plugin is inserted to maintain the validated plug-in and versionplugin - The newly discovered plug-in.protected PluginType determinePluginType(org.ligoj.app.api.ServicePlugin plugin)
plugin - The plug-in resource.PluginTypeprotected void configurePluginEntities(org.ligoj.app.api.FeaturePlugin plugin,
List<Class<?>> csvEntities)
throws IOException
plugin - The related plug-ininstalledEntities - The managed entities where CSV data need to be persisted with this plug-in.IOException - When the CSV management failed.protected URL getPluginLocation(org.ligoj.app.api.FeaturePlugin plugin)
protected void configurePluginEntity(Stream<URL> csv, Class<?> entityClass, String pluginLocation) throws IOException
IOExceptionprotected org.ligoj.app.model.Node newNode(org.ligoj.app.api.ServicePlugin service)
Node from the given plug-in instance using the naming convention to link the parent.protected org.ligoj.app.model.Node getParentNode(String key)
key - The plug-in key.null when this the top most definition. Note if there is an
expected parent by convention, and the parent is not found, an error will be raised.protected String getVersion(org.ligoj.app.api.FeaturePlugin plugin)
FeaturePluginplugin - The plug-in instanceCopyright © 2017 Gfi Informatique. All rights reserved.