1 /* 2 * Copyright 2001,2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.apache.commons.scaffold.util; 18 19 20 import java.util.Locale; 21 22 /** 23 * A helper bean used to encapsulate the runtime 24 * properties needed by a business service 25 * [<code>org.apache.commons.scaffold.util.BizSevice</code>]. 26 * <p> 27 * This is a whitebox class that is meant to be extended 28 * with new properties to meet the requirements of a 29 * particular business service. 30 * <p> 31 * A number of base properties are provided to meet common needs. 32 * <p> 33 * <ul> 34 * <li> 35 * <b>SessionLocale</b> - A locale object for the client making this request. 36 * <li> 37 * <b>RemoteNode</b> - The network address of the client making this request 38 * (or its proxy host). 39 * <li> 40 * <b>RemoteServer</b> - A general-purpose Object that may be used by a business 41 * service to obtain a reference to other services (JBDC, JNDI, and so forth). 42 * <li> 43 * <b>Parameter</b> - A general-purpose String that may be used to select a 44 * sub-service or pass other information to the service. 45 * </ul> 46 * 47 * @author Ted Husted 48 * @author Nationwide Insurance Company 49 * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $ 50 */ 51 public interface BizRequest { 52 53 /** 54 * The session attribute key for our session locale object ["SESSION_LOCALE"]. 55 * (Suggestion only, may be overridden by presentation framework 56 */ 57 public static String SESSION_LOCALE_KEY = "SESSION_LOCALE"; 58 59 /** 60 * Return the locale for this bean instance. 61 * @return the locale 62 */ 63 public Locale getSessionLocale(); 64 65 /** 66 * Set the locale for this bean instance. 67 * @param locale The new locale 68 */ 69 public void setSessionLocale(Locale locale); 70 71 /** 72 * Return the network address of the client for this bean instance. 73 * @return the network address. 74 */ 75 public Integer getRemoteNode(); 76 77 /** 78 * Set the network address of the client for this bean instance. 79 * @param remoteNode The new remoteNode. 80 */ 81 public void setRemoteNode(Integer remoteNode); 82 83 /** 84 * The session attribute key for our remote server object ["REMOTE_SERVER"]. 85 * (Suggestion only, may be overridden by presentation framework 86 */ 87 public static String REMOTE_SERVER_KEY = "REMOTE_SERVER"; 88 89 /** 90 * The remote server object for this bean instance, if any. 91 * <p> 92 * This is often an application-scope object that can be used 93 * to process a JDBC query or equivalent. 94 * By default, the <code>ProcessAction</code> will set this to any 95 * application scope object found under the key 96 * <code>BaseAction.REMOTE_SERVER</code> or to null. 97 * 98 * @return the remote server 99 */ 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