Search in sources :

Example 6 with ECFException

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

the class AbstractRemoteService method getProxy.

/**
 * @since 6.0
 */
@SuppressWarnings("unchecked")
public Object getProxy(ClassLoader cl, Class[] interfaces) throws ECFException {
    // Now add any async p
    List classes = addAsyncProxyClasses(cl, interfaces);
    addRemoteServiceProxyToProxy(classes);
    // create and return proxy
    try {
        return createProxy(cl, (Class[]) classes.toArray(new Class[classes.size()]));
    } catch (final Exception e) {
        // $NON-NLS-1$
        ECFException except = new ECFException("Failed to create proxy", e);
        // $NON-NLS-1$
        logWarning("Exception in remote service getProxy", except);
        throw except;
    } catch (final NoClassDefFoundError e) {
        // $NON-NLS-1$
        ECFException except = new ECFException("Failed to load proxy interface class", e);
        // $NON-NLS-1$
        logWarning("Could not load class for getProxy", except);
        throw except;
    }
}
Also used : ECFException(org.eclipse.ecf.core.util.ECFException) ECFException(org.eclipse.ecf.core.util.ECFException) ServiceException(org.osgi.framework.ServiceException) TimeoutException(java.util.concurrent.TimeoutException)

Example 7 with ECFException

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

the class MSNContainer method sendChatMessage.

public void sendChatMessage(ID toID, String body) throws ECFException {
    try {
        ChatSession cs = (ChatSession) chatSessions.get(toID);
        if (cs == null) {
            cs = client.createChatSession(toID.getName());
            cs.addChatSessionListener(new ChatSessionListener(toID));
            chatSessions.put(toID, cs);
        }
        cs.sendMessage(body);
    } catch (IOException e) {
        throw new ECFException(e);
    }
}
Also used : IChatSessionListener(org.eclipse.ecf.protocol.msn.events.IChatSessionListener) ECFException(org.eclipse.ecf.core.util.ECFException) IOException(java.io.IOException) ChatSession(org.eclipse.ecf.protocol.msn.ChatSession)

Example 8 with ECFException

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

the class LocalRemoteServiceRegistry method callSynch.

protected Object callSynch(RemoteServiceRegistrationImpl registration, IRemoteCall call) throws ECFException {
    try {
        Object service = registration.getService();
        if (service == null)
            // $NON-NLS-1$
            throw new NullPointerException("Service is null for registration=" + registration.getReference().getID());
        // Lookup method on service object
        Class[] svcClasses = getClassesForService(service, (String[]) registration.getProperty(org.eclipse.ecf.remoteservice.Constants.OBJECTCLASS));
        if (svcClasses == null || svcClasses.length == 0)
            // $NON-NLS-1$
            throw new NullPointerException("Service interface not found for registration=" + registration.getReference().getID());
        Method method = getMethodForService(call.getMethod(), svcClasses);
        if (method == null)
            // $NON-NLS-1$ //$NON-NLS-2$
            throw new NullPointerException("Method " + call.getMethod() + " not found for registration=" + registration.getReference().getID());
        return method.invoke(service, call.getParameters());
    } catch (Exception e) {
        // $NON-NLS-1$
        throw new ECFException("Exception invoking local service registration=" + registration.getReference().getID(), e);
    }
}
Also used : ECFException(org.eclipse.ecf.core.util.ECFException) RegistrySharedObject(org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject) Method(java.lang.reflect.Method) SharedObjectInitException(org.eclipse.ecf.core.sharedobject.SharedObjectInitException) ECFException(org.eclipse.ecf.core.util.ECFException)

Example 9 with ECFException

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

the class MultiRosterView method selectAndJoinChatRoomForAccounts.

private void selectAndJoinChatRoomForAccounts(MultiRosterAccount[] accounts) {
    // Create chat room selection dialog with managers, open
    ChatRoomSelectionDialog dialog = new ChatRoomSelectionDialog(getViewSite().getShell(), accounts);
    dialog.open();
    // If selection cancelled then simply return
    if (dialog.getReturnCode() != Window.OK)
        return;
    // Get selected room, selected manager, and selected IChatRoomInfo
    IChatRoomInfo selectedInfo = dialog.getSelectedRoom().getRoomInfo();
    MultiRosterAccount account = dialog.getSelectedRoom().getAccount();
    // Now get the secondary ID from the selected room id
    final IContainer container = account.getContainer();
    final ID connectedID = container.getConnectedID();
    if (connectedID == null) {
        MessageDialog.openError(getViewSite().getShell(), Messages.MultiRosterView_NO_IDENTIFIER_FOR_ROOM_TITLE, NLS.bind(Messages.MultiRosterView_NO_IDENTIFIER_FOR_ROOM_MESSAGE, selectedInfo.getRoomID()));
        return;
    }
    try {
        joinChatRoom(container, selectedInfo, null);
    } catch (ECFException e) {
        Throwable e1 = e.getStatus().getException();
        Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.MultiRosterView_EXCEPTION_LOG_JOIN_ROOM, e1));
        ContainerConnectErrorDialog ed = new ContainerConnectErrorDialog(getViewSite().getShell(), selectedInfo.getRoomID().getName(), e1);
        ed.open();
    }
}
Also used : IChatRoomInfo(org.eclipse.ecf.presence.chatroom.IChatRoomInfo) ECFException(org.eclipse.ecf.core.util.ECFException) ContainerConnectErrorDialog(org.eclipse.ecf.ui.dialogs.ContainerConnectErrorDialog) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer)

Example 10 with ECFException

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

the class ScreenCaptureShareRosterContributionItem method createActionAdd.

private IAction[] createActionAdd(final ID containerID, final IChannelContainerAdapter channelAdapter) {
    final IAction action = new Action() {

        public void run() {
            try {
                ScreenCaptureShare.addScreenCaptureShare(containerID, channelAdapter);
            } catch (ECFException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    };
    action.setText(Messages.ScreenCaptureShareRosterContributionItem_SCREENCAPTURESHARE_LISTENER_MENU_ADD_TEXT);
    action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW));
    return new IAction[] { action };
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) ECFException(org.eclipse.ecf.core.util.ECFException)

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