@ManagedResource(objectName="Taverna:group=Server-3.1.0,name=Webapp", description="The main Taverna Server 3.1.0 web-application interface.") public class TavernaServerSupport extends Object
Constructor and Description |
---|
TavernaServerSupport() |
Modifier and Type | Method and Description |
---|---|
String |
buildWorkflow(Workflow workflow)
Manufacture a workflow run instance.
|
void |
copyDataToFile(DataHandler handler,
File file) |
void |
copyDataToFile(URI uri,
File file) |
void |
copyStreamToFile(InputStream stream,
File file) |
boolean |
getAllowNewWorkflowRuns() |
boolean |
getAllowStartWorkflowRuns() |
List<Capability> |
getCapabilities() |
Map<String,String> |
getContentTypeMap() |
int |
getCurrentRunCount() |
String |
getEstimatedContentType(File f)
Given a file, produce a guess at its content type.
|
Input |
getInput(TavernaRun run,
String portName)
Get a particular input to a workflow run.
|
int |
getInvocationCount() |
Listener |
getListener(String runName,
String listenerName)
Get a listener attached to a run.
|
Listener |
getListener(TavernaRun run,
String listenerName)
Obtain a listener that is already attached to a workflow run.
|
List<String> |
getListenerTypes() |
boolean |
getLogIncomingWorkflows() |
boolean |
getLogOutgoingExceptions() |
FileConcatenation |
getLogs(TavernaRun run) |
int |
getMaxSimultaneousRuns() |
Permission |
getPermission(TavernaSecurityContext context,
String userName)
Get the permission description for the given user.
|
Map<String,Permission> |
getPermissionMap(TavernaSecurityContext context) |
URI[] |
getPermittedWorkflowURIs() |
UsernamePrincipal |
getPrincipal()
Gets the identity of the user currently accessing the webapp, which is
stored in a thread-safe way in the webapp's container's context.
|
ProfileList |
getProfileDescriptor(Workflow workflow)
Build a description of the profiles supported by a workflow.
|
String |
getProperty(String runName,
String listenerName,
String propertyName)
Obtain a property from a listener that is already attached to a workflow
run.
|
String |
getProperty(TavernaRun run,
String listenerName,
String propertyName)
Obtain a property from a listener that is already attached to a workflow
run.
|
FileConcatenation |
getProv(TavernaRun run) |
TavernaRun |
getRun(String name)
Obtain the workflow run with a particular name.
|
String |
getServerVersion() |
Workflow |
getWorkflowDocumentFromURI(URI uri) |
Listener |
makeListener(TavernaRun run,
String type,
String configuration)
Construct a listener attached to the given run.
|
void |
permitDestroy(TavernaRun run)
Test whether the current user can destroy or control the lifespan of the
given run.
|
void |
permitUpdate(TavernaRun run)
Test whether the current user can do updates to the given run.
|
void |
setAllowNewWorkflowRuns(boolean allowNewWorkflowRuns) |
void |
setCapabilitySource(CapabilityLister capabilitySource) |
void |
setContentTypeMap(Map<String,String> contentTypeMap)
Mapping from filename suffixes (e.g., "baclava") to content types.
|
void |
setFileUtils(FilenameUtils fileUtils) |
void |
setIdMapper(LocalIdentityMapper mapper) |
void |
setInvocationCounter(InvocationCounter counter) |
void |
setListenerFactory(ListenerFactory listenerFactory) |
void |
setLogGetPrincipalFailures(boolean logthem) |
void |
setLogIncomingWorkflows(boolean logIncomingWorkflows) |
void |
setLogOutgoingExceptions(boolean logOutgoing) |
void |
setPermission(TavernaSecurityContext context,
String userName,
Permission permission)
Set the permissions for the given user.
|
void |
setPermittedWorkflowURIs(URI[] pw) |
void |
setPolicy(Policy policy) |
void |
setRunFactory(RunFactory runFactory) |
void |
setRunStore(RunStore runStore) |
void |
setStateModel(ManagementModel stateModel) |
void |
setWebapp(TavernaServerBean webapp) |
void |
unregisterRun(String runName,
TavernaRun run)
Stops a run from being possible to be looked up and destroys it.
|
Date |
updateExpiry(TavernaRun run,
Date date)
Changes the expiry date of a workflow run.
|
@ManagedMetric(description="Count of the number of external calls into this webapp.", metricType=COUNTER, category="throughput") public int getInvocationCount()
@ManagedMetric(description="Current number of runs.", metricType=GAUGE, category="utilization") public int getCurrentRunCount()
@ManagedAttribute(description="Whether to write submitted workflows to the log.") public boolean getLogIncomingWorkflows()
@ManagedAttribute(description="Whether to write submitted workflows to the log.") public void setLogIncomingWorkflows(boolean logIncomingWorkflows)
logIncomingWorkflows
- Whether to write submitted workflows to the log.@ManagedAttribute(description="Whether outgoing exceptions should be logged before being converted to responses.") public boolean getLogOutgoingExceptions()
@ManagedAttribute(description="Whether outgoing exceptions should be logged before being converted to responses.") public void setLogOutgoingExceptions(boolean logOutgoing)
logOutgoing
- Whether outgoing exceptions should be logged before being
converted to responses.@ManagedAttribute(description="Whether to permit any new workflow runs to be created; has no effect on existing runs.") public boolean getAllowNewWorkflowRuns()
@ManagedAttribute(description="Whether to permit any new workflow runs to be created; has no effect on existing runs.") public void setAllowNewWorkflowRuns(boolean allowNewWorkflowRuns)
allowNewWorkflowRuns
- Whether to permit any new workflow runs to be created.@ManagedAttribute(description="The installed version of the server.") public String getServerVersion()
@ManagedAttribute(description="The URIs of the workfows that this server will allow to be instantiated.") public URI[] getPermittedWorkflowURIs()
@ManagedAttribute(description="The URIs of the workfows that this server will allow to be instantiated.") public void setPermittedWorkflowURIs(URI[] pw)
public int getMaxSimultaneousRuns()
public Workflow getWorkflowDocumentFromURI(URI uri) throws javax.ws.rs.WebApplicationException, IOException
javax.ws.rs.WebApplicationException
IOException
public void setPolicy(Policy policy)
policy
- The policy being installed by Spring.public void setListenerFactory(ListenerFactory listenerFactory)
listenerFactory
- The listener factory being installed by Spring.public void setRunFactory(RunFactory runFactory)
runFactory
- The run factory being installed by Spring.public void setRunStore(RunStore runStore)
runStore
- The run store being installed by Spring.public void setStateModel(ManagementModel stateModel)
stateModel
- The state model engine being installed by Spring.public void setIdMapper(LocalIdentityMapper mapper)
mapper
- The identity mapper being installed by Spring.public void setInvocationCounter(InvocationCounter counter)
counter
- The object whose job it is to manage the counting of
invocations. Installed by Spring.public void setWebapp(TavernaServerBean webapp)
webapp
- The web-app being installed by Spring.public void setFileUtils(FilenameUtils fileUtils)
fileUtils
- The file handling utilities.public void setLogGetPrincipalFailures(boolean logthem)
logthem
- Whether to log failures relating to principals.public void setContentTypeMap(Map<String,String> contentTypeMap)
contentTypeMap
- The mapping to install.public void setCapabilitySource(CapabilityLister capabilitySource)
public void permitUpdate(@Nonnull TavernaRun run) throws NoUpdateException
run
- The workflow run to do the test on.NoUpdateException
- If the current user is not permitted to update the run.public void permitDestroy(TavernaRun run) throws NoDestroyException
run
- The workflow run to do the test on.NoDestroyException
- If the current user is not permitted to destroy the run.@Nonnull public UsernamePrincipal getPrincipal()
@Nonnull public TavernaRun getRun(@Nonnull String name) throws UnknownRunException
name
- The name of the run to look up.UnknownRunException
- If the workflow run doesn't exist or the current user doesn't
have permission to see it.@Nonnull public Listener makeListener(@Nonnull TavernaRun run, @Nonnull String type, @Nonnull String configuration) throws NoListenerException, NoUpdateException
run
- The workflow run to attach the listener to.type
- The name of the type of run to create.configuration
- The configuration description to pass into the listener. The
format of this string is up to the listener to define.NoListenerException
- If the listener type is unrecognized or the configuration is
invalid.NoUpdateException
- If the run does not permit the current user to add listeners
(or perform other types of update).@Nonnull public Listener getListener(TavernaRun run, String listenerName) throws NoListenerException
run
- The workflow run to search.listenerName
- The name of the listener to look up.NoListenerException
- If no listener with that name exists.@Nonnull public String getProperty(String runName, String listenerName, String propertyName) throws NoListenerException, UnknownRunException
runName
- The ID of the workflow run to search.listenerName
- The name of the listener to look up in.propertyName
- The name of the property to fetch.NoListenerException
- If no listener with that name exists, or no property with
that name exists.UnknownRunException
- If no run with that name exists.@Nonnull public String getProperty(TavernaRun run, String listenerName, String propertyName) throws NoListenerException
run
- The workflow run to search.listenerName
- The name of the listener to look up in.propertyName
- The name of the property to fetch.NoListenerException
- If no listener with that name exists, or no property with
that name exists.@Nonnull public Permission getPermission(@Nonnull TavernaSecurityContext context, @Nonnull String userName)
context
- A security context associated with a particular workflow run.
Note that only the owner of a workflow run may get the
security context in the first place.userName
- The name of the user to look up the permission for.public void setPermission(TavernaSecurityContext context, String userName, Permission permission)
context
- A security context associated with a particular workflow run.
Note that only the owner of a workflow run may get the
security context in the first place.userName
- The name of the user to set the permission for.permission
- The description of the permission to grant. Note that the
owner of a workflow run always has the equivalent of
Permission.Destroy
; this is always enforced before
checking for other permissions.public Map<String,Permission> getPermissionMap(TavernaSecurityContext context)
public void unregisterRun(@Nonnull String runName, @Nonnull TavernaRun run) throws NoDestroyException, UnknownRunException
runName
- The name of the run.run
- The workflow run. Must correspond to the name.NoDestroyException
- If the user is not permitted to destroy the workflow run.UnknownRunException
- If the run is unknown (e.g., because it is already
destroyed).@Nonnull public Date updateExpiry(@Nonnull TavernaRun run, @Nonnull Date date) throws NoDestroyException
run
- The handle to the workflow run.date
- When the workflow run should be expired.NoDestroyException
- If the user is not permitted to destroy the workflow run.
(Note that lifespan management requires the ability to
destroy.)public String buildWorkflow(Workflow workflow) throws NoCreateException
workflow
- The workflow document (t2flow, scufl2?) to instantiate.NoCreateException
- If the user is not permitted to create workflows.@Nullable public Input getInput(TavernaRun run, String portName)
run
- The workflow run to search.portName
- The name of the input.public Listener getListener(String runName, String listenerName) throws NoListenerException, UnknownRunException
runName
- The name of the run to look uplistenerName
- The name of the listener.NoListenerException
- If no such listener exists.UnknownRunException
- If no such workflow run exists, or if the user does not have
permission to access it.@Nonnull public String getEstimatedContentType(@Nonnull File f)
f
- The file handle.public void copyDataToFile(DataHandler handler, File file) throws FilesystemAccessException
FilesystemAccessException
public void copyDataToFile(URI uri, File file) throws MalformedURLException, FilesystemAccessException, IOException
public void copyStreamToFile(InputStream stream, File file) throws FilesystemAccessException
FilesystemAccessException
public ProfileList getProfileDescriptor(Workflow workflow)
workflow
- The workflow to describe the profiles of.public boolean getAllowStartWorkflowRuns()
public FileConcatenation getLogs(TavernaRun run)
@Nonnull public List<Capability> getCapabilities()
public FileConcatenation getProv(TavernaRun run)
Copyright © 2015–2018 The Apache Software Foundation. All rights reserved.