public class Configuration extends AbstractNamed implements Child<Profile>, Typed
Configurable
workflow bean.
A configuration is activated by a Profile
, and provides a link to the
getJson()
containing the properties to configure the bean, like an
Activity
.
A configuration is of a certain (RDF) type, as defined by
getType()
- which determines which properties are required and
optional. For instance, the type
http://ns.taverna.org.uk/2010/activity/wsdl/ConfigType
requires
the property
http://ns.taverna.org.uk/2010/activity/wsdl/operation
.
These requirements are described in the ConfigurationDefinition
that
matches the getConfigurableType() of the Configurable
found by
getConfigures()
. Its
ConfigurationDefinition#getPropertyResourceDefinition()
should in
PropertyResourceDefinition#getTypeURI()
should match the
getType()
of this Configuration
.
Note: getType()
(and the potentially misleading getType()
)
return the type of this Configuration, not the type of the
Configurable
bean that it happens to configure. For instance, a
Configuration typed http://example.com/WSDLConfiguration
might
configure an activity typed http://example.com/WSDLActivity
, but
could also have configured an activity typed
http://example.com/GlobusWSDLActivity
.
TODO: Where are the ConfigurationDefinitions found?
AbstractCloneable.Cloning, AbstractCloneable.CopyVisitor
INVALID_NAME
Constructor and Description |
---|
Configuration()
Constructs a
Configuration with a random UUID as the name. |
Configuration(String name)
Construct a
Configuration with the specified name. |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Visitor visitor)
Accepts a
Visitor to this WorkflowBean . |
protected void |
cloneInto(WorkflowBean clone,
AbstractCloneable.Cloning cloning) |
Configurable |
getConfigures()
Return the
Configurable workflow bean that is configured. |
com.fasterxml.jackson.databind.JsonNode |
getJson()
Return the underlying JSON
JsonNode which contains the properties
set by this configuration. |
com.fasterxml.jackson.databind.node.ObjectNode |
getJsonAsObjectNode()
Return the
getJson() configuration as an ObjectNode . |
String |
getJsonAsString()
Return a string representation of the
getJson() configuration,
the string is valid JSON. |
com.fasterxml.jackson.databind.JsonNode |
getJsonSchema() |
Profile |
getParent() |
URI |
getType()
Return the type of the
Configuration . |
protected com.fasterxml.jackson.databind.JsonNode |
parseJson(String jsonString) |
void |
setConfigures(Configurable configurable)
Set the
Configurable WorkflowBean that is configured. |
void |
setJson(com.fasterxml.jackson.databind.JsonNode json)
Set the underlying JSON
JsonNode which contains the properties
set by this configuration. |
void |
setJson(String jsonString) |
void |
setJsonSchema(com.fasterxml.jackson.databind.JsonNode jsonSchema) |
void |
setJsonSchema(String jsonString) |
void |
setParent(Profile parent)
Sets the parent of this workflow bean.
|
void |
setType(URI type)
Set the type of the
Configuration . |
compareTo, equals, getAnnotations, getName, getRelativeURI, getURI, hashCode, setName, toString
clone, cloneWorkflowBean, getTools, getUriTools
finalize, getClass, notify, notifyAll, wait, wait, wait
clone
public Configuration()
Configuration
with a random UUID as the name.public Configuration(String name)
Configuration
with the specified name.name
- the name of the Configuration
. Must
not be null
or an empty String.public boolean accept(Visitor visitor)
WorkflowBean
Visitor
to this WorkflowBean
.accept
in interface WorkflowBean
visitor
- the Visitor
to accepttrue
if this WorkflowBeans
children
should be visited.public Configurable getConfigures()
Configurable
workflow bean that is configured.
Typically an Activity
or Processor
, Workflow
and
Port
can be configured.Configurable
WorkflowBean
that is
configuredpublic Profile getParent()
public com.fasterxml.jackson.databind.JsonNode getJson()
JsonNode
which contains the properties
set by this configuration.
The JSON node is typically an ObjectNode
or ArrayNode
,
but could also be a ValueNode
. The default node for a freshly
constructed Configuration is an ObjectNode
. * @return the backing
ObjectNode
.
public String getJsonAsString()
getJson()
configuration,
the string is valid JSON.public com.fasterxml.jackson.databind.node.ObjectNode getJsonAsObjectNode()
getJson()
configuration as an ObjectNode
.
This is the default type for a new Configuration
.IllegalStateException
- if the getJson()
is not an ObjectNode
public URI getType()
Configuration
.
The URI will match the PropertyResource#getTypeURI()
.
public void setConfigures(Configurable configurable)
Configurable
WorkflowBean
that is configured.configurable
- the Configurable
WorkflowBean
that
is configuredpublic void setParent(Profile parent)
Child
Setting the parent would normally also add the object to the relevant collection in the parent if it does not already exist there.
If the child has an existing, object-identity different parent, the child will first be removed from the parent collection if it exists there.
Note:If the child is Named
the parent collection
will be a NamedSet
. This implicit insertion would overwrite any
conflicting sibling with the same Named.getName()
- to avoid
this, add the child to the parent collection by using
NamedSet.addWithUniqueName(Named)
before setting the parent.
public void setJson(com.fasterxml.jackson.databind.JsonNode json)
JsonNode
which contains the properties
set by this configuration. The JSON node is typically an
ObjectNode
or ArrayNode
, but could also be a
ValueNode
.
If the provided ObjectNode is null
, a new, blank
ObjectNode
will be set.
json
- the underlying JsonNode
which contains the
properties set by this configuration.public void setType(URI type)
Configuration
.
This will also set PropertyResource#setTypeURI(URI)
.
protected void cloneInto(WorkflowBean clone, AbstractCloneable.Cloning cloning)
cloneInto
in class AbstractNamed
public com.fasterxml.jackson.databind.JsonNode getJsonSchema()
public void setJsonSchema(com.fasterxml.jackson.databind.JsonNode jsonSchema)
public void setJsonSchema(String jsonString)
public void setJson(String jsonString)
protected com.fasterxml.jackson.databind.JsonNode parseJson(String jsonString)
Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.