Package org.eclipse.ecf.core.util

Examples of org.eclipse.ecf.core.util.ECFException


  }

  public synchronized Object connect(ID remote, Object data, int timeout)
      throws ECFException {
    if (connection != null)
      throw new ECFException("already connected");
    if (timeout > 0)
      SmackConfiguration.setPacketReplyTimeout(timeout);
    Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual);

    final XMPPID jabberURI = getXMPPID(remote);
View Full Code Here


    public byte[] createUpdate(ISharedDataGraph graph) throws ECFException {
        EDataGraph clone;
        try {
            clone = clone((EDataGraph) graph.getDataGraph());
        } catch (IOException e) {
            throw new ECFException(e);
        }

        EChangeSummary changes = (EChangeSummary) clone.getChangeSummary();
        changes.applyAndReverse();

        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        try {
            changes.eResource().save(buf, null);
            if (SDOPlugin.isTracing(TRACE_TAG)) {
                SDOPlugin.getTraceLog().println("commit:");
                changes.eResource().save(SDOPlugin.getTraceLog(), null);
            }
        } catch (IOException e) {
            throw new ECFException(e);
        }

        return buf.toByteArray();
    }
View Full Code Here

     *
     * @see org.eclipse.ecf.sdo.ISharedDataGraph#commit()
     */
    public synchronized void commit() throws ECFException {
        if (config == null)
            throw new ECFException("Object is disconnected.");

        if (dataGraph == null)
            throw new ECFException("Not subscribed.");

        ChangeSummary changeSummary = dataGraph.getChangeSummary();
        if (changeSummary.getChangedDataObjects().isEmpty())
            return;

        changeSummary.endLogging();
        byte[] data = updateProvider.createUpdate(this);
        try {
            config.getContext().sendMessage(null,
                    new UpdateDataGraphMessage(version, data));
        } catch (IOException e) {
            throw new ECFException(e);
        }

        changeSummary.beginLogging();
        version = version.getNext(config.getContext().getLocalContainerID());
    }
View Full Code Here

    public synchronized ISharedDataGraph publish(DataGraph dataGraph, ID id,
            IUpdateProvider provider, IUpdateConsumer consumer,
            IPublicationCallback callback) throws ECFException {

        if (config == null)
            throw new ECFException("Not initialized.");

        // create local object
        ISharedObjectManager mgr = config.getContext().getSharedObjectManager();
        SharedDataGraph sdg = new SharedDataGraph(dataGraph, provider,
                consumer, callback, null);
View Full Code Here

    public synchronized ISharedDataGraph subscribe(ID id,
            IUpdateProvider provider, IUpdateConsumer consumer,
            ISubscriptionCallback callback) throws ECFException {

        if (config == null)
            throw new ECFException("Not initialized.");

        // create local object
        ISharedObjectManager mgr = config.getContext().getSharedObjectManager();
        SharedDataGraph sdg = new SharedDataGraph(null, provider, consumer,
                null, callback);
View Full Code Here

    this.chatRoomAdminListeners = new ArrayList();
  }

  protected void sendInvitation(ID toUser, String subject, String body) throws ECFException {
    if (toUser == null)
      throw new ECFException(Messages.XMPPChatRoomContainer_EXCEPTION_TARGET_USER_NOT_NULL);
    synchronized (getConnectLock()) {
      if (multiuserchat == null)
        throw new ContainerConnectException(Messages.XMPPChatRoomContainer_EXCEPTION_NOT_CONNECTED);
      multiuserchat.invite(toUser.getName(), (body == null) ? "" : body); //$NON-NLS-1$
    }
View Full Code Here

      public void sendMessage(String messageBody) throws ECFException {
        if (multiuserchat != null) {
          try {
            multiuserchat.sendMessage(messageBody);
          } catch (final Exception e) {
            final ECFException except = new ECFException(Messages.XMPPChatRoomContainer_EXCEPTION_SEND_MESSAGE, e);
            throw except;
          }
        }
      }
    };
View Full Code Here

    synchronized (this) {
      if (chatRoomAdminSender == null) {
        chatRoomAdminSender = new IChatRoomAdminSender() {
          public void sendSubjectChange(String newsubject) throws ECFException {
            if (multiuserchat == null)
              throw new ECFException(Messages.XMPPChatRoomContainer_EXCEPTION_NOT_CONNECTED);
            try {
              multiuserchat.changeSubject(newsubject);
            } catch (final XMPPException e) {
              throw new ECFException(e);
            }
          }

        };
      }
View Full Code Here

      Method method = getMethodForService(call.getMethod(), svcClasses);
      if (method == null)
        throw new NullPointerException("Method " + call.getMethod() + " not found for registration=" + registration.getReference().getID()); //$NON-NLS-1$ //$NON-NLS-2$
      return method.invoke(service, call.getParameters());
    } catch (Exception e) {
      throw new ECFException("Exception invoking local service registration=" + registration.getReference().getID(), e); //$NON-NLS-1$
    }
  }
View Full Code Here

    }, null);
    Object result = null;
    try {
      result = future.get(call.getTimeout());
    } catch (OperationCanceledException e) {
      throw new ECFException("callSync cancelled", e); //$NON-NLS-1$
    } catch (InterruptedException e) {
      // If thread interrupted, then just return null
      return null;
    } catch (TimeoutException e) {
      throw new ECFException("callSync timed out after " + Long.toString(call.getTimeout()) + "ms", new TimeoutException(call.getTimeout())); //$NON-NLS-1$ //$NON-NLS-2$
    }
    IStatus status = future.getStatus();
    if (!status.isOK())
      throw new ECFException("Exception during callSync", status.getException()); //$NON-NLS-1$
    return result;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.core.util.ECFException

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.