示例#1
0
  @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);
  }
 protected void writeProperties(
     int indentLevel,
     Writer writer,
     org.osgi.service.remoteserviceadmin.EndpointDescription endpointDescription)
     throws IOException {
   Map<String, Object> properties = endpointDescription.getProperties();
   for (String name : properties.keySet())
     writeProperty(indentLevel + 1, writer, name, properties.get(name));
 }
示例#3
0
 /** @since 3.0 */
 protected String createServiceName(
     org.osgi.service.remoteserviceadmin.EndpointDescription endpointDescription,
     IDiscoveryAdvertiser advertiser,
     IServiceTypeID serviceTypeID) {
   // First create unique default name
   String defaultServiceName =
       createDefaultServiceName(endpointDescription, advertiser, serviceTypeID);
   // Look for service name that was explicitly set
   String serviceName =
       PropertiesUtil.getStringWithDefault(
           endpointDescription.getProperties(),
           RemoteConstants.DISCOVERY_SERVICE_NAME,
           defaultServiceName);
   return serviceName;
 }
示例#4
0
 /** @since 3.0 */
 protected IServiceTypeID createServiceTypeID(
     org.osgi.service.remoteserviceadmin.EndpointDescription endpointDescription,
     IDiscoveryAdvertiser advertiser) {
   Map props = endpointDescription.getProperties();
   String[] scopes =
       PropertiesUtil.getStringArrayWithDefault(
           props, RemoteConstants.DISCOVERY_SCOPE, IServiceTypeID.DEFAULT_SCOPE);
   String[] protocols =
       PropertiesUtil.getStringArrayWithDefault(
           props, RemoteConstants.DISCOVERY_PROTOCOLS, IServiceTypeID.DEFAULT_SCOPE);
   String namingAuthority =
       PropertiesUtil.getStringWithDefault(
           props, RemoteConstants.DISCOVERY_NAMING_AUTHORITY, IServiceTypeID.DEFAULT_NA);
   return ServiceIDFactory.getDefault()
       .createServiceTypeID(
           advertiser.getServicesNamespace(),
           new String[] {RemoteConstants.DISCOVERY_SERVICE_TYPE},
           scopes,
           protocols,
           namingAuthority);
 }
示例#5
0
 private String getProp(EndpointDescription ep, String key) {
   Object value = ep.getProperties().get(key);
   return value == null ? "" : value.toString();
 }