Search in sources :

Example 31 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class URLRosterViewerDropTarget method getURLShare.

private URLShare getURLShare(IRosterEntry rosterEntry1) {
    final IPresenceContainerAdapter pca = rosterEntry1.getRoster().getPresenceContainerAdapter();
    if (pca == null)
        return null;
    final IContainer container = (IContainer) pca.getAdapter(IContainer.class);
    if (container == null)
        return null;
    return URLShare.getURLShare(container.getID());
}
Also used : IPresenceContainerAdapter(org.eclipse.ecf.presence.IPresenceContainerAdapter) IContainer(org.eclipse.ecf.core.IContainer)

Example 32 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class URLShareRosterContributionItem method makeActions.

protected IAction[] makeActions() {
    final IRoster roster = getSelectedRoster();
    if (roster != null) {
        // Roster is selected
        final IContainer c = getContainerForRoster(roster);
        if (c != null) {
            // Get existing urlshare for this container (if it exists)
            final URLShare urlshare = URLShare.getURLShare(c.getID());
            // If it does exist already, then create action to remove
            if (urlshare != null)
                return createActionRemove(c.getID(), urlshare);
            final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
            return (channelAdapter == null) ? null : createActionAdd(c.getID(), channelAdapter);
        }
    }
    return null;
}
Also used : IRoster(org.eclipse.ecf.presence.roster.IRoster) IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter) IContainer(org.eclipse.ecf.core.IContainer)

Example 33 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class ViewShareRosterContributionItem method makeActions.

protected IAction[] makeActions() {
    final IRoster roster = getSelectedRoster();
    if (roster != null) {
        // Roster is selected
        final IContainer c = getContainerForRoster(roster);
        if (c != null) {
            // Get existing ViewShare for this container (if it exists)
            final ViewShare viewShare = ViewShare.getViewShare(c.getID());
            // If it does exist already, then create action to remove
            if (viewShare != null)
                return createActionRemove(c.getID(), viewShare);
            final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
            return (channelAdapter == null) ? null : createActionAdd(c.getID(), channelAdapter);
        }
    }
    return null;
}
Also used : IRoster(org.eclipse.ecf.presence.roster.IRoster) IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter) IContainer(org.eclipse.ecf.core.IContainer)

Example 34 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class SSLSimpleConcatClient method start.

public void start(int port) throws Exception {
    IContainer client = ContainerFactory.getDefault().createContainer(CLIENT_TYPE);
    // Get adapter for accessing remote services
    IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) client.getAdapter(IRemoteServiceContainerAdapter.class);
    rsContainer = new RemoteServiceContainer(client, adapter);
    System.out.println("Client created with ID=" + client.getID());
    ID connectTargetID = IDFactory.getDefault().createStringID(NLS.bind(SERVER_ID, new Integer(port)));
    System.out.println("Attempting connect to id=" + connectTargetID);
    client.connect(connectTargetID, null);
    System.out.println("Client connected to connectTargetID=" + connectTargetID);
    Thread.sleep(1000);
    // Get remote service reference
    IRemoteServiceReference[] refs = adapter.getRemoteServiceReferences((ID[]) null, IConcatService.class.getName(), null);
    rsReference = refs[0];
    System.out.println("Remote service with ref=" + refs[0]);
}
Also used : IRemoteServiceReference(org.eclipse.ecf.remoteservice.IRemoteServiceReference) IConcatService(org.eclipse.ecf.tests.remoteservice.IConcatService) RemoteServiceContainer(org.eclipse.ecf.remoteservice.RemoteServiceContainer) IRemoteServiceContainer(org.eclipse.ecf.remoteservice.IRemoteServiceContainer) IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Example 35 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class GenericAuthConsumerContainerSelector method createContainer.

@Override
protected IRemoteServiceContainer createContainer(ContainerTypeDescription containerTypeDescription, String containerTypeDescriptionName, @SuppressWarnings("rawtypes") Map properties) throws SelectContainerException {
    IRemoteServiceContainer result = super.createContainer(containerTypeDescription, containerTypeDescriptionName, properties);
    ISharedObjectContainerClient client = (ISharedObjectContainerClient) result.getContainer().getAdapter(ISharedObjectContainerClient.class);
    if (client != null) {
        client.setConnectInitiatorPolicy(new IConnectInitiatorPolicy() {

            public void refresh() {
            }

            public Object createConnectData(IContainer container, ID targetID, IConnectContext context) {
                // to the server.
                return getConnectData();
            }

            public int getConnectTimeout() {
                return 30000;
            }
        });
    }
    return result;
}
Also used : IRemoteServiceContainer(org.eclipse.ecf.remoteservice.IRemoteServiceContainer) IConnectContext(org.eclipse.ecf.core.security.IConnectContext) ISharedObjectContainerClient(org.eclipse.ecf.core.sharedobject.ISharedObjectContainerClient) IConnectInitiatorPolicy(org.eclipse.ecf.core.security.IConnectInitiatorPolicy) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Aggregations

IContainer (org.eclipse.ecf.core.IContainer)121 ID (org.eclipse.ecf.core.identity.ID)29 ContainerTypeDescription (org.eclipse.ecf.core.ContainerTypeDescription)20 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)9 IRoster (org.eclipse.ecf.presence.roster.IRoster)8 IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)7 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)7 IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)7 ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)5 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)5 RemoteServiceContainer (org.eclipse.ecf.remoteservice.RemoteServiceContainer)5 Action (org.eclipse.jface.action.Action)5 IAction (org.eclipse.jface.action.IAction)5 URL (java.net.URL)4 Job (org.eclipse.core.runtime.jobs.Job)4 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)4 IContainerManager (org.eclipse.ecf.core.IContainerManager)4 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)4 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)4 RestClientContainer (org.eclipse.ecf.remoteservice.rest.client.RestClientContainer)4