001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: SchemaType.java,v 1.3 2008/06/25 05:44:05 qcheng Exp $
026 *
027 */
028
029package com.sun.identity.sm;
030
031/**
032 * The class <code>SchemaType</code> defines the types of schema objects, and
033 * provides static constants for these schema objects. Currently defined schema
034 * objects are <code>SchemaType.GLOBAL</code>, <code>
035 * SchemaType.ORGANIZATION</code>,
036 * <code>
037 * SchemaType.USER</code>, <code> SchemaType.POLICY
038 * </code> and
039 * <code> SchemaType.DYNAMIC </code>. The usage of the respective schema types
040 * are defined along with their declaration.
041 *
042 * @supported.all.api
043 */
044public class SchemaType extends Object {
045
046    private String schemaType;
047
048    private String lSchemaType;
049
050    /**
051     * The <code>GLOBAL</code> schema type defines the service configuration
052     * information that independent of organizations, users and instances.
053     * Hence, the service configuration data defined using this schema type will
054     * the same across organizations and users. An example could be encryption
055     * algorithms used by the service for its internal communication. Such
056     * configuration data can be changed only by super administrator.
057     */
058    public static final SchemaType GLOBAL = new SchemaType("Global");
059
060    /**
061     * The <code>ORGANIZATION</code> schema type defines the service
062     * configuration information that are organization dependent and could be
063     * configured differently for organizations. Usually these configuration
064     * data can be modified by organization administrators. An example would be
065     * log level of a service.
066     */
067    public static final SchemaType ORGANIZATION = 
068        new SchemaType("Organization");
069
070    /**
071     * The <code>User</code> schema type defines the service configuration
072     * information that are user dependent. An example would user's mail server
073     * or mail quota. Usually these configuration data can be modified by users
074     * and/or administrators.
075     */
076    public static final SchemaType USER = new SchemaType("User");
077
078    /**
079     * The <code>POLICY</code> schema type defines the service's privilege
080     * information that are service dependent.
081     */
082    public static final SchemaType POLICY = new SchemaType("Policy");
083
084    /**
085     * The <code>DYNAMIC</code> schema type defines
086     */
087    public static final SchemaType DYNAMIC = new SchemaType("Dynamic");
088
089    /**
090     * The <code>GROUP</code> schema type defines attributes for a group
091     */
092    public static final SchemaType GROUP = new SchemaType("Group");
093
094    /**
095     * The <code>DOMAIN</code> schema type defines attributes for a domain
096     */
097    public static final SchemaType DOMAIN = new SchemaType("Domain");
098
099    private SchemaType() {
100        // do nothing
101    }
102
103    public SchemaType(String type) {
104        schemaType = type;
105        lSchemaType = type.toLowerCase();
106    }
107
108    /**
109     * The method returns the string representation of the schema type.
110     * 
111     * @return String string representation of schema type
112     */
113    public String toString() {
114        return ("SchemaType: " + schemaType);
115    }
116
117    /**
118     * Method to check if two schema types are equal.
119     * 
120     * @param schemaType
121     *            the reference object with which to compare
122     * 
123     * @return <code>true</code> if the objects are same; <code>
124     * false</code>
125     *         otherwise
126     */
127    public boolean equals(Object schemaType) {
128        if (schemaType instanceof SchemaType) {
129            SchemaType s = (SchemaType) schemaType;
130            return (s.lSchemaType.equalsIgnoreCase(this.lSchemaType));
131        }
132        return (false);
133    }
134
135    /**
136     * Returns the hash code of the object.
137     * 
138     * @return the hash code of the object.
139     */
140    public int hashCode() {
141        return (lSchemaType.hashCode());
142    }
143
144    public String getType() {
145        return (schemaType);
146    }
147}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.