Search in sources :

Example 1 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class ContainerStore method store.

/* (non-Javadoc)
	 * @see org.eclipse.ecf.storage.IContainerStore#store(org.eclipse.ecf.storage.IStorableContainerAdapter)
	 */
public IContainerEntry store(IStorableContainerAdapter containerAdapter) throws StorageException {
    String factoryName = containerAdapter.getContainerFactoryName();
    Assert.isNotNull(factoryName);
    ID containerID = containerAdapter.getID();
    Assert.isNotNull(containerID);
    IIDEntry idEntry = idStore.store(containerID);
    ContainerEntry containerEntry = new ContainerEntry(idEntry);
    try {
        containerEntry.setFactoryName(containerAdapter.getContainerFactoryName(), containerAdapter.storeEncrypted());
        containerAdapter.store(containerEntry.getPreferences());
        return containerEntry;
    } catch (StorageException e) {
        // Undo and return null
        containerEntry.delete();
        throw e;
    }
}
Also used : ID(org.eclipse.ecf.core.identity.ID) StorageException(org.eclipse.equinox.security.storage.StorageException)

Example 2 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class BaseChannel method initializeReplicaChannel.

/**
 * Initialize replicas of this channel. This method is only called if
 * isPrimary() returns false. It is called from within the initialize
 * method, immediately after super.initialize but before the listener for
 * this channel is notified of initialization. If this method throws a
 * SharedObjectInitException, then initialization of the replica is halted
 * and the remote transaction creating the replica will be aborted.
 * <p>
 * Note that this implementation checks for the existence of the
 * RECEIVER_ID_PROPERTY on the replica's properties, and if the property
 * contains a valid ID will
 * <ul>
 * <li>lookup the IChannel on the given container via
 * IChannelContainerAdapter.getID(ID)</li>
 * <li>call IChannel.getListener() to retrieve the listener for the channel
 * returned</li>
 * <li>set the listener for this object to the value returned from
 * IChannel.getListener()</li>
 * </ul>
 *
 * @throws SharedObjectInitException
 *             if the replica initialization should fail
 */
protected void initializeReplicaChannel() throws SharedObjectInitException {
    Map properties = getConfig().getProperties();
    ID rcvr = null;
    try {
        rcvr = (ID) properties.get(RECEIVER_ID_PROPERTY);
    } catch (ClassCastException e) {
        // $NON-NLS-1$
        throw new SharedObjectInitException("Receiver ID property value must be of type ID", e);
    }
    if (rcvr != null) {
        // Now...get local channel container first...throw if we can't get
        // it
        IChannelContainerAdapter container = (IChannelContainerAdapter) getContext().getAdapter(IChannelContainerAdapter.class);
        if (container == null)
            // $NON-NLS-1$
            throw new SharedObjectInitException("channel container adapter must not be null");
        // Now get receiver IChannel...throw if we can't get it
        final IChannel receiver = container.getChannel(rcvr);
        if (receiver == null)
            // $NON-NLS-1$
            throw new SharedObjectInitException("channel receiver must not be null");
        setChannelListener(receiver.getListener());
    }
}
Also used : ID(org.eclipse.ecf.core.identity.ID) Map(java.util.Map)

Example 3 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class ChatComposite method sendImage.

private void sendImage(final IUser toUser) {
    if (MessageDialog.openQuestion(null, MessageLoader.getString("ChatComposite.DIALOG_SCREEN_CAPTURE_TITLE"), MessageLoader.getString("ChatComposite.DIALOG_SCREEN_CAPTURE_TEXT"))) {
        // $NON-NLS-1$ //$NON-NLS-2$
        final Job job = new ScreenCaptureJob(getDisplay(), toUser.getID(), toUser.getNickname(), new IImageSender() {

            public void sendImage(ID targetID, ImageData imageData) {
                view.lch.sendImage(toUser.getID(), imageData);
            }
        });
        job.schedule(5000);
    }
}
Also used : IImageSender(org.eclipse.ecf.ui.screencapture.IImageSender) ID(org.eclipse.ecf.core.identity.ID) Job(org.eclipse.core.runtime.jobs.Job) ScreenCaptureJob(org.eclipse.ecf.ui.screencapture.ScreenCaptureJob) ScreenCaptureJob(org.eclipse.ecf.ui.screencapture.ScreenCaptureJob)

Example 4 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class ChatComposite method startProgram.

protected void startProgram(IUser ud) {
    String res = null;
    ID receiver = null;
    if (ud == null) {
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        res = getID(MessageLoader.getString("ChatComposite.START_PROGRAM_GROUP_TITLE"), MessageLoader.getString("ChatComposite.START_PROGRAM_GROUP_TEXT"), "");
    } else {
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        res = getID(MessageLoader.getFormattedString("ChatComposite.START_PROGRAM_TITLE", ud.getNickname()), MessageLoader.getFormattedString("ChatComposite.START_PROGRAM_TEXT", ud.getNickname()) + ":", "");
        receiver = ud.getID();
    }
    if (res != null)
        this.view.runProgram(receiver, res, null);
}
Also used : ID(org.eclipse.ecf.core.identity.ID)

Example 5 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class ChatComposite method readStreamAndSend.

protected void readStreamAndSend(java.io.InputStream local, String fileName, Date startDate, ID target, final boolean launch) {
    try {
        final ID eclipseStageID = IDFactory.getDefault().createStringID(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject.ID);
        final java.io.BufferedInputStream ins = new java.io.BufferedInputStream(local);
        final java.io.File remoteFile = new File((new File(fileName)).getName());
        final FileTransferParams sp = new FileTransferParams(remoteFile, getChunkPreference(), getDelayPreference(), null, true, -1, null);
        final Object[] args = { view, target, ins, sp, eclipseStageID };
        // Do it
        new Thread(new Runnable() {

            public void run() {
                if (launch) {
                    ChatComposite.this.view.createObject(null, org.eclipse.ecf.example.collab.share.io.EclipseFileTransferAndLaunch.class.getName(), new String[] { FileSenderUI.class.getName(), ID.class.getName(), java.io.InputStream.class.getName(), FileTransferParams.class.getName(), ID.class.getName() }, args);
                } else {
                    ChatComposite.this.view.createObject(null, org.eclipse.ecf.example.collab.share.io.EclipseFileTransfer.class.getName(), new String[] { FileSenderUI.class.getName(), ID.class.getName(), java.io.InputStream.class.getName(), FileTransferParams.class.getName(), ID.class.getName() }, args);
                }
            }
        }, "FileRepObject creator").start();
    } catch (final Exception e) {
        if (this.view.lch != null)
            // $NON-NLS-1$
            this.view.lch.chatException(e, "readStreamAndSend()");
    }
}
Also used : FileTransferParams(org.eclipse.ecf.example.collab.share.io.FileTransferParams) File(java.io.File) IOException(java.io.IOException) ID(org.eclipse.ecf.core.identity.ID) File(java.io.File) FileSenderUI(org.eclipse.ecf.example.collab.share.io.FileSenderUI)

Aggregations

ID (org.eclipse.ecf.core.identity.ID)256 IContainer (org.eclipse.ecf.core.IContainer)29 IOException (java.io.IOException)19 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)18 UUID (java.util.UUID)17 HashMap (java.util.HashMap)12 ArrayList (java.util.ArrayList)11 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)11 GUID (org.eclipse.ecf.core.identity.GUID)11 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)11 XMPPRoomID (org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID)11 Namespace (org.eclipse.ecf.core.identity.Namespace)10 XMPPID (org.eclipse.ecf.provider.xmpp.identity.XMPPID)10 Map (java.util.Map)9 Matcher (java.util.regex.Matcher)9 ECFException (org.eclipse.ecf.core.util.ECFException)9 List (java.util.List)8 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)8 IChannel (org.eclipse.ecf.datashare.IChannel)8 Iterator (java.util.Iterator)7