XMPPServerProxy.java 2.24 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision$
 * $Date$
 *
Matt Tucker's avatar
Matt Tucker committed
6
 * Copyright (C) 2004 Jive Software. All rights reserved.
Matt Tucker's avatar
Matt Tucker committed
7
 *
Matt Tucker's avatar
Matt Tucker committed
8 9
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
Matt Tucker's avatar
Matt Tucker committed
10
 */
Matt Tucker's avatar
Matt Tucker committed
11

Matt Tucker's avatar
Matt Tucker committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
package org.jivesoftware.messenger.spi;

import org.jivesoftware.messenger.container.Container;
import org.jivesoftware.messenger.Session;
import org.jivesoftware.messenger.XMPPAddress;
import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.XMPPServerInfo;
import org.jivesoftware.messenger.auth.AuthToken;
import org.jivesoftware.messenger.auth.Permissions;
import org.jivesoftware.messenger.auth.UnauthorizedException;

/**
 * Standard security wrapper for the XMPPServer class. This class also
 * allows a simple mechanism for wrapping all server resources using
 * a single security and resource control context without having to
 * impose proxies for each resource.
 *
 * @author Iain Shigeoka
 */
public class XMPPServerProxy implements XMPPServer {

    private XMPPServer server;
    private AuthToken authToken;
    private Permissions permissions;


    /**
     * <p>Create a new server proxy.</p>
     *
     * @param server     The server to proxy
     * @param auth       The auth for the server
     * @param permission The permissions for the server
     */
    public XMPPServerProxy(XMPPServer server, AuthToken auth, Permissions permission) {
        this.server = server;
        this.authToken = auth;
        this.permissions = permission;
    }

    public XMPPServerInfo getServerInfo() {
        return server.getServerInfo();
    }

    public boolean isLocal(XMPPAddress jid) {
        return server.isLocal(jid);
    }

    public XMPPAddress createAddress(String username, String resource) {
        return server.createAddress(username, resource);
    }

    public Session getSession() throws UnauthorizedException {
        return server.getSession();
    }

    public String getName() {
        return server.getName();
    }

71 72
    public void initialize(Container container) {
        server.initialize(container);
Matt Tucker's avatar
Matt Tucker committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
    }

    public void start() {
        server.start();
    }

    public void stop() {
        server.stop();
    }

    public void destroy() {
        server.destroy();
    }

}