public class OperationServiceImpl extends Object implements AutomationService
Constructor and Description |
---|
OperationServiceImpl() |
Modifier and Type | Method and Description |
---|---|
CompiledChain |
compileChain(Class<?> inputType,
OperationChain chain)
Builds the operation chain given a context.
|
CompiledChain |
compileChain(Class<?> inputType,
OperationParameters... chain)
Same as previous but takes an array of operation parameters
|
void |
flushCompiledChains() |
<T> T |
getAdaptedValue(OperationContext ctx,
Object toAdapt,
Class<?> targetType)
Adapts an object to a target type if possible otherwise throws an
exception.
|
org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.ChainEntry |
getChainEntry(String id) |
List<OperationDocumentation> |
getDocumentation()
Generates a documentation model for all registered operations.
|
OperationType |
getOperation(String id)
Gets an operation type given its ID.
|
OperationChain |
getOperationChain(String id)
Gets a registered operation chain.
|
List<OperationChain> |
getOperationChains()
Gets a list of all registered chains
|
OperationType[] |
getOperations()
Gets all operation types that was registered.
|
TypeAdapter |
getTypeAdapter(Class<?> accept,
Class<?> produce)
Gets a type adapter for the input type accept and the output type
produce.
|
static Class<?> |
getTypeForPrimitive(Class<?> primitiveType) |
boolean |
isTypeAdaptable(Class<?> typeToAdapt,
Class<?> targetType)
Checks whether or not the given type is adaptable into the target type.
|
void |
putOperation(Class<?> type)
Registers an operation given its class.
|
void |
putOperation(Class<?> type,
boolean replace)
Registers an operation given its class.
|
void |
putOperation(Class<?> type,
boolean replace,
String contributingComponent)
Registers an operation given its class.
|
void |
putOperationChain(OperationChain chain)
Registers a parametrized operation chain.
|
void |
putOperationChain(OperationChain chain,
boolean replace)
Registers a parametrized operation chain.
|
void |
putTypeAdapter(Class<?> accept,
Class<?> produce,
TypeAdapter adapter)
Registers a new type adapter that can adapt an instance of the accepted
type into one of the produced type.
|
void |
removeOperation(Class<?> key)
Removes an operation given its class.
|
void |
removeOperationChain(String id)
Removes a registered operation chain given its ID.
|
void |
removeTypeAdapter(Class<?> accept,
Class<?> produce)
Removes a type adapter
|
Object |
run(OperationContext ctx,
OperationChain chain)
Builds and runs the operation chain given a context.
|
Object |
run(OperationContext ctx,
String chainId)
Same as previous but for managed chains identified by an ID.
|
Object |
run(OperationContext ctx,
String id,
Map<String,Object> params)
TODO avoid creating a temporary chain and then compile it.
|
public Object run(OperationContext ctx, String chainId) throws OperationException, InvalidChainException, Exception
AutomationService
run
in interface AutomationService
OperationException
InvalidChainException
Exception
public Object run(OperationContext ctx, OperationChain chain) throws OperationException, InvalidChainException, Exception
AutomationService
InvalidChainException
is thrown.run
in interface AutomationService
OperationException
InvalidChainException
Exception
public Object run(OperationContext ctx, String id, Map<String,Object> params) throws OperationException, InvalidChainException, Exception
run
in interface AutomationService
OperationException
InvalidChainException
Exception
public void putOperationChain(OperationChain chain) throws OperationException
AutomationService
run
and passing the chain ID. If a chain
having the same ID exists an exception is thrownputOperationChain
in interface AutomationService
OperationException
public void putOperationChain(OperationChain chain, boolean replace) throws OperationException
AutomationService
run
and passing the chain ID. If the
replace attribute is true then any chain already registered under the
same id will be replaced otherwise an exception is thrown.putOperationChain
in interface AutomationService
OperationException
public void removeOperationChain(String id)
AutomationService
removeOperationChain
in interface AutomationService
public OperationChain getOperationChain(String id) throws OperationNotFoundException
AutomationService
getOperationChain
in interface AutomationService
OperationNotFoundException
public List<OperationChain> getOperationChains()
AutomationService
getOperationChains
in interface AutomationService
public org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.ChainEntry getChainEntry(String id) throws OperationException
OperationException
public void flushCompiledChains()
public void putOperation(Class<?> type) throws OperationException
AutomationService
Operation
annotation. If an operation having the
same ID exists an exception will be thrown.putOperation
in interface AutomationService
OperationException
public void putOperation(Class<?> type, boolean replace) throws OperationException
AutomationService
Operation
annotation. If the
replace
argument is true then any existing operation having
the same ID will replaced with this one.putOperation
in interface AutomationService
OperationException
public void putOperation(Class<?> type, boolean replace, String contributingComponent) throws OperationException
AutomationService
Operation
annotation. If the
replace
argument is true then any existing operation having
the same ID will replaced with this one. Third argument represents the
name of the component registring the operationputOperation
in interface AutomationService
OperationException
public void removeOperation(Class<?> key)
AutomationService
removeOperation
in interface AutomationService
public OperationType[] getOperations()
AutomationService
getOperations
in interface AutomationService
public OperationType getOperation(String id) throws OperationNotFoundException
AutomationService
getOperation
in interface AutomationService
OperationNotFoundException
public CompiledChain compileChain(Class<?> inputType, OperationChain chain) throws Exception, InvalidChainException
AutomationService
InvalidChainException
is thrown.
The returned object can be used to run the chain.compileChain
in interface AutomationService
Exception
InvalidChainException
public CompiledChain compileChain(Class<?> inputType, OperationParameters... chain) throws Exception, InvalidChainException
AutomationService
compileChain
in interface AutomationService
Exception
InvalidChainException
public void putTypeAdapter(Class<?> accept, Class<?> produce, TypeAdapter adapter)
AutomationService
putTypeAdapter
in interface AutomationService
public void removeTypeAdapter(Class<?> accept, Class<?> produce)
AutomationService
removeTypeAdapter
in interface AutomationService
public TypeAdapter getTypeAdapter(Class<?> accept, Class<?> produce)
AutomationService
getTypeAdapter
in interface AutomationService
public boolean isTypeAdaptable(Class<?> typeToAdapt, Class<?> targetType)
AutomationService
This is a shortcut to
getTypeAdapter(typeToAdapt, targetType) != null
isTypeAdaptable
in interface AutomationService
public <T> T getAdaptedValue(OperationContext ctx, Object toAdapt, Class<?> targetType) throws Exception
AutomationService
getAdaptedValue
in interface AutomationService
Exception
public List<OperationDocumentation> getDocumentation()
AutomationService
getDocumentation
in interface AutomationService
Copyright © 2012 Nuxeo SA. All Rights Reserved.