Package eu.planets_project.services.datatypes

Examples of eu.planets_project.services.datatypes.ServiceDescription$Builder


        // Run the service:
        try {
            URL surl = new URL(this.getCompareService());
           
            Map<URL, ServiceDescription> compareServices = this.getCompareServices();
            ServiceDescription sd = compareServices.get(surl);
           
            if( sd.getType().equals(Compare.class.getCanonicalName()) ) {

                Compare chr = new CompareWrapper(surl);
                CompareResult cr = chr.compare( this.getDob1().getDob(), this.getDob2().getDob(), null);
                this.compareServiceReport = cr.getReport();

                me = this.createMeasurementEvent();
                if( me != null ) {
                    this.fillComparisonEvent(me, chr, cr);
                    ExperimentInspector.persistExperiment();
                }
               
            } else if(sd.getType().equals(Identify.class.getCanonicalName())) {
                Identify idf = new IdentifyWrapper(surl);
                IdentifyResult ir1 = idf.identify( this.getDob1().getDob(), null);
                this.compareServiceReport = ir1.getReport();
                IdentifyResult ir2 = idf.identify( this.getDob2().getDob(), null);
                this.compareServiceReport = ir2.getReport();
               
                me = this.createMeasurementEvent();
                if( me != null ) {
                    me.setAgent(new MeasurementAgent(idf.describe()));
                    me.setDate(Calendar.getInstance());
                    this.recordIdentifyComparison(me, ir1, this.getDobUri1(), ir2, this.getDobUri2() );
                   
                    ExperimentInspector.persistExperiment();
                }
               
            } else if(sd.getType().equals(Characterise.class.getCanonicalName())) {
                Characterise chr = new CharacteriseWrapper( surl );
                CharacteriseResult cr1 = chr.characterise( this.getDob1().getDob(), null);
                this.compareServiceReport = cr1.getReport();
                CharacteriseResult cr2 = chr.characterise( this.getDob2().getDob(), null);
                this.compareServiceReport = cr2.getReport();
View Full Code Here


    /**
     * Test the Description method.
     */
    @Test
    public void testDescribe() {
        ServiceDescription desc = dom.describe();
        assertTrue("The ServiceDescription should not be NULL.", desc != null);
        System.out.println("Recieved service description: "
                + desc.toXmlFormatted());
    }
View Full Code Here

    /**
     * Test method for {@link eu.planets_project.ifr.core.simple.impl.SimpleIdentifyService#describe()}.
     */
    @Test
    public void testDescribe() {
        ServiceDescription desc = ids.describe();
        assertTrue("The ServiceDescription should not be NULL.", desc != null );
        System.out.println("Recieved service description: " + desc.toXmlFormatted());
    }
View Full Code Here

            return registry.query(null);
        }
       
        // List particular services:
        log.info("Looking for services of type: "+type);
        ServiceDescription sdQuery = new ServiceDescription.Builder(null, type).build();
       
        // This is the list:
        return registry.query(sdQuery);
    }
View Full Code Here

        if( endpoint == null ) return null;
       
        ServiceRecordImpl sr = null;
       
        ServiceRegistry registry = instanciateServiceRegistry();
        ServiceDescription sdQuery = new ServiceDescription.Builder(null, null).endpoint(endpoint).build();
       
        List<ServiceDescription> result = registry.query(sdQuery);
        log.info("Got matching results: "+result);
       
        if( result != null && result.size() > 0 ) {
            ServiceDescription sd = result.get(0);
            sr = ServiceRecordImpl.createServiceRecordFromDescription(eid, sd, date);
        }
       
        return sr;
    }
View Full Code Here

    /**
     * Test the describe() method.
     */
    @Test
    public void testServiceDescription() {
        ServiceDescription description = new JhoveValidation().describe();
        Assert.assertTrue("We have no supported pronom IDs", description
                .getInputFormats().size() > 0);
        System.out.println(description.toXmlFormatted());
    }
View Full Code Here

   
    /**
     * @return
     */
    public List<URI> getOutputs() {
        ServiceDescription sd = this.getServiceDescription();
        List<URI> uris = new ArrayList<URI>();
        if( sd != null ) {
            for( MigrationPath mp : sd.getPaths() ) {
                if( ! uris.contains( mp.getOutputFormat() ) ) uris.add(mp.getOutputFormat());
            }
        }
        if( uris.size() == 0 ) return null;
        return uris;
View Full Code Here

   
    /**
     * @return
     */
    public List<PathwayBean> getPathways() {
        ServiceDescription sd = this.getServiceDescription();
        List<PathwayBean> paths = new ArrayList<PathwayBean>();
        if( sd != null ) {
            for( MigrationPath mp : sd.getPaths() ) {
                paths.add(new PathwayBean(this,
                        new FormatBean( ServiceBrowser.fr.getFormatForUri(mp.getInputFormat())),
                        new FormatBean( ServiceBrowser.fr.getFormatForUri(mp.getOutputFormat())) ) );
            }
        }
View Full Code Here

    /**
     * @return
     */
    public List<URI> getInputs( boolean includeMigrations ) {
        ServiceDescription sd = this.getServiceDescription();
        List<URI> uris = new ArrayList<URI>();
        if( sd != null ) {
            for( URI fmturi : sd.getInputFormats() ) {
                if( ! uris.contains( fmturi ) ) uris.add(fmturi);
            }
            if( includeMigrations ) {
                for( MigrationPath mp : sd.getPaths() ) {
                    if( ! uris.contains( mp.getInputFormat() ) ) uris.add(mp.getInputFormat());
                }
            }
        }
        if( uris.size() == 0 ) return null;
View Full Code Here

     * @throws Exception
     * @throws MalformedURLException
     */
    private ServiceDescription helperGetMetadataFromSerRegistry(ServiceBean sb, String sEndpoint, boolean addDefaultParamsAsStandardParams) throws Exception{
      try{
        ServiceDescription sdesc = getServiceDescirptionFromServiceRegistry(sEndpoint);
        sb.setServiceName(sdesc.getName());
      String serType = sdesc.getType();
      sb.setServiceDescription(sdesc.getDescription());
      sb.setServiceType(serType.substring(serType
          .lastIndexOf('.') + 1));
     
      //get default parameters for Service
      List<Parameter> pList = sdesc.getParameters();
      if (pList != null) {
        Iterator<Parameter> it = pList.iterator();
        while (it.hasNext()) {
          Parameter par = it.next();
          ServiceParameter spar = new ServiceParameter(par
              .getName(), par.getValue());
          //decide if the default params are added as standard params
          if(addDefaultParamsAsStandardParams){
            sb.addParameter(spar);
          }
          //add the default params to the bean
          sb.addDefaultParameter(spar);
        }
      } else {
        log.info("Service: " + sdesc.getName() +" has no default parameters.");
      }

      //FIXME: dirty solution. Offer the migrate_from and migrate_to parameters for type 'Migrate' service
      //TODO offer a pull down list for mime-types
      if(serType.endsWith(Migrate.NAME)){
View Full Code Here

TOP

Related Classes of eu.planets_project.services.datatypes.ServiceDescription$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.