Tabnine Logo
ConnectionDescriptor
Code IndexAdd Tabnine to your IDE (free)

How to use
ConnectionDescriptor
in
pl.edu.icm.synat.api.services.registry.model

Best Java code snippets using pl.edu.icm.synat.api.services.registry.model.ConnectionDescriptor (Showing top 20 results out of 315)

origin: pl.edu.icm.synat/synat-service-registry

/**
 * Create new list of ConnectionDescriptor for those protocols which exists in both: given service list and acceptable protocols.
 */
private List<ConnectionDescriptor> limitServiceLocations(final List<ConnectionDescriptor> serviceLocations,
    final Collection<String> acceptableProtocols) {
  
  final List<ConnectionDescriptor> limitedConnections = new ArrayList<ConnectionDescriptor>();
  
  for (String protocol : acceptableProtocols) {
    for (final ConnectionDescriptor connectionDescriptor : serviceLocations) {
      if (protocol.equals(connectionDescriptor.getProtocol())) {
        limitedConnections.add(connectionDescriptor);
      }
    }
  }
  return limitedConnections;
}
origin: pl.edu.icm.synat/synat-platform-integration-tests

  private void processManagerDescriptor(ServiceManagerDescriptor managerDescriptor) throws MalformedURLException, URISyntaxException {
    for (ConnectionDescriptor descriptor : managerDescriptor.getServiceLocations()) {
      if ("jmx".equals(descriptor.getProtocol())) {
        URI oldLocationUri = descriptor.getLocation();
        URI newLocationUri = processJmxURI(oldLocationUri);
        descriptor.setLocation(newLocationUri);
      } else {
        descriptor.setLocation(
            new URIBuilder(descriptor.getLocation()).setPort(descriptor.getLocation().getPort() + portShift).build());
      }
    }
  }
}
origin: pl.edu.icm.synat/synat-platform-container

private ServiceManagerDescriptor prepareDescriptor(final String serverUrl, final ObjectName objectName, final String managerType) {
  ServiceManagerDescriptor managerDescriptor = new ServiceManagerDescriptor();
  managerDescriptor.setManagerType(managerType);
  List<ConnectionDescriptor> serviceLocations = new ArrayList<ConnectionDescriptor>();
  managerDescriptor.setServiceLocations(serviceLocations);
  ConnectionDescriptor connectionDesc = new ConnectionDescriptor();
  connectionDesc.setLocation(URI.create(serverUrl));
  connectionDesc.setProtocol("jmx");
  connectionDesc.setProtocolFeatures(Collections.singletonMap("objectName", objectName.getCanonicalName()));
  serviceLocations.add(connectionDesc);
  return managerDescriptor;
}
origin: pl.edu.icm.synat/synat-service-registry

private ConnectionDescriptorProto transformConnectionDesc(final ConnectionDescriptor connectionDescriptor) {
  pl.edu.icm.synat.api.services.registry.model.protobuf.ServicesModel.ConnectionDescriptorProto.Builder builder;
  builder = ConnectionDescriptorProto.newBuilder();
  builder.addAllFeatures(transformMap(connectionDescriptor.getProtocolFeatures()));
  if (connectionDescriptor.getLocation() != null) {
    builder.setLocation(connectionDescriptor.getLocation().toString());
  }
  builder.setProtocol(connectionDescriptor.getProtocol());
  return builder.build();
}
origin: pl.edu.icm.synat/synat-console-core

@RequestMapping(value="/containers/add", method=RequestMethod.POST)
public String addContainer(final Model model, @ModelAttribute("containerDescriptor") ServiceDescriptor containerDescriptor, BindingResult result) {
  
  containerDescriptorValidator.validate(containerDescriptor, result);
  if (result.hasErrors()) {
    model.addAttribute("availableServiceProtocols", ServiceRegistryConstants.ALL_KNOWN_SERVICE_PROTOCOLS);
    return "console.platform.container.add";
  }
  ListIterator<ConnectionDescriptor> it = containerDescriptor.getServiceLocations().listIterator();
  while (it.hasNext()) {
    ConnectionDescriptor conn = it.next();
    if (conn.getLocation() == null || conn.getProtocol() == null) {
      it.remove();
    }
  }
  registryManager.addContainer(containerDescriptor);
  return UrlBasedViewResolver.REDIRECT_URL_PREFIX + "/containers";
}
origin: pl.edu.icm.synat/synat-platform-connector

public Object createProxy(ServiceManagerDescriptor managerDescriptor) {
  
  String managerType = managerDescriptor.getManagerType();
  Class<?> managerInterface;
  try {
    managerInterface = beanClassloader.loadClass(managerType);
  } catch (ClassNotFoundException e) {
    logger.error("Manager Interface not found [{}]", managerType, e);
    throw new GeneralServiceException(e);
  }
  ConnectionDescriptor connectionDescriptor = findLocation(managerDescriptor);

  String serverUrl = connectionDescriptor.getLocation().toString();
  String objectName = connectionDescriptor.getProtocolFeatures().get("objectName");
  return createProxyWithInterface(serverUrl, objectName, managerInterface);
  
}

origin: pl.edu.icm.synat/synat-platform-connector

public String getBrokerUrl() {
  return connectionDescriptor.getLocation().toString();
}

origin: pl.edu.icm.synat/synat-platform-container

@Override
public InternalConnectionDeploymentResult registerService(final Service service, final ServiceAccess serviceAccess,
    final Class<? extends Service> serviceInterface, final Map<String, String> serviceFeatures) {
  final Map<String, String> protocolFeatures;
  protocolFeatures = new HashMap<String, String>();
  final ConnectionDescriptor connectionDescriptor = new ConnectionDescriptor(null,
      ServiceRegistryConstants.SERVICE_PROTOCOL_LOCAL, protocolFeatures);
  
  return new InternalConnectionDeploymentResult(connectionDescriptor, null, this);
}
origin: pl.edu.icm.synat/synat-platform-connector

private String getStreamingUrl(final ConnectionDescriptor connectionDescriptor) {
  return connectionDescriptor.getProtocolFeatures().get("streamingUrl");
}
origin: pl.edu.icm.synat/synat-platform-connector

public Object invokeOperation(ServiceManagerDescriptor managerDescriptor, String operationName, Object[] params, String[] signature) {
  ConnectionDescriptor connectionDescriptor = findLocation(managerDescriptor);
  String serverUrl = connectionDescriptor.getLocation().toString();
  String objectNameString = connectionDescriptor.getProtocolFeatures().get("objectName");
  
  try {
    MBeanServerConnection serverConnection;
    serverConnection = connectorFactory.getMBeanServerConnection(serverUrl);
    ObjectName objectName = ObjectNameManager.getInstance(objectNameString);
    
    return serverConnection.invoke(objectName, operationName, params, signature);
  } catch (Exception e) {
    throw new MBeanConnectFailureException("Exception while retrieving MBeanInfo", e);
  }
}    

origin: pl.edu.icm.synat/synat-platform-connector

@SuppressWarnings("unchecked")
@Override
protected <T> T createService(ConnectionDescriptor connectionDescriptor, Class<T> serviceInterface, String serviceId, boolean stateful) {
  final URI location = connectionDescriptor.getLocation();
  final ServiceRestClient restClient = getRestClientByInterface(serviceInterface);
  if (restClient == null) {
    logger.error("Could not find client for " + serviceInterface);
    return null;
  } else {
    injectValues(location, restClient);
    restClient.initialize();
    return (T) restClient;
  }
}
origin: pl.edu.icm.synat/synat-platform-container

@Override
public InternalConnectionDeploymentResult registerService(final Service service, final ServiceAccess serviceAccess,
    final Class<? extends Service> serviceInterface, final Map<String, String> serviceFeatures) {
  final Map<String, String> protocolFeatures;
  protocolFeatures = new HashMap<String, String>();
  final ConnectionDescriptor connectionDescriptor;
  
  if (service instanceof JmsBrokerDeployerConfig) {
    final JmsBrokerDeployerConfig config = (JmsBrokerDeployerConfig) service;
    final String brokerUrl = config.getBrokerUrl();
    Assert.notNull(brokerUrl);
    configureProtocolFeatures(protocolFeatures, config);
    
    connectionDescriptor = new ConnectionDescriptor(URI.create(brokerUrl),
        ServiceRegistryConstants.SERVICE_PROTOCOL_JMS, protocolFeatures);
  } else {
    connectionDescriptor = null;
  }
  
  return new InternalConnectionDeploymentResult(connectionDescriptor, null, this);
}
origin: pl.edu.icm.synat/synat-platform-connector

public String getDestinationType() {
  return connectionDescriptor.getProtocolFeatures().get(JMS_CONFIG_DESTINATION_TYPE);
}
origin: pl.edu.icm.synat/synat-platform-core

private ConnectionDescriptor getJmsDescriptor(final ServiceDescriptor serviceDescriptor) {

  final List<ConnectionDescriptor> serviceLocations = serviceDescriptor.getServiceLocations();

  for (final ConnectionDescriptor connectionDescriptor : serviceLocations) {
    if (ServiceRegistryConstants.SERVICE_PROTOCOL_JMS.equals(connectionDescriptor.getProtocol())) {
      return connectionDescriptor;
    }
  }
  
  logger.warn("Jms descriptor not found in {}", serviceDescriptor);
  
  throw new IllegalStateException("Jms descriptor not found");
  
}
origin: pl.edu.icm.synat/synat-platform-connector

  public Object getAttribute(ServiceManagerDescriptor managerDescriptor, String attributeName) {
    ConnectionDescriptor connectionDescriptor = findLocation(managerDescriptor);
    String serverUrl = connectionDescriptor.getLocation().toString();
    String objectNameString = connectionDescriptor.getProtocolFeatures().get("objectName");
    
    try {
      MBeanServerConnection serverConnection;
      serverConnection = connectorFactory.getMBeanServerConnection(serverUrl);
      ObjectName objectName = ObjectNameManager.getInstance(objectNameString);

      return serverConnection.getAttribute(objectName, attributeName);
    } catch (Exception e) {
      throw new MBeanConnectFailureException("Exception while retrieving MBeanInfo", e);
    }
  }    
}
origin: pl.edu.icm.synat/synat-console-core

private ContainerDetails transformToContainerDetails(final ServiceDescriptor containerDescriptor) {
  ContainerDetails containerDetails = new ContainerDetails();
  containerDetails.setName(containerDescriptor.getServiceId());
  List<String> locations = new ArrayList<String>();
  List<ConnectionDescriptor> serviceLocations = containerDescriptor.getServiceLocations();
  if (serviceLocations != null) {
    for (ConnectionDescriptor connectionDescriptor : serviceLocations) {
      locations.add(connectionDescriptor.getLocation().toString());
    }
  }
  containerDetails.setAddress(locations);
  return containerDetails;
}
origin: pl.edu.icm.synat/synat-platform-integration-tests

private ServiceDescriptorList createContainerListObject() {
  List<ServiceDescriptor> serviceDescriptors = new ArrayList<ServiceDescriptor>();
  ServiceDescriptorList descriptorList = new ServiceDescriptorList();
  descriptorList.setServiceDescriptors(serviceDescriptors);
  
  ServiceDescriptor serviceDescriptor = new ServiceDescriptor();
  serviceDescriptors.add(serviceDescriptor);
  
  String containerNameToUse;
  if (containerName == null) {
    containerNameToUse = "TestContainer";
  } else {
    containerNameToUse = containerName;
  }
  serviceDescriptor.setServiceId(containerNameToUse);
  
  URI uri = URI.create("rmi://127.0.0.1:"+rmiPort+"/platform-serviceContainer");
  ConnectionDescriptor connectionDescriptor= new ConnectionDescriptor(uri, ServiceRegistryConstants.SERVICE_PROTOCOL_RMI, Collections.emptyMap());
  serviceDescriptor.setServiceLocations(Collections.singletonList(connectionDescriptor));
  
  return descriptorList;
}

origin: pl.edu.icm.synat/synat-platform-connector

public String getDestinationName() {
  return connectionDescriptor.getProtocolFeatures().get(JMS_CONFIG_DESTINATION_NAME);
}

origin: pl.edu.icm.synat/synat-service-registry

private boolean haveCommonElement(final Collection<String> acceptableProtocols, final ServiceDescriptor descriptor, final String clientName, final String containerName) {
  for (final ConnectionDescriptor connectionDescriptor : descriptor.getServiceLocations()) {
    final String protocol = connectionDescriptor.getProtocol();
    if (acceptableProtocols.contains(protocol)) {
      if (ServiceRegistryConstants.SERVICE_PROTOCOL_LOCAL.equals(protocol)) {
        if (clientName != null && clientName.equals(containerName)) {
          return true;
        }
      } else {
        return true;
      }
    }
  }
  return false;
}
origin: pl.edu.icm.synat/synat-platform-connector

public MBeanInfo getMBeanInfo(ServiceManagerDescriptor managerDescriptor) {
  ConnectionDescriptor connectionDescriptor = findLocation(managerDescriptor);
  String serverUrl = connectionDescriptor.getLocation().toString();
  String objectName = connectionDescriptor.getProtocolFeatures().get("objectName");
  
  try {
    MBeanServerConnection serverConnection;
    serverConnection = connectorFactory.getMBeanServerConnection(serverUrl);
    MBeanInfo mBeanInfo = serverConnection.getMBeanInfo(ObjectNameManager.getInstance(objectName));
    return mBeanInfo;
  } catch (Exception e) {
    throw new MBeanConnectFailureException("Exception while retrieving MBeanInfo", e);
  }
}

pl.edu.icm.synat.api.services.registry.modelConnectionDescriptor

Javadoc

Describe all information needed to create connection to service. location represent protocol specific reference to exportet service, It is not mandatory. protocol is name of protocol which should be used to establish connection all known protocols are defined as constants in pl.edu.icm.synat.services.registry.ServiceRegistryConstants.

Most used methods

  • getProtocol
  • getLocation
  • <init>
  • getProtocolFeatures
  • setLocation
  • setProtocol
  • setProtocolFeatures

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • addToBackStack (FragmentTransaction)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now