Class KodexRestService<I,O>
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.AbstractService
-
- de.iip_ecosphere.platform.services.environment.AbstractRunnablesService
-
- de.iip_ecosphere.platform.services.environment.AbstractProcessService<I,java.lang.String,java.lang.String,O>
-
- de.iip_ecosphere.platform.services.environment.AbstractRestProcessService<I,O>
-
- de.iip_ecosphere.platform.security.services.kodex.KodexRestService<I,O>
-
- Type Parameters:
I- the input typeO- the output type
- All Implemented Interfaces:
de.iip_ecosphere.platform.services.environment.MonitoringService,de.iip_ecosphere.platform.services.environment.ParameterConfigurerProvider,de.iip_ecosphere.platform.services.environment.Service,de.iip_ecosphere.platform.services.environment.switching.ServiceBase
- Direct Known Subclasses:
MultiKodexRestService.ExKodexRestService
public class KodexRestService<I,O> extends de.iip_ecosphere.platform.services.environment.AbstractRestProcessService<I,O>Integration of KIPROTECT KODEX as a service.- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringbearerTokenprivate java.lang.StringdataSpecprivate static booleanDEBUGprivate java.io.Filehomeprivate java.lang.Stringhostprivate intportstatic java.lang.StringVERSIONstatic intWAITING_TIME_OTHERstatic intWAITING_TIME_WIN
-
Constructor Summary
Constructors Constructor Description KodexRestService(de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I,java.lang.String> inTrans, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<java.lang.String,O> outTrans, de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<O> callback, de.iip_ecosphere.platform.services.environment.YamlService yaml)Creates an instance of the service with the required type translators to/from JSON.KodexRestService(de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I,java.lang.String> inTrans, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<java.lang.String,O> outTrans, de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<O> callback, de.iip_ecosphere.platform.services.environment.YamlService yaml, java.lang.String dataSpec)Creates an instance of the service with the required type translators to/from JSON.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringadjustRestQuery(java.lang.String input, java.lang.String inTypeName)protected java.lang.StringadjustRestResponse(java.lang.String response)protected voidconfigure(java.lang.ProcessBuilder builder)protected java.lang.StringgetApiPath()protected java.lang.StringgetBearerToken()protected intgetWaitTimeBeforeDestroy()protected voidhandleInputStream(java.io.InputStream in)voidmigrate(java.lang.String resourceId)voidreconfigure(java.util.Map<java.lang.String,java.lang.String> values)private voidsetNetworkDefaults()Sets network settings to KODEX defaults.protected de.iip_ecosphere.platform.services.environment.ServiceStatestart()voidswitchTo(java.lang.String targetId)voidupdate(java.net.URI location)-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractRestProcessService
getConnection, getNewConnectionInstance, getNewConnectionInstanceQuiet, handleReception, process, process, setupConnectionManager, stop, toSendString, waitForConnection
-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractProcessService
addProcessSpecCmdArg, attachIngestor, attachMetricsProvider, createAndConfigureProcess, createProcess, createProcess, getCallbacks, getExecutableName, getExecutableName, getExecutablePrefix, getExecutablePrefix, getExecutableSuffix, getInputTranslator, getOsArch, getOutputTranslator, getPid, getProcessId, getProcessSpec, getServiceIn, getServiceSpec, handleErrorStream, handleOutputStream, notifyCallbacks, processQuiet, redirectIO, selectNotNull, selectNotNull, setInheritIo, waitAndDestroy, waitAndDestroy
-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractRunnablesService
register
-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractService
activate, addConfigurer, addConfigurer, addConfigurer, createInstance, createInstance, createInstance, getDescription, getId, getKind, getName, getNetMgtKeyAddress, getResourceAsStream, getState, getVersion, initializeFrom, isDeployable, isTopLevel, notifyReconfigured, passivate, reconf, reconfigure, rollbackReconfigurationOnFailure, setLibJars, setState
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
WAITING_TIME_WIN
public static final int WAITING_TIME_WIN
- See Also:
- Constant Field Values
-
WAITING_TIME_OTHER
public static final int WAITING_TIME_OTHER
- See Also:
- Constant Field Values
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
dataSpec
private java.lang.String dataSpec
-
bearerToken
private java.lang.String bearerToken
-
home
private java.io.File home
-
port
private int port
-
host
private java.lang.String host
-
-
Constructor Detail
-
KodexRestService
public KodexRestService(de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I,java.lang.String> inTrans, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<java.lang.String,O> outTrans, de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<O> callback, de.iip_ecosphere.platform.services.environment.YamlService yaml)
Creates an instance of the service with the required type translators to/from JSON. Data file is "data.yml".- Parameters:
inTrans- the input translatoroutTrans- the output translatorcallback- called when a processed item is received from the serviceyaml- the service description
-
KodexRestService
public KodexRestService(de.iip_ecosphere.platform.transport.serialization.TypeTranslator<I,java.lang.String> inTrans, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<java.lang.String,O> outTrans, de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<O> callback, de.iip_ecosphere.platform.services.environment.YamlService yaml, java.lang.String dataSpec)
Creates an instance of the service with the required type translators to/from JSON.- Parameters:
inTrans- the input translatoroutTrans- the output translatorcallback- called when a processed item is received from the serviceyaml- the service descriptiondataSpec- name of the data spec file (within the process home path) to pass to KODEX; related files such as api or actions must be there as well and referenced from the data spec file
-
-
Method Detail
-
setNetworkDefaults
private void setNetworkDefaults()
Sets network settings to KODEX defaults.
-
start
protected de.iip_ecosphere.platform.services.environment.ServiceState start() throws java.util.concurrent.ExecutionException- Overrides:
startin classde.iip_ecosphere.platform.services.environment.AbstractService- Throws:
java.util.concurrent.ExecutionException
-
configure
protected void configure(java.lang.ProcessBuilder builder)
-
getApiPath
protected java.lang.String getApiPath()
-
getBearerToken
protected java.lang.String getBearerToken()
-
adjustRestQuery
protected java.lang.String adjustRestQuery(java.lang.String input, java.lang.String inTypeName)
-
adjustRestResponse
protected java.lang.String adjustRestResponse(java.lang.String response)
-
getWaitTimeBeforeDestroy
protected int getWaitTimeBeforeDestroy()
-
migrate
public void migrate(java.lang.String resourceId) throws java.util.concurrent.ExecutionException- Throws:
java.util.concurrent.ExecutionException
-
update
public void update(java.net.URI location) throws java.util.concurrent.ExecutionException- Throws:
java.util.concurrent.ExecutionException
-
switchTo
public void switchTo(java.lang.String targetId) throws java.util.concurrent.ExecutionException- Throws:
java.util.concurrent.ExecutionException
-
reconfigure
public void reconfigure(java.util.Map<java.lang.String,java.lang.String> values) throws java.util.concurrent.ExecutionException- Specified by:
reconfigurein interfacede.iip_ecosphere.platform.services.environment.Service- Overrides:
reconfigurein classde.iip_ecosphere.platform.services.environment.AbstractService- Throws:
java.util.concurrent.ExecutionException
-
-