ExternalComponentConfiguration.java 2.36 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/**
 * Copyright (C) 2004-2009 Jive Software. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

17
package org.jivesoftware.openfire.component;
18 19 20 21 22 23 24 25 26 27 28 29

/**
 * Holds the configuration for external components that want to connect to this server. The
 * configuration specifies if the external component is allowed to connect to the server as well
 * as the shared secret between the server and the component. If no secret or configuration was
 * defined then the default shared secret will be used.
 *
 * @author Gaston Dombiak
 */
public class ExternalComponentConfiguration {

    private String subdomain;
30 31 32 33 34
    /**
     * Flag that indicates if components whose domain starts with the subdomain of this configuration
     * should use this configuration.
     */
    private boolean wildcard;
35 36 37 38 39

    private Permission permission;

    private String secret;

40
    public ExternalComponentConfiguration(String subdomain, boolean wildcard, Permission permission, String secret) {
41
        this.subdomain = subdomain;
42
        this.wildcard = wildcard;
43 44
        this.permission = permission;
        this.secret = secret;
45 46 47 48 49 50
    }

    public String getSubdomain() {
        return subdomain;
    }

51 52 53 54
    public boolean isWildcard() {
        return wildcard;
    }

55 56 57 58
    public Permission getPermission() {
        return permission;
    }

59
    void setPermission(Permission permission) {
60 61 62 63 64 65 66
        this.permission = permission;
    }

    public String getSecret() {
        return secret;
    }

67
    void setSecret(String secret) {
68 69 70 71 72 73 74 75 76 77 78 79
        this.secret = secret;
    }

    public enum Permission {
        /**
         * The XMPP entity is allowed to connect to the server.
         */
        allowed,

        /**
         * The XMPP entity is NOT allowed to connect to the server.
         */
80
        blocked;
81 82
    }
}