Package org.eclipse.ecf.core

Examples of org.eclipse.ecf.core.ContainerConnectException


   * @see org.eclipse.ecf.core.IContainer#connect(org.eclipse.ecf.core.identity.ID,
   *      org.eclipse.ecf.core.security.IConnectContext)
   */
  public void connect(ID targetID, IConnectContext connectContext) throws ContainerConnectException {
    if (!targetID.getNamespace().getName().equals(getConnectNamespace().getName()))
      throw new ContainerConnectException("targetID not of appropriate Namespace");

    fireContainerEvent(new ContainerConnectingEvent(getID(), targetID));

    // XXX connect to remote service here

View Full Code Here


   *
   * @see org.eclipse.ecf.provider.generic.SOContainer#connect(org.eclipse.ecf.core.identity.ID,
   *      org.eclipse.ecf.core.security.IConnectContext)
   */
  public void connect(ID groupID, IConnectContext joinContext) throws ContainerConnectException {
    final ContainerConnectException e = new ContainerConnectException("Server container cannot connect"); //$NON-NLS-1$
    throw e;
  }
View Full Code Here

      connection.login(username, (String) data, serverResource);

      waitForBindResult();

    } catch (final XMPPException e) {
      throw new ContainerConnectException("Login attempt failed", e);
    }
    return jid;
  }
View Full Code Here

  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

    return IDFactory.getDefault().getNamespaceByName(XmppPlugin.getDefault().getRoomNamespaceIdentifier());
  }

  public void connect(ID remote, IConnectContext connectContext) throws ContainerConnectException {
    if (!(remote instanceof XMPPRoomID)) {
      throw new ContainerConnectException(NLS.bind(Messages.XMPPChatRoomContainer_Exception_Connect_Wrong_Type, remote));
    }
    final XMPPRoomID roomID = (XMPPRoomID) remote;
    fireContainerEvent(new ContainerConnectingEvent(this.getID(), remote, connectContext));
    synchronized (getConnectLock()) {
      try {
        connectionState = CONNECTING;
        remoteServerID = null;
        addSharedObjectToContainer(remote);
        multiuserchat = new MultiUserChat(getXMPPConnection(), roomID.getMucString());
        // Get nickname from join context
        String nick = null;
        try {
          final Callback[] callbacks = new Callback[1];
          callbacks[0] = new NameCallback(Messages.XMPPChatRoomContainer_NAME_CALLBACK_NICK, roomID.getNickname());
          if (connectContext != null) {
            final CallbackHandler handler = connectContext.getCallbackHandler();
            if (handler != null) {
              handler.handle(callbacks);
            }
          }
          if (callbacks[0] instanceof NameCallback) {
            final NameCallback cb = (NameCallback) callbacks[0];
            nick = cb.getName();
          }
        } catch (final Exception e) {
          throw new ContainerConnectException(Messages.XMPPChatRoomContainer_EXCEPTION_CALLBACKHANDLER, e);
        }
        String nickname = null;
        if (nick == null || nick.equals("")) //$NON-NLS-1$
          nickname = roomID.getNickname();
        else
          nickname = nick;
        multiuserchat.addSubjectUpdatedListener(new SubjectUpdatedListener() {
          public void subjectUpdated(String subject, String from) {
            fireSubjectUpdated(subject, from);
          }
        });

        multiuserchat.addMessageListener(new PacketListener() {
          public void processPacket(Packet arg0) {
            handleXMPPMessage(arg0);
          }
        });
        multiuserchat.addParticipantListener(new PacketListener() {
          public void processPacket(Packet arg0) {
            handleXMPPMessage(arg0);
          }
        });
        multiuserchat.addParticipantStatusListener(new ParticipantStatusListener() {
          public void joined(String arg0) {
            handleChatMembershipEvent(arg0, true);
          }

          public void left(String arg0) {
            handleChatMembershipEvent(arg0, false);
          }

          public void voiceGranted(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("voiceGranted(" + arg0 + ")"); //$NON-NLS-1$ //$NON-NLS-2$
          }

          public void voiceRevoked(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("voiceRevoked(" + arg0 + ")"); //$NON-NLS-1$ //$NON-NLS-2$
          }

          public void membershipGranted(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("membershipGranted(" + arg0 //$NON-NLS-1$
                + ")"); //$NON-NLS-1$
          }

          public void membershipRevoked(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("membershipRevoked(" + arg0 //$NON-NLS-1$
                + ")"); //$NON-NLS-1$
          }

          public void moderatorGranted(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("moderatorGranted(" + arg0 //$NON-NLS-1$
                + ")"); //$NON-NLS-1$
          }

          public void moderatorRevoked(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("moderatorRevoked(" + arg0 //$NON-NLS-1$
                + ")"); //$NON-NLS-1$
          }

          public void ownershipGranted(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("ownershipGranted(" + arg0 //$NON-NLS-1$
                + ")"); //$NON-NLS-1$
          }

          public void ownershipRevoked(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("ownershipRevoked(" + arg0 //$NON-NLS-1$
                + ")"); //$NON-NLS-1$
          }

          public void adminGranted(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("adminGranted(" + arg0 + ")"); //$NON-NLS-1$ //$NON-NLS-2$
          }

          public void adminRevoked(String arg0) {
            // TODO Auto-generated method stub
            System.out.println("adminRevoked(" + arg0 + ")"); //$NON-NLS-1$ //$NON-NLS-2$
          }

          public void kicked(String arg0, String arg1, String arg2) {
            // TODO Auto-generated method stub
            System.out.println("kicked(" + arg0 + "," //$NON-NLS-1$ //$NON-NLS-2$
                + arg1 + "," + arg2 + ")"); //$NON-NLS-1$ //$NON-NLS-2$

          }

          public void banned(String arg0, String arg1, String arg2) {
            // TODO Auto-generated method stub
            System.out.println("banned(" + arg0 + "," //$NON-NLS-1$ //$NON-NLS-2$
                + arg1 + "," + arg2 + ")"); //$NON-NLS-1$ //$NON-NLS-2$

          }

          public void nicknameChanged(String arg0, String arg1) {
            // TODO Auto-generated method stub
            System.out.println("nicknameChanged(" + arg0 //$NON-NLS-1$
                + "," + arg1 + ")"); //$NON-NLS-1$ //$NON-NLS-2$

          }
        });
        multiuserchat.addInvitationRejectionListener(new InvitationRejectionListener() {
          public void invitationDeclined(String arg0, String arg1) {
            // TODO Auto-generated method stub
            System.out.println("invitationDeclined(" + arg0 //$NON-NLS-1$
                + "," + arg1 + ")"); //$NON-NLS-1$ //$NON-NLS-2$
          }
        });
        multiuserchat.join(nickname);
        connectionState = CONNECTED;
        remoteServerID = roomID;
        containerHelper.setRoomID(remoteServerID);
        fireContainerEvent(new ContainerConnectedEvent(this.getID(), roomID));
      } catch (final Exception e) {
        cleanUpConnectFail();
        final ContainerConnectException ce = new ContainerConnectException(NLS.bind(Messages.XMPPChatRoomContainer_EXCEPTION_JOINING_ROOM, roomID));
        ce.setStackTrace(e.getStackTrace());
        throw ce;
      }
    }
  }
View Full Code Here

  public void connect(String groupName) throws ContainerConnectException {
    ID targetID = null;
    try {
      targetID = createChatRoomID(groupName);
    } catch (final IDCreateException e) {
      throw new ContainerConnectException(Messages.XMPPChatRoomContainer_EXCEPTION_CREATING_ROOM_ID, e);
    }
    this.connect(targetID, null);
  }
View Full Code Here

   * @see org.eclipse.ecf.core.IContainer#connect(org.eclipse.ecf.core.identity.ID,
   *      org.eclipse.ecf.core.security.IConnectContext)
   */
  public void connect(ID targetID, IConnectContext connectContext) throws ContainerConnectException {
    if (!targetID.getNamespace().getName().equals(getConnectNamespace().getName()))
      throw new ContainerConnectException("targetID not of appropriate Namespace");

    fireContainerEvent(new ContainerConnectingEvent(getID(), targetID));

    // XXX connect to remote service here

View Full Code Here

    IBBCredentials creds = getCredentialsFromConnectContext(connectContext);
    if (creds != null) {
      try {
        bb.login(creds);
      } catch (BBException e) {
        throw new ContainerConnectException(e);
      }
    }
  }
View Full Code Here

      }
      NameCallback nc = (NameCallback) callbacks[0];
      ObjectCallback cb = (ObjectCallback) callbacks[1];
      return new Credentials(nc.getName(), (String) cb.getObject());
    } catch (Exception e) {
      throw new ContainerConnectException(
          "Exception in CallbackHandler.handle(<callbacks>)", e);
    }
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.ecf.core.IContainer#connect(org.eclipse.ecf.core.identity.ID, org.eclipse.ecf.core.security.IConnectContext)
   */
  public void connect(ID aTargetID, IConnectContext connectContext) throws ContainerConnectException {
    if (targetID != null) {
      throw new ContainerConnectException("Already connected"); //$NON-NLS-1$
    }
    if (getConfig() == null) {
      throw new ContainerConnectException("Container has been disposed"); //$NON-NLS-1$
    }
    targetID = (aTargetID == null) ? getConfig().getID() : aTargetID;
    fireContainerEvent(new ContainerConnectingEvent(this.getID(), aTargetID, connectContext));
    fireContainerEvent(new ContainerConnectedEvent(this.getID(), aTargetID));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.core.ContainerConnectException

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.