blob: 5d9848d78bf916df49aa2e29d797fe3ddb59e4be [file] [log] [blame]
package net.sf.taverna.t2.activities.rest.ui.serviceprovider;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
import net.sf.taverna.t2.activities.rest.RESTActivity;
import net.sf.taverna.t2.activities.rest.RESTActivityConfigurationBean;
public class ExampleServiceDesc extends ServiceDescription<RESTActivityConfigurationBean>
{
/**
* The subclass of Activity which should be instantiated when adding a service
* for this description
*/
@Override
public Class<? extends Activity<RESTActivityConfigurationBean>> getActivityClass() {
return RESTActivity.class;
}
/**
* The configuration bean which is to be used for configuring the instantiated activity.
* Making this bean will typically require some of the fields set on this service
* description, like an endpoint URL or method name.
*
*/
@Override
public RESTActivityConfigurationBean getActivityConfiguration() {
RESTActivityConfigurationBean bean = new RESTActivityConfigurationBean();
bean.setExampleString(exampleString);
bean.setExampleUri(exampleUri);
return bean;
}
/**
* An icon to represent this service description in the service palette.
*/
@Override
public Icon getIcon() {
return null;
}
/**
* The display name that will be shown in service palette and will
* be used as a template for processor name when added to workflow.
*/
@Override
public String getName() {
return exampleString;
}
/**
* The path to this service description in the service palette. Folders
* will be created for each element of the returned path.
*/
@Override
public List<String> getPath() {
// For deeper paths you may return several strings
return Arrays.asList("Service templates", "Examples " + exampleUri);
}
/**
* Return a list of data values uniquely identifying this service
* description (to avoid duplicates). Include only primary key like fields,
* ie. ignore descriptions, icons, etc.
*/
@Override
protected List<? extends Object> getIdentifyingData() {
// FIXME: Use your fields instead of example fields
return Arrays.<Object>asList(exampleString, exampleUri);
}
// FIXME: Replace example fields and getters/setters with any required
// and optional fields. (All fields are searchable in the Service palette,
// for instance try a search for exampleString:3)
private String exampleString;
private URI exampleUri;
public String getExampleString() {
return exampleString;
}
public URI getExampleUri() {
return exampleUri;
}
public void setExampleString(String exampleString) {
this.exampleString = exampleString;
}
public void setExampleUri(URI exampleUri) {
this.exampleUri = exampleUri;
}
}