Search in sources :

Example 6 with ComponentException

use of org.xmpp.component.ComponentException in project Openfire by igniterealtime.

the class FastpathPlugin method workgroupManagerStart.

private void workgroupManagerStart() {
    workgroupManager = WorkgroupManager.getInstance();
    // Register Fastpath service
    try {
        ComponentManagerFactory.getComponentManager().addComponent("workgroup", workgroupManager);
    } catch (ComponentException e) {
        // Do nothing. Should never happen.
        Log.error(e.getMessage(), e);
    }
    // Register the provider of workgroup names
    UserNameManager.addUserNameProvider(workgroupManager.getAddress().toString(), new UserNameProvider() {

        public String getUserName(JID entity) {
            try {
                Workgroup workgroup = workgroupManager.getWorkgroup(entity);
                return workgroup.getDisplayName();
            } catch (UserNotFoundException e) {
                return entity.toString();
            }
        }
    });
    // Start the Fastpath module
    workgroupManager.start();
}
Also used : UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) UserNameProvider(org.jivesoftware.openfire.user.UserNameProvider) JID(org.xmpp.packet.JID) ComponentException(org.xmpp.component.ComponentException) Workgroup(org.jivesoftware.xmpp.workgroup.Workgroup)

Aggregations

ComponentException (org.xmpp.component.ComponentException)6 JID (org.xmpp.packet.JID)2 Element (org.dom4j.Element)1 PacketException (org.jivesoftware.openfire.PacketException)1 ComponentSession (org.jivesoftware.openfire.session.ComponentSession)1 LocalComponentSession (org.jivesoftware.openfire.session.LocalComponentSession)1 UserNameProvider (org.jivesoftware.openfire.user.UserNameProvider)1 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)1 Workgroup (org.jivesoftware.xmpp.workgroup.Workgroup)1 IQ (org.xmpp.packet.IQ)1 PacketError (org.xmpp.packet.PacketError)1 Presence (org.xmpp.packet.Presence)1 StreamError (org.xmpp.packet.StreamError)1