Package org.eclipse.ecf.core

Examples of org.eclipse.ecf.core.IContainer


        }
        addEditorListener();
    }

    private IRosterManager getLocalRosterManager() {
        IContainer container = (IContainer) this.adapter.getAdapter(IContainer.class);
        if (container != null) {
            IPresenceContainerAdapter presenceContainerAdapter = (IPresenceContainerAdapter) container
                    .getAdapter(IPresenceContainerAdapter.class);
            if (presenceContainerAdapter != null) {
                return presenceContainerAdapter.getRosterManager();
            }
        }
View Full Code Here


    public Object execute(ExecutionEvent event) throws ExecutionException {
        IRosterEntry rosterEntry = getRosterEntry();
        if (rosterEntry == null) return null;
       
        IRoster roster = rosterEntry.getRoster();
        IContainer container = (IContainer) roster.getPresenceContainerAdapter().getAdapter(IContainer.class);
        if (container.getConnectedID() == null)
            showErrorMessage("not connected.");
            SelectionShare sender = ECFContribution.getDefault().getStringShare(container.getID());
            if (sender == null)
                showErrorMessage("no sender.");
//            currently share anyway to be able do do better debugging
//            if (sender.isSharing())
//                showErrorMessage("sharing already started.");
View Full Code Here

        stopEditorShare.setImageDescriptor(getTopMenuImageDescriptor());
        return new IContributionItem[] {new Separator(), new ActionContributionItem(stopEditorShare)};
    }       

    protected SelectionShare getStringShareForPresenceContainerAdapter(IPresenceContainerAdapter presenceContainerAdapter) {
        final IContainer container = (IContainer) presenceContainerAdapter.getAdapter(IContainer.class);
        if (container == null)
            return null;
        return ECFContribution.getDefault().getStringShare(container.getID());
    }       
View Full Code Here

      }
    };
    updater.start();
    try {
      // make container instance
      IContainer cont = ContainerFactory.getDefault().createContainer("ecf.twitter");
      // make targetID      
      ID targetID;
      targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),"http://twitter.com/savino2");
      cont.connect(targetID,null);
    } catch (IDCreateException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ContainerConnectException e) {
      // TODO Auto-generated catch block
View Full Code Here

      }
    };
    updater.start();
    try {
      // make container instance
      IContainer cont = ContainerFactory.getDefault().createContainer("ecf.twitter");
      // make targetID
      ID targetID;
      targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),"savino2");
      cont.connect(targetID,null);
    } catch (IDCreateException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ContainerConnectException e) {
      // TODO Auto-generated catch block
View Full Code Here

      }
    };
    updater.start();
    try {
      // make container instance
      IContainer cont = ContainerFactory.getDefault().createContainer("ecf.twitter");
      // make targetID
      ID targetID;
      targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),"savino2");
      cont.connect(targetID,null);
    } catch (IDCreateException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ContainerConnectException e) {
      // TODO Auto-generated catch block
View Full Code Here

  private Map<String, Object> createExportEndpointDescriptionProperties(
      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(
View Full Code Here

      // connect the host container(s)
      Object target = overridingProperties
          .get(RemoteConstants.ENDPOINT_CONNECTTARGET_ID);
      if (target != null) {
        for (Iterator i = rsContainers.iterator(); i.hasNext();) {
          IContainer container = ((IRemoteServiceContainer) i.next())
              .getContainer();
          try {
            connectHostContainer(serviceReference,
                overridingProperties, container, target);
          } catch (Exception e) {
            logException("doConnectContainer failure containerID=" //$NON-NLS-1$
                + container.getID() + " target=" + target, e); //$NON-NLS-1$
          }
        }

      }
    }
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 {
        connectContainer(container, connectTargetID,
            getConnectContext(container, connectTargetID));
      } catch (ContainerConnectException e) {
        logException("Exception connecting container id=" //$NON-NLS-1$
            + container.getID() + " to connectTargetID=" //$NON-NLS-1$
            + connectTargetID, e);
      }
    }
  }
View Full Code Here

  protected IRemoteServiceContainer createContainer(
      ContainerTypeDescription containerTypeDescription,
      String containerTypeDescriptionName, Map properties)
      throws SelectContainerException {
    try {
      IContainer container = (properties == null) ? getContainerFactory()
          .createContainer(containerTypeDescriptionName)
          : getContainerFactory().createContainer(
              containerTypeDescriptionName, properties);
      IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container
          .getAdapter(IRemoteServiceContainerAdapter.class);
      if (adapter == null)
        throw new SelectContainerException(
            "Container does not implement IRemoteServiceContainerAdapter", null, containerTypeDescription); //$NON-NLS-1$
      return new RemoteServiceContainer(container);
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.core.IContainer

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.