001 /*
002 * Copyright 2001,2004 The Apache Software Foundation.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.apache.commons.scaffold.util;
018
019
020 import java.util.Locale;
021
022 /**
023 * A helper bean used to encapsulate the runtime
024 * properties needed by a business service
025 * [<code>org.apache.commons.scaffold.util.BizSevice</code>].
026 * <p>
027 * This is a whitebox class that is meant to be extended
028 * with new properties to meet the requirements of a
029 * particular business service.
030 * <p>
031 * A number of base properties are provided to meet common needs.
032 * <p>
033 * <ul>
034 * <li>
035 * <b>SessionLocale</b> - A locale object for the client making this request.
036 * <li>
037 * <b>RemoteNode</b> - The network address of the client making this request
038 * (or its proxy host).
039 * <li>
040 * <b>RemoteServer</b> - A general-purpose Object that may be used by a business
041 * service to obtain a reference to other services (JBDC, JNDI, and so forth).
042 * <li>
043 * <b>Parameter</b> - A general-purpose String that may be used to select a
044 * sub-service or pass other information to the service.
045 * </ul>
046 *
047 * @author Ted Husted
048 * @author Nationwide Insurance Company
049 * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
050 */
051 public interface BizRequest {
052
053 /**
054 * The session attribute key for our session locale object ["SESSION_LOCALE"].
055 * (Suggestion only, may be overridden by presentation framework
056 */
057 public static String SESSION_LOCALE_KEY = "SESSION_LOCALE";
058
059 /**
060 * Return the locale for this bean instance.
061 * @return the locale
062 */
063 public Locale getSessionLocale();
064
065 /**
066 * Set the locale for this bean instance.
067 * @param locale The new locale
068 */
069 public void setSessionLocale(Locale locale);
070
071 /**
072 * Return the network address of the client for this bean instance.
073 * @return the network address.
074 */
075 public Integer getRemoteNode();
076
077 /**
078 * Set the network address of the client for this bean instance.
079 * @param remoteNode The new remoteNode.
080 */
081 public void setRemoteNode(Integer remoteNode);
082
083 /**
084 * The session attribute key for our remote server object ["REMOTE_SERVER"].
085 * (Suggestion only, may be overridden by presentation framework
086 */
087 public static String REMOTE_SERVER_KEY = "REMOTE_SERVER";
088
089 /**
090 * The remote server object for this bean instance, if any.
091 * <p>
092 * This is often an application-scope object that can be used
093 * to process a JDBC query or equivalent.
094 * By default, the <code>ProcessAction</code> will set this to any
095 * application scope object found under the key
096 * <code>BaseAction.REMOTE_SERVER</code> or to null.
097 *
098 * @return the remote server
099 */
100 public Object getRemoteServer();
101
102 /**
103 * Set the remote server
104 *
105 * @param server The new server
106 */
107 public void setRemoteServer(Object server);
108
109 /**
110 * Return the parameter.
111 */
112 public String getParameter();
113
114 /**
115 * Set the parameter.
116 * @param parameter The new parameter
117 */
118 public void setParameter(String parameter);
119
120 /**
121 * Validate the properties that have been set for this business request,
122 * and return an <code>Messages</code> object that encapsulates any
123 * validation errors that have been found. If no errors are found,
124 * return <code>null</code> or an <code>Messages</code> object with
125 * no recorded error messages.
126 * @param parameter A general purpose parameter
127 */
128 public Messages validate(String parameter);
129
130
131 } // end BizRequest