Package org.eclipse.ecf.core.identity

Examples of org.eclipse.ecf.core.identity.ID


  protected boolean matchNotConnected(IContainer container, ID endpointID,
      ID connectTargetID) {
    // if the container is not connected, OR it's connected to the desired
    // endpointID already then we've got a match
    ID connectedID = container.getConnectedID();
    if (connectedID == null || connectedID.equals(endpointID)
        || connectedID.equals(connectTargetID))
      return true;
    return false;
  }
View Full Code Here


  protected void connectContainerToTarget(
      IRemoteServiceContainer rsContainer, ID connectTargetID) {
    if (connectTargetID == null)
      return;
    IContainer container = rsContainer.getContainer();
    ID connectedID = container.getConnectedID();
    // Only connect the container to the connect target when
    // it's not already connected
    if (connectedID == null) {
      // connect to target
      try {
View Full Code Here

      if (timestamp != null)
        encodeLong(result, RemoteConstants.ENDPOINT_TIMESTAMP,
            timestamp);
     
      // org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteConstants.ENDPOINT_CONNECTTARGET_ID
      ID connectTargetID = ecfEd.getConnectTargetID();
      if (connectTargetID != null)
        encodeString(result, RemoteConstants.ENDPOINT_CONNECTTARGET_ID,
            connectTargetID.getName());

      // org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteConstants.ENDPOINT_IDFILTER_IDS
      ID[] idFilter = ecfEd.getIDFilter();
      if (idFilter != null && idFilter.length > 0) {
        List<String> idNames = new ArrayList<String>();
View Full Code Here

        .getStringPlusProperty(
            endpointDescription.getProperties(),
            org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS);
    String[] serviceImportedConfigs = sic.toArray(new String[sic.size()]);
    // Get the endpointID
    ID endpointContainerID = endpointDescription.getContainerID();

    // Get connect targetID
    ID connectTargetID = endpointDescription.getConnectTargetID();

    IRemoteServiceContainer rsContainer = (reuseExistingContainers) ? selectExistingConsumerContainer(
        endpointContainerID, serviceImportedConfigs, connectTargetID)
        : null;
View Full Code Here

      ServiceReference serviceReference,
      Map<String, Object> overridingProperties,
      String[] exportedInterfaces, String[] serviceIntents,
      IRemoteServiceContainer rsContainer) {
    IContainer container = rsContainer.getContainer();
    ID containerID = container.getID();

    Map<String, Object> endpointDescriptionProperties = new TreeMap<String, Object>(
        String.CASE_INSENSITIVE_ORDER);

    // OSGi properties
    // OBJECTCLASS set to exportedInterfaces
    endpointDescriptionProperties.put(
        org.osgi.framework.Constants.OBJECTCLASS, exportedInterfaces);

    // Service interface versions
    for (int i = 0; i < exportedInterfaces.length; i++) {
      String packageName = getPackageName(exportedInterfaces[i]);
      String packageVersionKey = org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_PACKAGE_VERSION_
          + packageName;
      // If it's pre-set...by registration or by overridingProperties,
      // then use that value
      String packageVersion = (String) PropertiesUtil.getPropertyValue(
          serviceReference, overridingProperties, packageVersionKey);
      if (packageVersion == null) {
        Version version = getPackageVersion(serviceReference,
            exportedInterfaces[i], packageName);
        if (version != null && !version.equals(Version.emptyVersion))
          packageVersion = version.toString();
      }
      // Only set the package version if we have a non-null value
      if (packageVersion != null)
        endpointDescriptionProperties.put(packageVersionKey,
            packageVersion);
    }

    // ENDPOINT_ID
    String endpointId = (String) PropertiesUtil
        .getPropertyValue(
            serviceReference,
            overridingProperties,
            org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID);
    if (endpointId == null)
      endpointId = UUID.randomUUID().toString();
    endpointDescriptionProperties
        .put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID,
            endpointId);

    // ECF ENDPOINT ID
    String ecfEndpointId = (String) PropertiesUtil.getPropertyValue(
        serviceReference, overridingProperties,
        RemoteConstants.ENDPOINT_ID);
    if (ecfEndpointId == null)
      ecfEndpointId = containerID.getName();
    endpointDescriptionProperties.put(RemoteConstants.ENDPOINT_ID,
        ecfEndpointId);
       
    // ENDPOINT_SERVICE_ID
    // This is always set to the value from serviceReference as per 122.5.1
    Long serviceId = (Long) serviceReference
        .getProperty(org.osgi.framework.Constants.SERVICE_ID);
    endpointDescriptionProperties.put(
        org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID, serviceId);

    // ENDPOINT_FRAMEWORK_ID
    String frameworkId = (String) PropertiesUtil
        .getPropertyValue(
            serviceReference,
            overridingProperties,
            org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID);
    if (frameworkId == null)
      frameworkId = Activator.getDefault().getFrameworkUUID();
    endpointDescriptionProperties
        .put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID,
            frameworkId);

    // REMOTE_CONFIGS_SUPPORTED
    String[] remoteConfigsSupported = getSupportedConfigs(container.getID());
    if (remoteConfigsSupported != null)
      endpointDescriptionProperties
          .put(org.osgi.service.remoteserviceadmin.RemoteConstants.REMOTE_CONFIGS_SUPPORTED,
              remoteConfigsSupported);
    // SERVICE_IMPORTED_CONFIGS...set to constant value for all ECF
    // providers
    // supported (which is computed
    // for the exporting ECF container
    endpointDescriptionProperties
        .put(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS,
            remoteConfigsSupported);

    // SERVICE_INTENTS
    Object intents = PropertiesUtil
        .getPropertyValue(
            null,
            overridingProperties,
            org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS);
    if (intents == null)
      intents = serviceIntents;
    if (intents != null)
      endpointDescriptionProperties
          .put(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS,
              intents);

    // REMOTE_INTENTS_SUPPORTED
    String[] remoteIntentsSupported = getSupportedIntents(container.getID());
    if (remoteIntentsSupported != null)
      endpointDescriptionProperties
          .put(org.osgi.service.remoteserviceadmin.RemoteConstants.REMOTE_INTENTS_SUPPORTED,
              remoteIntentsSupported);

    // ECF properties
    // ID namespace
    String idNamespace = containerID.getNamespace().getName();
    endpointDescriptionProperties.put(
        RemoteConstants.ENDPOINT_CONTAINER_ID_NAMESPACE, idNamespace);
   
    // timestamp
    endpointDescriptionProperties.put(RemoteConstants.ENDPOINT_TIMESTAMP, System.currentTimeMillis());
   
    // ENDPOINT_CONNECTTARGET_ID
    String connectTarget = (String) PropertiesUtil.getPropertyValue(
        serviceReference, overridingProperties,
        RemoteConstants.ENDPOINT_CONNECTTARGET_ID);
    if (connectTarget == null && isClient(container)) {
      ID connectedID = container.getConnectedID();
      if (connectedID != null && !connectedID.equals(containerID))
        connectTarget = connectedID.getName();
    }
    if (connectTarget != null)
      endpointDescriptionProperties.put(
          RemoteConstants.ENDPOINT_CONNECTTARGET_ID, connectTarget);
View Full Code Here

      throw new NullPointerException(
          "getProxyServiceFactoryContext returned null.  Cannot register proxy service factory"); //$NON-NLS-1$

    final IRemoteServiceContainerAdapter containerAdapter = rsContainer
        .getContainerAdapter();
    ID rsContainerID = rsContainer.getContainer().getID();
    // First get IRemoteService for selectedRsReference
    final IRemoteService rs = containerAdapter
        .getRemoteService(selectedRsReference);
    if (rs == null)
      throw new NullPointerException(
View Full Code Here

    // Get ECF endpoint ID...if this throws IDCreateException (because the
    // local system does not have
    // namespace for creating ID, or no namespace is present in
    // endpointDescription or endpoint id,
    // then it will be caught by the caller
    ID endpointContainerID = endpointDescription.getContainerID();
    Assert.isNotNull(endpointContainerID);
    // Get connect target ID. May be null
    ID tID = endpointDescription.getConnectTargetID();
    if (tID == null)
      tID = endpointContainerID;
    final ID targetID = tID;
    // Get idFilter...also may be null
    final ID[] idFilter = getIDFilter(endpointDescription,
        endpointContainerID);
    // Get remote service filter
    final String rsFilter = getRemoteServiceFilter(endpointDescription);
    // IRemoteServiceReferences from query
    Collection<IRemoteServiceReference> rsRefs = new ArrayList<IRemoteServiceReference>();
    // Get IRemoteServiceContainerAdapter
    final IRemoteServiceContainerAdapter containerAdapter = rsContainer
        .getContainerAdapter();
    // rsContainerID
    ID rsContainerID = rsContainer.getContainer().getID();
    try {
      // Get first interface name for service reference
      // lookup
      final String intf = interfaces.iterator().next();
      // Get/lookup remote service references
View Full Code Here

          .equals(serviceReference);
      // If the second parameter is null, then we compare only on service
      // references
      if (containerID == null)
        return serviceReferenceCompare;
      ID ourContainerID = getContainerID();
      if (ourContainerID == null)
        return false;
      return serviceReferenceCompare
          && ourContainerID.equals(containerID);
    }
View Full Code Here

      return (closed)?null:exportReference.getEndpointDescription();
    }

    public void close() {
      boolean publish = false;
      ID containerID = null;
      Throwable exception = null;
      EndpointDescription endpointDescription = null;
      ExportReference exRef = null;
      synchronized (this) {
        // Only do this once
View Full Code Here

      return (closed)?null:importReference;
    }

    public void close() {
      boolean publish = false;
      ID containerID = null;
      Throwable exception = null;
      EndpointDescription endpointDescription = null;
      ImportReference imRef = null;
      synchronized (this) {
        // only do this once
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.core.identity.ID

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.