Search in sources :

Example 86 with IContainer

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

the class GenericConcatConsumerTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    IContainer container = createContainer();
    rsContainer = createRemoteServiceContainer(container);
    targetID = createID(container, Generic.HOST_CONTAINER_ENDPOINT_ID);
}
Also used : IContainer(org.eclipse.ecf.core.IContainer)

Example 87 with IContainer

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

the class ContainerStoreTest method testStoreContainer.

public ID testStoreContainer() throws Exception {
    final IContainer container = createContainer();
    final IContainerEntry containerEntry = storeContainer(getStorableContainerAdapter(container));
    final ISecurePreferences prefs = containerEntry.getPreferences();
    assertNotNull(prefs);
    return container.getID();
}
Also used : ISecurePreferences(org.eclipse.equinox.security.storage.ISecurePreferences) IContainer(org.eclipse.ecf.core.IContainer) IContainerEntry(org.eclipse.ecf.storage.IContainerEntry)

Example 88 with IContainer

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

the class GenericServerTest method testGetRemoteServiceContainerAdapter.

public void testGetRemoteServiceContainerAdapter() throws Exception {
    IContainer container = server.getFirstServerContainer();
    assertNotNull(container);
    IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
    assertNotNull(adapter);
}
Also used : IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) IContainer(org.eclipse.ecf.core.IContainer)

Example 89 with IContainer

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

the class GetFileHandler method openStartFileDownloadDialog.

public void openStartFileDownloadDialog(final Shell shell, String url) {
    StartFileDownloadDialog dialog = new StartFileDownloadDialog(shell, url);
    if (dialog.open() == Window.OK) {
        final String scp = dialog.getValue();
        final String userid = dialog.userid;
        final String passwd = dialog.passwd;
        final String fileName = dialog.filename;
        new Job(SCP_JOB_FAMILY) {

            protected IStatus run(final IProgressMonitor monitor) {
                try {
                    final IContainer container = ContainerFactory.getDefault().createContainer();
                    IRetrieveFileTransferContainerAdapter adapter = (IRetrieveFileTransferContainerAdapter) container.getAdapter(IRetrieveFileTransferContainerAdapter.class);
                    final FileOutputStream out = new FileOutputStream(fileName);
                    IFileTransferListener listener = new IFileTransferListener() {

                        IIncomingFileTransfer incoming = null;

                        public void handleTransferEvent(IFileTransferEvent event) {
                            if (event instanceof IIncomingFileTransferReceiveStartEvent) {
                                IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
                                try {
                                    incoming = rse.receive(out);
                                    addTransferToView(shell, incoming, fileName);
                                } catch (IOException e) {
                                    // $NON-NLS-1$
                                    Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "failed to set output file", e));
                                }
                            } else if (event instanceof IIncomingFileTransferReceiveDataEvent) {
                                updateTransferInView(shell, incoming);
                            } else if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
                                try {
                                    out.close();
                                } catch (IOException e) {
                                    // $NON-NLS-1$
                                    Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "failed to close output file", e));
                                }
                                completeTransferInView(shell, incoming);
                            }
                        }
                    };
                    adapter.setConnectContextForAuthentication(ConnectContextFactory.createUsernamePasswordConnectContext(userid, passwd));
                    monitor.beginTask(SCP_JOB_FAMILY, IProgressMonitor.UNKNOWN);
                    adapter.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(adapter.getRetrieveNamespace(), scp), listener, null);
                } catch (Exception e) {
                    monitor.done();
                    // $NON-NLS-1$
                    return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "get file failed", e);
                }
                monitor.done();
                return Status.OK_STATUS;
            }
        }.schedule();
    }
}
Also used : IOException(java.io.IOException) IOException(java.io.IOException) FileOutputStream(java.io.FileOutputStream) Job(org.eclipse.core.runtime.jobs.Job) IContainer(org.eclipse.ecf.core.IContainer)

Example 90 with IContainer

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

the class DocShareRosterMenuHandler method execute.

/**
 * @throws ExecutionException
 */
public Object execute(ExecutionEvent arg0) throws ExecutionException {
    IRosterEntry rosterEntry = getRosterEntry();
    if (rosterEntry != null) {
        IRoster roster = rosterEntry.getRoster();
        final IContainer container = (IContainer) roster.getPresenceContainerAdapter().getAdapter(IContainer.class);
        if (container.getConnectedID() == null)
            showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NOT_CONNECTED);
        final DocShare sender = Activator.getDefault().getDocShare(container.getID());
        if (sender == null)
            showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NO_SENDER);
        if (sender.isSharing())
            showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_EDITOR_ALREADY_SHARING);
        final ITextEditor textEditor = getTextEditor();
        if (textEditor == null)
            showErrorMessage(Messages.DocShareRosterMenuHandler_EXCEPTION_EDITOR_NOT_TEXT);
        final String inputName = getInputName(textEditor);
        if (inputName == null)
            showErrorMessage(Messages.DocShareRosterMenuHandler_NO_FILENAME_WITH_CONTENT);
        final IUser user = roster.getUser();
        sender.startShare(user.getID(), user.getName(), rosterEntry.getUser().getID(), inputName, textEditor);
    }
    return null;
}
Also used : IRoster(org.eclipse.ecf.presence.roster.IRoster) DocShare(org.eclipse.ecf.docshare.DocShare) ITextEditor(org.eclipse.ui.texteditor.ITextEditor) IUser(org.eclipse.ecf.core.user.IUser) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) 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