Search in sources :

Example 41 with ECFException

use of org.eclipse.ecf.core.util.ECFException in project ecf by eclipse.

the class XMPPChatRoomManager method sendInvitation.

/**
 * @param room
 * @param targetUser
 * @param subject
 * @param body
 */
protected void sendInvitation(ID room, ID targetUser, String subject, String body) throws ECFException {
    final XMPPChatRoomContainer chatRoomContainer = getChatRoomContainer(room);
    if (chatRoomContainer == null)
        throw new ECFException(NLS.bind(Messages.XMPPChatRoomManager_ROOM_NOT_FOUND, room.getName()));
    chatRoomContainer.sendInvitation(targetUser, subject, body);
}
Also used : ECFException(org.eclipse.ecf.core.util.ECFException)

Example 42 with ECFException

use of org.eclipse.ecf.core.util.ECFException in project ecf by eclipse.

the class XMPPUserSearchManager method getUserPropertiesFields.

/**
 * Returns the user properties fields available on the XMPP server
 *
 * @param form
 * @return String[] fields for form
 * @throws ECFException
 */
public String[] getUserPropertiesFields() throws ECFException {
    try {
        if (form == null)
            form = manager.getSearchForm(ecfConnection.getXMPPConnection(), SERVICE_SEARCH + ecfConnection.getXMPPConnection().getServiceName());
        Set fields = new HashSet();
        Iterator userProperties = form.getFields();
        while (userProperties.hasNext()) {
            FormField field = (FormField) userProperties.next();
            String variable = field.getVariable();
            // ignore these fields
            if (!variable.equalsIgnoreCase(FORM_TYPE) && !variable.equalsIgnoreCase(SEARCH_ACTION))
                fields.add(variable);
        }
        return (String[]) fields.toArray(new String[0]);
    } catch (final XMPPException e) {
        String message = null;
        if (e.getXMPPError() != null && e.getXMPPError().getCode() == 404) {
            message = Messages.XMPPContainer_UNRECOGONIZED_SEARCH_SERVICE;
        } else {
            message = e.getLocalizedMessage();
        }
        throw new ECFException(message, e);
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) ECFException(org.eclipse.ecf.core.util.ECFException) Iterator(java.util.Iterator) XMPPException(org.jivesoftware.smack.XMPPException) FormField(org.jivesoftware.smackx.FormField) HashSet(java.util.HashSet)

Aggregations

ECFException (org.eclipse.ecf.core.util.ECFException)42 IRemoteService (org.eclipse.ecf.remoteservice.IRemoteService)9 Iterator (java.util.Iterator)5 IStatus (org.eclipse.core.runtime.IStatus)5 ID (org.eclipse.ecf.core.identity.ID)5 Status (org.eclipse.core.runtime.Status)4 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)4 IOException (java.io.IOException)3 IContainer (org.eclipse.ecf.core.IContainer)3 Action (org.eclipse.jface.action.Action)3 IAction (org.eclipse.jface.action.IAction)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 List (java.util.List)2 TimeoutException (java.util.concurrent.TimeoutException)2 Namespace (org.eclipse.ecf.core.identity.Namespace)2 IConnectContext (org.eclipse.ecf.core.security.IConnectContext)2 IUser (org.eclipse.ecf.core.user.IUser)2 IChatRoomInfo (org.eclipse.ecf.presence.chatroom.IChatRoomInfo)2 IEcho (org.eclipse.ecf.tests.remoteservice.rpc.common.IEcho)2