Package org.eclipse.ecf.core.util

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


      if (e.getXMPPError() != null && e.getXMPPError().getCode() == 404) {
        message = Messages.XMPPContainer_UNRECOGONIZED_SEARCH_SERVICE;
      } else {
        message = e.getLocalizedMessage();
      }
      throw new ECFException(message, e);
    }

  }
View Full Code Here


      throws InterruptedException, ECFException {
    if (containerID == null && cause == null)
      wait(timeout);

    if (cause != null)
      throw new ECFException(cause);

    return containerID;
  }
View Full Code Here

      // Get clazz from reference
      final String[] clazzes = getInterfaceClassNames();
      for (int i = 0; i < clazzes.length; i++)
        classes.add(loadInterfaceClass(cl, clazzes[i]));
    } catch (final Exception e) {
      ECFException except = new ECFException("Failed to create proxy", e); //$NON-NLS-1$
      logWarning("Exception in remote service getProxy", except); //$NON-NLS-1$
      throw except;
    } catch (final NoClassDefFoundError e) {
      ECFException except = new ECFException("Failed to load proxy interface class", e); //$NON-NLS-1$
      logWarning("Could not load class for getProxy", except); //$NON-NLS-1$
      throw except;
    }
    return getProxy(cl, (Class[]) classes.toArray(new Class[classes.size()]));
  }
View Full Code Here

    addRemoteServiceProxyToProxy(classes);
    // create and return proxy
    try {
      return createProxy(cl, (Class[]) classes.toArray(new Class[classes.size()]));
    } catch (final Exception e) {
      ECFException except = new ECFException("Failed to create proxy", e); //$NON-NLS-1$
      logWarning("Exception in remote service getProxy", except); //$NON-NLS-1$
      throw except;
    } catch (final NoClassDefFoundError e) {
      ECFException except = new ECFException("Failed to load proxy interface class", e); //$NON-NLS-1$
      logWarning("Could not load class for getProxy", except); //$NON-NLS-1$
      throw except;
    }
  }
View Full Code Here

    if (fact == null)
      fact = SocketFactory.getDefaultSocketFactory();
    try {
      return fact.createSocket(remote.getHost(), remote.getPort(), timeout);
    } catch (IOException e) {
      throw new ECFException("Could not create socket to connect to id=" + remote); //$NON-NLS-1$
    }
  }
View Full Code Here

   */
  protected URI parseRemoteID(ID remote) throws ECFException {
    try {
      return new URI(remote.getName());
    } catch (final URISyntaxException e) {
      throw new ECFException("Invalid URI for remoteID=" + remote, e); //$NON-NLS-1$
    }
  }
View Full Code Here

  }

  public synchronized Object connect(ID remote, Object data, int timeout) throws ECFException {
    debug("connect(" + remote + "," + data + "," + timeout + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    if (socket != null)
      throw new ECFException("Already connected"); //$NON-NLS-1$
    if (remote == null)
      throw new ECFException("remote cannot be null"); //$NON-NLS-1$
    // parse remote ID to URI
    URI anURI = parseRemoteID(remote);
    // Create socket by calling createSocket
    final Socket s = createConnectSocket(anURI, timeout);
    ConnectResultMessage res = null;
    try {
      // Set socket options
      setSocketOptions(s);
      // Now we've got a connection so set our socket
      setSocket(s);
      outputStream = new ObjectOutputStream(s.getOutputStream());
      outputStream.flush();
      inputStream = new ObjectInputStream(s.getInputStream());
      debug("connect;" + anURI); //$NON-NLS-1$
      // send connect data and get synchronous response
      send(new ConnectRequestMessage(anURI, (Serializable) data));
      res = (ConnectResultMessage) readObject();
    } catch (final IOException e) {
      throw new ECFException("Exception during connection to " + remote.getName(), e); //$NON-NLS-1$
    }
    debug("connect;rcv:" + res); //$NON-NLS-1$
    if (res == null)
      throw new ECFException("Result cannot be null"); //$NON-NLS-1$
    // Setup threads
    setupThreads();
    // Return results.
    final Object ret = res.getData();
    debug("connect;returning:" + ret); //$NON-NLS-1$
View Full Code Here

  }

  public synchronized Object connect(ID remote, Object data, int timeout) throws ECFException {
    debug("connect(" + remote + "," + data + "," + timeout + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    if (socket != null)
      throw new ECFException("Already connected"); //$NON-NLS-1$
    // parse URI
    URI anURI = null;
    try {
      anURI = new URI(remote.getName());
    } catch (final URISyntaxException e) {
      throw new ECFException("Invalid URI for remoteID=" + remote, e); //$NON-NLS-1$
    }
    ConnectResultMessage res = null;
    try {
      final Socket s = createSocket(anURI.getHost(), anURI.getPort(), timeout);
      // Set socket options
      setSocketOptions(s);
      // Now we've got a connection so set our socket
      setSocket(s);
      outputStream = new ObjectOutputStream(s.getOutputStream());
      outputStream.flush();
      inputStream = new ObjectInputStream(s.getInputStream());
      debug("connect;" + anURI); //$NON-NLS-1$
      // send connect data and get synchronous response
      send(new ConnectRequestMessage(anURI, (Serializable) data));
      res = (ConnectResultMessage) readObject();
    } catch (final Exception e) {
      throw new ECFException("Exception during connection to " + remote.getName(), e); //$NON-NLS-1$
    }
    debug("connect;rcv:" + res); //$NON-NLS-1$
    // Setup threads
    setupThreads();
    // Return results.
View Full Code Here

  public void setupPresence() throws ECFException {
    if (presence == null) {
      presence = (IPresenceContainerAdapter) container
          .getAdapter(IPresenceContainerAdapter.class);
      if (presence == null) throw new ECFException("adapter is null");
      sender = presence.getChatManager().getChatMessageSender();
      presence.getChatManager().addMessageListener(
          new IIMMessageListener() {
            public void handleMessageEvent(
                IIMMessageEvent messageEvent) {
View Full Code Here

  private XMPPID getXMPPID(ID remote) throws ECFException {
    XMPPID jabberID = null;
    try {
      jabberID = (XMPPID) remote;
    } catch (final ClassCastException e) {
      throw new ECFException(e);
    }
    return jabberID;
  }
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.