001: /******************************************************************************
002: * JBoss, a division of Red Hat *
003: * Copyright 2006, Red Hat Middleware, LLC, and individual *
004: * contributors as indicated by the @authors tag. See the *
005: * copyright.txt in the distribution for a full listing of *
006: * individual contributors. *
007: * *
008: * This is free software; you can redistribute it and/or modify it *
009: * under the terms of the GNU Lesser General Public License as *
010: * published by the Free Software Foundation; either version 2.1 of *
011: * the License, or (at your option) any later version. *
012: * *
013: * This software is distributed in the hope that it will be useful, *
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
016: * Lesser General Public License for more details. *
017: * *
018: * You should have received a copy of the GNU Lesser General Public *
019: * License along with this software; if not, write to the Free *
020: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
021: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
022: ******************************************************************************/package org.jboss.portal.wsrp;
023:
024: import org.jboss.portal.server.PortalConstants;
025:
026: import javax.xml.namespace.QName;
027: import java.net.InetAddress;
028: import java.net.UnknownHostException;
029: import java.util.Random;
030:
031: /**
032: * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
033: * @version $Revision: 8784 $
034: * @since 2.4
035: */
036: public final class WSRPConstants {
037: // JMX **************************************************************************************************************
038: /** JMX object name for the Portal web app registry */
039: public static final String WEB_APP_REGISTRY_OBJECT_NAME = "portal:service=WebAppRegistry";
040: /** JMX object name for the WSRP Producer */
041: public static final String WSRP_PRODUCER_OBJECT_NAME = "portal.wsrp:service=WSRPProducer";
042:
043: // Window State Names ***********************************************************************************************
044:
045: /**
046: * <p/> The <code>wsrp:normal</code> window state indicates the Portlet is likely sharing the aggregated page with
047: * other Portlets. The <code>wsrp:normal</code> window state MAY also indicate that the target device has limited
048: * display capabilities. Therefore, a Portlet SHOULD restrict the size of its rendered output in this window state.
049: * </p> <p>Conformant Portlets MUST support the <code>wsrp:normal</code> window state.</p>
050: */
051: public static final String NORMAL_WINDOW_STATE = "wsrp:normal";
052: /**
053: * When the window state is <code>wsrp:minimized</code>, the Portlet SHOULD NOT render visible markup, but is free to
054: * include non-visible data such as JavaScript or hidden forms. The <code>getMarkup</code> operation can be invoked
055: * for the <code>wsrp:minimized</code> state just as for all other window states.
056: */
057: public static final String MINIMIZED_WINDOW_STATE = "wsrp:minimized";
058: /**
059: * The <code>wsrp:maximized</code> window state is an indication the Portlet is likely the only Portlet being
060: * rendered in the aggregated page, or that the Portlet has more space compared to other Portlets in the aggregated
061: * page. A Portlet SHOULD generate richer content when its window state is <code>wsrp:maximized</code>.
062: */
063: public static final String MAXIMIZED_WINDOW_STATE = "wsrp:maximized";
064: /**
065: * The <code>wsrp:solo</code> window state is an indication the Portlet is the only Portlet being rendered in the
066: * aggregated page. A Portlet SHOULD generate richer content when its window state is <code>wsrp:solo</code>.
067: */
068: public static final String SOLO_WINDOW_STATE = "wsrp:solo";
069:
070: // Portlet mode names ***********************************************************************************************
071:
072: /**
073: * <p>The expected functionality for a Portlet in <code>wsrp:view</code> mode is to render markup reflecting the
074: * current state of the Portlet. The <code>wsrp:view</code> mode of a Portlet will include one or more screens that
075: * the End-User can navigate and interact with or it may consist of static content devoid of user interactions.</p>
076: * <p>The behavior and the generated content of a Portlet in the wsrp:view mode may depend on configuration,
077: * personalization and all forms of state.</p> <p>Conformant Portlets MUST support the <code>wsrp:view</code>
078: * mode.</p>
079: */
080: public static final String VIEW_MODE = "wsrp:view";
081: /**
082: * <p>Within the <code>wsrp:edit</code> mode, a Portlet should provide content and logic that let a user customize
083: * the behavior of the Portlet , though such customizations are not limited to screens generated while in this mode.
084: * The <code>wsrp:edit</code> mode can include one or more screens which users can navigate to enter their
085: * customization data.</p> <p>Typically, Portlets in <code>wsrp:edit</code> mode will set or update Portlet enduring
086: * state. How such changes impact Consumer management of Portlet usage by End-Users is discussed in [Section
087: * 6.4.3].</p>
088: */
089: public static final String EDIT_MODE = "wsrp:edit";
090: /**
091: * <p>When in <code>wsrp:help</code> mode, a Portlet may provide help screens that explains the Portlet and its
092: * expected usage. Some Portlets will provide context-sensitive help based on the markup the End-User was viewing
093: * when entering this mode.</p>
094: */
095: public static final String HELP_MODE = "wsrp:help";
096: /**
097: * In <code>wsrp:preview</code> mode, a Portlet should provide a rendering of its standard <code>wsrp:view</code>
098: * mode content, as a visual sample of how this Portlet will appear on the End-User's page with the current
099: * configuration. This could be useful for a Consumer that offers an advanced layout capability.
100: */
101: public static final String PREVIEW_MODE = "wsrp:preview";
102:
103: // Standard user authentication values ******************************************************************************
104:
105: /** No authentication was done, user information is asserted for informational purposes only. */
106: public static final String NONE_USER_AUTHENTICATION = "wsrp:none";
107: /** The End-User identified themselves using the common userid/password scenario. */
108: public static final String PASSWORD_USER_AUTHENTICATION = "wsrp:password";
109: /** The End-User presented a security certificate to validate their identity. */
110: public static final String CERTIFICATE_USER_AUTHENTICATION = "wsrp:certificate";
111:
112: // WSRP Defaults ****************************************************************************************************
113:
114: /** Default character set used to generate markup. */
115: public static final String DEFAULT_CHARACTER_SET = "UTF-8";
116: /** Default locales. */
117: public static final String[] DEFAULT_LOCALES = new String[] {
118: "en-US", "en" };
119: /** Default MIME types. */
120: public static final String[] DEFAULT_MIME_TYPES = new String[] { "text/html" };
121:
122: // Registration data related ****************************************************************************************
123:
124: /** Default consumer name if none has been provided in the WSRP descriptor (*-wsrp.xml) */
125: public static final String DEFAULT_CONSUMER_NAME;
126: /** The String identifying the portal consumer agent */
127: public static final String CONSUMER_AGENT = PortalConstants.VERSION
128: .getName()
129: + "."
130: + PortalConstants.VERSION.getMajor()
131: + "."
132: + PortalConstants.VERSION.getMinor()
133: + "."
134: + PortalConstants.VERSION.getQualifier();
135:
136: static {
137: InetAddress localhost = null;
138: try {
139: localhost = InetAddress.getLocalHost();
140: } catch (UnknownHostException e) {
141: e.printStackTrace();
142: }
143: if (localhost != null) {
144: DEFAULT_CONSUMER_NAME = localhost.getCanonicalHostName();
145: } else {
146: Random random = new Random(System.currentTimeMillis());
147: DEFAULT_CONSUMER_NAME = CONSUMER_AGENT + " Unconfigured "
148: + random.nextInt();
149: }
150: }
151:
152: // User scopes
153:
154: /**
155: * The markup is specific to the userContext for which it was generated. Changes to the data of the UserContext MUST
156: * invalidate the cached markup.
157: */
158: public static final String CACHE_PER_USER = "wsrp:perUser";
159:
160: /** The markup is not specific to the UserContext and therefore may be supplied to all users of the Consumer. */
161: public static final String CACHE_FOR_ALL = "wsrp:forAll";
162:
163: /** The value of SessionContext.expires if the session will never expire. */
164: public static final int SESSION_NEVER_EXPIRES = -1;
165:
166: /** A QName representing the string type defined as part of XML Schemas Part 2 */
167: public static final QName XSD_STRING = new QName(
168: "http://www.w3.org/2001/XMLSchema", "string");
169:
170: private WSRPConstants() {
171: }
172: }
|