001: /*
002: * Copyright 2002 Sun Microsystems, Inc. All
003: * rights reserved. Use of this product is subject
004: * to license terms. Federal Acquisitions:
005: * Commercial Software -- Government Users
006: * Subject to Standard License Terms and
007: * Conditions.
008: *
009: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010: * are trademarks or registered trademarks of Sun Microsystems,
011: * Inc. in the United States and other countries.
012: */
013:
014: package com.sun.portal.container;
015:
016: /**
017: * The <CODE>ChannelMode</CODE> class is represents
018: * the possible modes that a channel can assume.
019: * <P>
020: * This class defines a standard set of the most basic channel modes.
021: * Additional channel modes may be defined by calling the constructor
022: * of this class.
023: */
024: public class ChannelMode {
025: /**
026: * The standard "one-of many" channel view on a page.
027: * <P>
028: * This mode must be implemented by the channel.
029: * <p>
030: * The string value for this mode is "VIEW".
031: */
032: public final static ChannelMode VIEW = new ChannelMode("VIEW");
033:
034: /**
035: * This mode allows the channel to capture user-specific
036: * parameterization, which leads to a personalized view of the
037: * channel.
038: * <P>
039: * This mode may be implemented by the channel.
040: * <p>
041: * The string value for this mode is "EDIT".
042: */
043: public final static ChannelMode EDIT = new ChannelMode("EDIT");
044:
045: /**
046: * A channel should provide useful online help in this mode.
047: * This may be a short description or a multi-page instruction on
048: * how to use the channel.
049: * <P>
050: * This mode may be implemented by the channel.
051: * <p>
052: * The string value for this mode is "HELP".
053: */
054: public final static ChannelMode HELP = new ChannelMode("HELP");
055:
056: /**
057: * Allows the channel to bring its own configuration
058: * screen if required. Only a user with administrator privileges should
059: * be able to call a channel in this mode.
060: * <P>
061: * This mode may be implemented by the channel, but the channel
062: * cannot be sure that this mode is called, as the channel
063: * container it is running in may not support this mode.
064: * <p>
065: * The string value for this mode is "CONFIG".
066: */
067: public final static ChannelMode CONFIG = new ChannelMode("CONFIG");
068:
069: private String _name;
070:
071: private ChannelMode() {
072: }
073:
074: /**
075: * Creates a new channel mode with the given name.<br>
076: * Lower case letters in the name will be converted to
077: * upper case letters.
078: *
079: * @param name The name of the channel mode
080: */
081: public ChannelMode(String name) {
082: if (name == null) {
083: throw new IllegalArgumentException(
084: "ChannelMode name can not be NULL");
085: }
086: _name = name.toUpperCase();
087: }
088:
089: public String toString() {
090: return _name;
091: }
092:
093: public int hashCode() {
094: return _name.hashCode();
095: }
096:
097: public boolean equals(Object object) {
098: return _name.equals(((ChannelMode) object)._name);
099: }
100: }
|