コード例 #1
0
ファイル: RESTServiceAdmin.java プロジェクト: jerrevds/ODS
  @Override
  public ImportRegistration importService(EndpointDescription endpoint) {
    Class<?> interfaceClass = (Class<?>) endpoint.getProperties().get("interface");
    String baseUrl = endpoint.getId();

    RESTImportProxyHandler proxyhandler = new RESTImportProxyHandler(interfaceClass, baseUrl);

    return proxyhandler.getImportRegistration(context, endpoint);
  }
コード例 #2
0
ファイル: ServiceInfoFactory.java プロジェクト: vijayindu/ecf
 /** @since 3.0 */
 protected URI createURI(
     org.osgi.service.remoteserviceadmin.EndpointDescription endpointDescription,
     IDiscoveryAdvertiser advertiser,
     IServiceTypeID serviceTypeID,
     String serviceName)
     throws URISyntaxException {
   String path = "/" + serviceName; // $NON-NLS-1$
   String str = endpointDescription.getId();
   URI uri = null;
   while (true) {
     try {
       uri = new URI(str);
       if (uri.getHost() != null) {
         break;
       } else {
         final String rawSchemeSpecificPart = uri.getRawSchemeSpecificPart();
         // make sure we break eventually
         if (str.equals(rawSchemeSpecificPart)) {
           uri = null;
           break;
         } else {
           str = rawSchemeSpecificPart;
         }
       }
     } catch (URISyntaxException e) {
       uri = null;
       break;
     }
   }
   String scheme = RemoteConstants.DISCOVERY_SERVICE_TYPE;
   int port = 32565;
   if (uri != null) {
     port = uri.getPort();
     if (port == -1) port = 32565;
   }
   String host = null;
   if (uri != null) {
     host = uri.getHost();
   } else {
     try {
       host = InetAddress.getLocalHost().getHostAddress();
     } catch (Exception e) {
       logWarning(
           "createURI", //$NON-NLS-1$
           "failed to get local host adress, falling back to \'localhost\'.",
           e); //$NON-NLS-1$
       host = "localhost"; // $NON-NLS-1$
     }
   }
   return new URI(scheme, null, host, port, path, null, null);
 }
コード例 #3
0
 private void print(ShellTable table, EndpointDescription ep) {
   String compName = getProp(ep, "component.name");
   table.addRow().addContent(ep.getId(), ep.getInterfaces(), ep.getFrameworkUUID(), compName);
 }