Search in sources :

Example 1 with XMPPSContainer

use of org.eclipse.ecf.provider.xmpp.XMPPSContainer in project ecf by eclipse.

the class XMPPSContainerInstantiator method createInstance.

public IContainer createInstance(ContainerTypeDescription description, Object[] args) throws ContainerCreateException {
    try {
        Integer ka = new Integer(XMPPSContainer.DEFAULT_KEEPALIVE);
        String name = null;
        if (args != null) {
            if (args.length > 0) {
                name = (String) args[0];
                if (args.length > 1) {
                    ka = getIntegerFromArg(args[1]);
                }
            }
        }
        if (name == null) {
            if (ka == null) {
                return new XMPPSContainer();
            } else {
                return new XMPPSContainer(ka.intValue());
            }
        } else {
            if (ka == null) {
                ka = new Integer(XMPPSContainer.DEFAULT_KEEPALIVE);
            }
            return new XMPPSContainer(name, ka.intValue());
        }
    } catch (Exception e) {
        throw new ContainerCreateException("Exception creating generic container", e);
    }
}
Also used : XMPPSContainer(org.eclipse.ecf.provider.xmpp.XMPPSContainer) ContainerCreateException(org.eclipse.ecf.core.ContainerCreateException) ContainerCreateException(org.eclipse.ecf.core.ContainerCreateException)

Example 2 with XMPPSContainer

use of org.eclipse.ecf.provider.xmpp.XMPPSContainer in project ecf by eclipse.

the class XMPPHyperlink method getContainers.

protected IContainer[] getContainers() {
    final IContainerManager manager = Activator.getDefault().getContainerManager();
    if (manager == null)
        return EMPTY;
    final List results = new ArrayList();
    final IContainer[] containers = manager.getAllContainers();
    for (int i = 0; i < containers.length; i++) {
        final ID connectedID = containers[i].getConnectedID();
        // Must be connected and ID of correct type
        if (connectedID != null && ((isXMPPS && containers[i] instanceof XMPPSContainer) || (!isXMPPS && containers[i] instanceof XMPPContainer)))
            results.add(containers[i]);
    }
    return (IContainer[]) results.toArray(EMPTY);
}
Also used : XMPPSContainer(org.eclipse.ecf.provider.xmpp.XMPPSContainer) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) XMPPID(org.eclipse.ecf.provider.xmpp.identity.XMPPID) ID(org.eclipse.ecf.core.identity.ID) XMPPSID(org.eclipse.ecf.provider.xmpp.identity.XMPPSID) XMPPContainer(org.eclipse.ecf.provider.xmpp.XMPPContainer)

Aggregations

XMPPSContainer (org.eclipse.ecf.provider.xmpp.XMPPSContainer)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ContainerCreateException (org.eclipse.ecf.core.ContainerCreateException)1 ID (org.eclipse.ecf.core.identity.ID)1 XMPPContainer (org.eclipse.ecf.provider.xmpp.XMPPContainer)1 XMPPID (org.eclipse.ecf.provider.xmpp.identity.XMPPID)1 XMPPSID (org.eclipse.ecf.provider.xmpp.identity.XMPPSID)1