On Wed, Oct 20, 2010 at 09:32, Egon Willighagen
<[email protected]> wrote:
> Hi all,
>
> I am trying to get two activities visible in the workbench:
>
>        public void findServiceDescriptionsAsync(
>                        FindServiceDescriptionsCallBack callBack) {
>                List<ServiceDescription> results = new 
> ArrayList<ServiceDescription>();
>                ServiceDescription service = new OPSINServiceDesc();
>                service.setDescription("Convert IUPAC names into CML");
>                results.add(service);
>                callBack.partialResults(Collections.singletonList(service));
>                service = new RecognizeEntitiesServiceDesc();
>                service.setDescription("Extract chemical entities from a plain 
> text");
>                results.add(service);
>                callBack.partialResults(Collections.singletonList(service));
>                callBack.finished();
>        }
>
> But I only get either of the two to show up, not both...

You  need to implement this method:

        /**
         * 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 new ArrayList<Object>();
        }

Now both your service descriptions claim they are uniquely identified
by [] - and so only one of them will be added - the second will be
considered a duplicate as service descriptions are kept in a Set. The
class of the service description is deliberately not considered - so
that if you added MyOwnServiceDescription that used the same
getIdentifyingData() as say the wsdl-activity-ui - then you could
avoid duplicate service entries for the same service.

We should probably make it a fault to return [] from getIdentifyingData().


Also - you don't need to (but can, if you like) have two different
service descriptions for two different activities - you can add
setter-methods to the service description which customizes things like
setName() or setActivityConfiguration() and have regular private
fields - or you can set some more internal field which you then can
use from getActivityConfiguration() and getActivityClass() to
determine what to use dynamically. (These will be called when adding
the service to the workflow)  - this will be a judgement for you to
make depending on how 'different' the services are.

For instance Taverna has WSDL service descriptions different from
Soaplab service descriptions, as the latter contains additional
getters with things like descriptions, as these properties can be
searched for in the service panel.


-- 
Stian Soiland-Reyes, myGrid team
School of Computer Science
The University of Manchester

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
taverna-hackers mailing list
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/about/contact-us/
Developers Guide: http://www.taverna.org.uk/developers/

Reply via email to