Skip to end of metadata
Go to start of metadata

Plugin writing issues Overcome

Multiple steps to getting inpit and writing output

        InvocationContext context = callback.getContext();
        ReferenceService referenceService = context.getReferenceService();
        T2Reference outputRef = referenceService.register(value, 0, true, context);
        outputs.put(parameterName, outputRef);                       

Difficult to get good feedback if there was a bug getting input

    private final String getValueFromInputs(final Map<String, T2Reference> inputs,

            final AsynchronousActivityCallback callback, String parameterName, boolean required){

        InvocationContext context = callback.getContext();

        ReferenceService referenceService = context.getReferenceService();

        T2Reference reference = inputs.get(parameterName);

        if (reference == null){

            callback.fail("Unconnected Parameter \"" +  parameterName + "\"");

            return null;

        }

        String input = (String) referenceService.renderIdentifier

                (reference, String.class, context);

        if (required){

            if (input == null){

                callback.fail("Missing Parameter \"" +  parameterName + "\"");

                return null;

            }

            if (input.isEmpty()){

                callback.fail("Empty Parameter \"" +  parameterName + "\"");

                return null;

            }            

        }

        return input;

    }

 Difficult to get good feedback if there was a bug writing output

    private boolean writeOutput(final AsynchronousActivityCallback callback,
            Map<String, T2Reference> outputs, String value, String parameterName){
        boolean validPort = false;
        for (OutputPort port:this.getOutputPorts()){
            if (port.getName().equals(parameterName)){
                validPort = true;
            }
        }
        if (!validPort){
            callback.fail("Unconnected Parameter \"" +  parameterName + "\"");
            return false;
        }
        InvocationContext context = callback.getContext();
        ReferenceService referenceService = context.getReferenceService();
        T2Reference outputRef = referenceService.register(value, 0, true, context);
        outputs.put(parameterName, outputRef);                        
        return true;
    }

Ultra complicated GUI

Multiple files to implement:

public interface ServiceDescriptionProvider

public abstract class ServiceDescription<ConfigType extends Object> extends IdentifiedObject implements HelpEndpointsProvider 

public abstract class AbstractConfigureActivityMenuAction<ActivityClass extends Activity<?>> extends AbstractContextualMenuAction

public abstract class ActivityConfigurationAction<A extends Activity<ConfigurationBean>, ConfigurationBean extends Object> extends AbstractAction

public abstract class ActivityConfigurationPanel<A extends Activity, B extends Object> extends JPanel 

public interface ActivityIconSPI

public interface ContextualViewFactory<SelectionType extends Object>

public abstract class ContextualView extends JPanel

Multiple configuration  files

net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider

net.sf.taverna.t2.ui.menu.MenuComponent

net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI

net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory

My thoughts

Why can Activity not return an Icon which is a Standard Java Object?

Avoids ActivityIconSPI

Why can ServiceDescription not implement getContextView

Avoids ContextualViewFactory

Why can ServiceDescription not implement getConfigureView

Avoids AbstractConfigureActivityMenuAction

Avoids ActivityConfigurationAction

 

 

 

 

 

 

Labels
  • None