Package eu.planets_project.ifr.core.servreg.api

Examples of eu.planets_project.ifr.core.servreg.api.ServiceRegistry


     * @throws MalformedURLException
     */
    @Test
    public void usage() throws MalformedURLException {
        /* We retrieve an instance of the registry: */
        ServiceRegistry registry = ServiceRegistryFactory.getServiceRegistry();
        registry.clear(); // clear any old local entries
        URL endpoint1 = new URL("http://some.dummy.endpoint");
        URL endpoint2 = new URL("http://another.dummy.endpoint");
        /* We register service descriptions: */
        registry
                .register(/* new Droid().describe() */new ServiceDescription.Builder(
                        "Droid", Identify.class.getName()).endpoint(endpoint1)
                        .build());
        /* We can register supported migration paths with the service description: */
        FormatRegistry formatRegistry = FormatRegistryFactory.getFormatRegistry();
        MigrationPath path = new MigrationPath(formatRegistry.createExtensionUri("jpg"),
                formatRegistry.createExtensionUri("bmp"), null);
        registry
                .register(/* new SanselanMigrate().describe() */new ServiceDescription.Builder(
                        "Sanselan", Migrate.class.getName())
                        .endpoint(endpoint2).paths(path).build());
        /* And can then query by example, e.g. for migration services supporting the path: */
        ServiceDescription example = new ServiceDescription.Builder(null, Migrate.class
                .getName()).paths(path).build();
        List<ServiceDescription> migrationServices = registry.query(example);
        /* Which we expect to return only the compatible migration service: */
        Assert.assertEquals(1, migrationServices.size());
        Assert.assertEquals("Sanselan", migrationServices.get(0).getName());
        /* For further example on queries see CoreRegistryTests */
    }
View Full Code Here


      // get the ServiceDescription backing bean
      ServiceDescriptionBackingBean descBean = (ServiceDescriptionBackingBean) ServiceRegistryBackingBean.getManagedObject("DescriptionBean");
      // get the selected endpoint
      log.info("Getting Row data");
        _currentEndpoint = (PlanetsServiceEndpoint) this._endpointsDataTable.getRowData();
      ServiceRegistry registry = ServiceRegistryFactory.getServiceRegistry();
      ServiceDescription example = new ServiceDescription.Builder(null, null).endpoint(_currentEndpoint.getLocation()).build();
      List<ServiceDescription> _matches = registry.query(example)
        // If it's registered then get the description from the registry
      if (_matches.size() > 0) {
          descBean.setServiceDescription(_matches.get(0));
        // If it's a new style endpoint then we can get the description and set the bean
        } else if (! _currentEndpoint.isDeprecated()) {
View Full Code Here

                log.info("Found service: " + if_s.getName() );
            }
        }*/
       
        //Look up all available Service(Descriptions) from the local service registry
        ServiceRegistry serReg = ServiceRegistryFactory.getServiceRegistry();
        //a null ServiceDescription will query all endpoints from the registry
        List<ServiceDescription> lServiceDescriptions = serReg.query(null);
        for(ServiceDescription serDesc : lServiceDescriptions){
          Service s = new Service(serDesc);
          if(s != null) sl.add(s);
        }
       
View Full Code Here

    public static ServiceRecordImpl createServiceRecordFromEndpoint(long eid, URL endpoint, Calendar date) {
        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);
View Full Code Here

TOP

Related Classes of eu.planets_project.ifr.core.servreg.api.ServiceRegistry

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.