You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by hu...@apache.org on 2002/08/14 19:52:19 UTC
cvs commit: jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util ResultListBase.java ResultList.java ResourceUtils.java ProcessResultBase.java ProcessResult.java ProcessBeanBase.java ProcessBean.java Mapped.java Localized.java LabelValueBean.java FunctionBean.java Executable.java
husted 2002/08/14 10:52:19
Added: scaffold/src/java/org/apache/commons/scaffold/util
ResultListBase.java ResultList.java
ResourceUtils.java ProcessResultBase.java
ProcessResult.java ProcessBeanBase.java
ProcessBean.java Mapped.java Localized.java
LabelValueBean.java FunctionBean.java
Executable.java
Log:
[SCAFFOLD] New sandbox component
Revision Changes Path
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ResultListBase.java
Index: ResultListBase.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
// import org.apache.commons.beanutils.BeanUtils; // Struts 1.1
import org.apache.struts.util.BeanUtils; // Struts 1.0.x
import org.apache.commons.scaffold.lang.ChainedException;
import org.apache.commons.scaffold.lang.Tokens;
/**
* Concrete implementation of ResultList.
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public class ResultListBase implements ResultList {
// ----------------------------------------------------------- Properties
/**
* The result list [ArrayList].
*/
protected List result = (List) new ArrayList();
/**
* Return the result list (an ArrayList).
* @returns the result list
*/
public List getResult() {
return this.result;
}
/**
* Assign a new result list.
* Will clear existing list if new result is null.
* Will not assign null to result.
*/
public void setResult(List result) {
this.result = result;
}
/**
* A result code, if returned by the resource layer.
*/
private Integer code = null;
/**
* Return the code.
* @return the code
*/
public Integer getCode() {
return (this.code);
}
/**
* Set the code.
* @param code The new code
*/
public void setCode(Integer code) {
this.code = code;
}
/**
* A phrase describing the result list.
* ie: field = value
*/
private String legend = null;
/**
* Return the legend.
* @return the legend
*/
public String getLegend() {
return (this.legend);
}
/**
* Set the legend.
* @param legend The new legend
*/
public void setLegend(String legend) {
this.legend = legend;
}
/**
* Set the legend.
* @param legend The new legend
*/
public void setLegend(String name, String value) {
if ((null==value) || ("".equals(value))) {
setLegend(name + Tokens.PARAM_EQUALS + Tokens.PARAM_ANY);
}
else {
setLegend(name + Tokens.PARAM_EQUALS + value);
}
}
/**
* The displayName map, if any.
*/
protected Map displayName = null;
/**
* Return the displayName map (a HashMap).
* These are localized titles for the
* properties names in the result list.
* @returns the displayName list
*/
public Map getDisplayName() {
return this.displayName;
}
/**
* Assign a new displayName list.
* These are localized titles for the
* properties names in the result list.
*/
public void setDisplayName(Map displayName) {
this.displayName = displayName;
}
// ------------------------------------------------------------- List Methods
// ----- array operations -----
/**
* Returns an array containing all of the elements in this collection.
* @return an array containing all of the elements in this collection
*/
public Object[] toArray() {
return getResult().toArray();
}
/**
* Returns an array containing all of the elements in this collection; the
* runtime type of the returned array is that of the specified array.
* @return an array containing the elements of this collection
*/
public Object[] toArray(Object a[]) {
return getResult().toArray(a);
}
// ----- basic operations -----
/**
* Returns true if this collection contains no elements.
* @return true if this collection contains no elements
*/
public boolean isEmpty() {
return getResult().isEmpty();
}
/**
* Return the number of elements on the List.
* @return the size of the List
*/
public int size() {
return getResult().size();
}
/**
* Returns true if this collection contains the specified element.
* @return true if this collection contains the specified element
*/
public boolean contains(Object element) {
return getResult().contains(element);
}
/**
* Appends the specified element to the end of this list (optional
* operation).
* @return the row count
*/
public boolean add(Object o) {
return getResult().add(o);
}
/**
* Return an iterator for the List.
* @return an iterator for the List
*/
public Iterator iterator() {
return getResult().iterator();
}
// ----- list operations -----
/**
* Returns the element at the specified position in this list.
*/
public Object get(int index) {
return getResult().get(index);
}
// ----- bulk operations ------
/**
* Appends all of the elements in the specified Collection
* to the end of this list, in the order that they are
* returned by the specified Collection's Iterator.
*/
public boolean addAll(Collection c) {
return getResult().addAll(c);
}
/**
* Removes all of the elements from this list..
*/
public void clear() {
getResult().clear();
}
/**
* Returns true if this collection contains all of the elements in the
* specified collection.
* @returns true if this collection contains all of the elements in the
* specified collection
*/
public boolean containsAll(Collection c) {
return getResult().containsAll(c);
}
/**
* Removes a single instance of the specified element from this
* collection, if it is present (optional operation).
*/
public boolean remove(Object o) {
return getResult().remove(o);
}
/**
* Removes all this collection's elements that are also contained in the
* specified collection.
*/
public boolean removeAll(Collection c) {
return getResult().removeAll(c);
}
/**
* Retains only the elements in this collection that are contained in the
* specified collection.
*/
public boolean retainAll(Collection c) {
return getResult().retainAll(c);
}
// ----------------------------------------------------------- Public Methods
/**
* Convenience accessor for <code>get()</code>.
*/
public Object getElement(int index) {
return getResult().get(index);
}
/**
* Convenience accessor for <code>iterator()</code>.
* @return an iterator for the List
*/
public Iterator getIterator() {
return iterator();
}
/**
* Convenience accessor for <code>size()</code>.
* @return the size of the List
*/
public int getSize() {
return size();
}
/**
* Populate matching properties on given object,
* using bean at given index. Returns false if index>size.
* <code>BeanUtils.describe</code>.
* @exception Throws StateException on any error.
*/
public boolean populate(Object o, int index) throws Exception {
Object bean = null;
if (size()>index)
bean = get(index);
if (bean==null) return false;
try {
BeanUtils.populate(o,BeanUtils.describe(bean));
} catch (Throwable t) {
throw new ChainedException(t);
}
return true;
}
// ----------------------------------------------------------- Constructors
/**
* Default constructor.
*/
public ResultListBase() {
super();
}
/**
* Convenience constructor to populate result with an element.
*/
public ResultListBase(Object o) {
super();
add(o);
}
/**
* Convenience constructor to populate result with a Collection.
*/
public ResultListBase(Collection c) {
super();
addAll(c);
}
}
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ResultList.java
Index: ResultList.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
// import org.apache.commons.beanutils.BeanUtils; // Struts 1.1
import org.apache.struts.util.BeanUtils; // Struts 1.0.x
import org.apache.commons.scaffold.lang.ChainedException;
/**
* A container for a set of results returned from the
* resource tier. The list may contain a Map for each
* record in a set, or a collection of beans. A setter
* for the list is not provided, so that different
* implementations can specify the type it expects.
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public interface ResultList extends Collection {
// ----------------------------------------------------------- Properties
/**
* Return the result list
* @returns the result list
*/
public List getResult();
/**
* Return the code.
* @return the code
*/
public Integer getCode();
/**
* Set the code.
* @param code The new code
*/
public void setCode(Integer code);
/**
* Return the legend.
* @return the legend
*/
public String getLegend();
/**
* Set the legend.
* @param legend The new legend
*/
public void setLegend(String legend);
/**
* Set the legend.
* @param legend The new legend
*/
public void setLegend(String name, String value);
/**
* Return the displayName map (a HashMap).
* These are localized titles for the
* properties names in the result list.
* @returns the displayName list
*/
public Map getDisplayName();
/**
* Assign a new displayName list.
* These are localized titles for the
* properties names in the result list.
*/
public void setDisplayName(Map displayName);
// ------------------------------------------------------- Collection Methods
// ----- array operations -----
/**
* Returns an array containing all of the elements in this collection.
* @return an array containing all of the elements in this collection
*/
public Object[] toArray();
/**
* Returns an array containing all of the elements in this collection; the
* runtime type of the returned array is that of the specified array.
* @return an array containing the elements of this collection
*/
public Object[] toArray(Object a[]);
// ----- basic operations -----
/**
* Returns true if this collection contains no elements.
* @return true if this collection contains no elements
*/
public boolean isEmpty();
/**
* Return the number of elements on the List.
* @return the size of the List
*/
public int size();
/**
* Returns true if this collection contains the specified element.
* @return true if this collection contains the specified element
*/
public boolean contains(Object element);
/**
* Appends the specified element to the end of this list (optional
* operation).
* @return the row count
*/
public boolean add(Object o);
/**
* Return an iterator for the List.
* @return an iterator for the List
*/
public Iterator iterator();
// ----- list operations -----
/**
* Returns the element at the specified position in this list.
*/
public Object get(int index);
// ----- bulk operations ------
/**
* Appends all of the elements in the specified Collection
* to the end of this list, in the order that they are
* returned by the specified Collection's Iterator.
*/
public boolean addAll(Collection c);
/**
* Removes all of the elements from this list..
*/
public void clear();
/**
* Returns true if this collection contains all of the elements in the
* specified collection.
* @returns true if this collection contains all of the elements in the
* specified collection
*/
public boolean containsAll(Collection c);
/**
* Removes a single instance of the specified element from this
* collection, if it is present (optional operation).
*/
public boolean remove(Object o);
/**
* Removes all this collection's elements that are also contained in the
* specified collection.
*/
public boolean removeAll(Collection c);
/**
* Retains only the elements in this collection that are contained in the
* specified collection.
*/
public boolean retainAll(Collection c);
// ----------------------------------------------------------- Public Methods
/**
* Convenience accessor for <code>get()</code>.
*/
public Object getElement(int index);
/**
* Convenience accessor for <code>iterator()</code>.
* @return an iterator for the List
*/
public Iterator getIterator();
/**
* Convenience accessor for <code>size()</code>.
* @return the size of the List
*/
public int getSize();
/**
* Populate matching properties on given object,
* using bean at given index. Returns false if index>size.
* <code>BeanUtils.describe</code>.
* @exception Throws StateException on any error.
*/
public boolean populate(Object o, int index) throws Exception;
}
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ResourceUtils.java
Index: ResourceUtils.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.Properties;
import javax.servlet.UnavailableException;
/**
* Property and Resource utilities.
*
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public class ResourceUtils {
/**
* Message to log if resource is not found.
*/
private static final String RESOURCE_NOT_FOUND =
"Resources not found";
/**
* Load a properties file.
* The path must include the package name(s),
* if any, in system directory format and
* include the properties extension.
*
* @param caller The object making the call. Needed to access ClassLoader.
* @param path The path to the properties file
* @return The initialized Properties object
* @throws UnavailableException if resource cannot be found
*/
public static final Properties loadProperties(Object caller,
String path) throws Exception {
// name = name.replace('.', '/');
// if doesn't end in .properties
// name += ".properties";
java.io.InputStream is = caller.getClass().getClassLoader().getResourceAsStream(path);
if (null==is)
throw new UnavailableException(RESOURCE_NOT_FOUND);
java.io.BufferedInputStream bis = new java.io.BufferedInputStream(is);
Properties p = null;
if (bis != null) {
try {
p = new Properties();
p.load(bis);
bis.close();
is.close();
}
catch (java.io.IOException e) {
p = null;
}
finally {
is = null;
bis = null;
}
}
return p;
}
public static final Properties loadProperties (String path) throws Exception {
return loadProperties (new Object(),path);
}
/**
* Load a properties file.
* This is a simplified version of <code>loadProperties(Object, String)</code>.
*
* @param caller The object making the call. Needed to access ClassLoader.
* @param path The path to the properties file
* @return The initialized Properties object
*/
public static final Properties loadPropertiesFile(String path) {
Properties p = null;
try {
java.io.FileInputStream i = new java.io.FileInputStream(path);
p = new java.util.Properties();
p.load(i);
}
catch (Exception e) {
p = null;
}
return p;
}
}
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
**/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ProcessResultBase.java
Index: ProcessResultBase.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
// import org.apache.commons.beanutils.BeanUtils; // Struts 1.1
import org.apache.struts.util.BeanUtils; // Struts 1.0.x
import org.apache.commons.scaffold.lang.Tokens;
/**
* Concrete implementation of <code>ProcessResult</code> that can be
* used "as-is" to manage a response from the business tier.
*
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public class ProcessResultBase implements ProcessResult {
// ----------------------------------------------------------- Properties
/**
* The attribute name for the result [null].
*/
private String name = null;
// Inherits JavaDoc
public String getName() {
return this.name;
}
/**
* Set the attribute name for this result object.
*
* @param name The new name
*/
public void setName(String name) {
this.name = name;
}
/**
* Field to store the scope property [request].
*/
private String scope = Tokens.REQUEST;
/**
* Return the scope under which to store this result object.
*
* @return the scope
*/
public String getScope() {
return this.scope;
}
/**
* Set the scope under which to store this result object.
*
* @param scope The new scope
*/
public void setScope(String scope) {
this.scope = scope;
}
/**
* Field to store single-form state [false].
*/
private boolean singleForm = false;
/**
* Return the single-form state:
* list of 0 or more records=FALSE, exactly one record=TRUE.
*
* @returns True if this is a single record
*/
public boolean isSingleForm() {
return this.singleForm;
}
/**
* Set the single-form state:
* list of 0 or more records=FALSE, exactly one record=TRUE.
*
* @param Set to true for single form.
*/
public void setSingleForm(boolean singleForm) {
this.singleForm = singleForm;
}
/**
* Field to store exposed property [true].
*/
private boolean exposed = true;
/**
* Return the exposed state.
*
* @return True if the result should be exposed
*/
public boolean isExposed() {
return this.exposed;
}
/**
* Indicates whether the result should be exposed
* to the rest of the application through a context.
*
* @param multiple The new exposed
*/
public void setExposed(boolean exposed) {
this.exposed = exposed;
}
/**
* Field to store the data property [null].
*/
private Object data = null;
/**
* Return the data object.
*
* @returns The data object
*/
public Object getData() {
return this.data;
}
/**
* Assign a new data object.
*
* @param data The new data object
*/
public void setData(Object data) {
this.data = data;
}
/**
* Return whether data object has been set.
*
* @returns True if this result contains a data object
*/
public boolean isData() {
return (getData()!=null);
}
/**
* Field to store the aggregate state [false].
*/
protected boolean aggregate = false;
/**
* Return whether the result of this ProcessResult is a collection of
* contains other ProcessResult objects to be handled individually.
* This allows processes to be combined on the business tier and
* returned to controller as a single operation.
*
* @returns True if this ProcessResult contains other ProcessResults
* objects
*/
public boolean isAggregate() {
return aggregate;
}
/**
* Assign a new container state.
*
* @param aggregate Set to true for aggregate result
*/
public void setAggregate(boolean aggregate) {
this.aggregate = aggregate;
}
/**
* Field to store the message property [ArrayList].
*/
private List messages = (List) new ArrayList();
/**
* Return whether there are any messages queued.
*
* @returns True if there are messages queued.
*/
public boolean isMessages() {
List messages = getMessages();
if (null==messages) return false;
return !(messages.isEmpty());
} // end isMessages()
/**
* Add a message to the list.
* Instantiate messages if it does not already exist.
*
* @returns True if message added.
*/
public boolean addMessage(Object message) {
return getMessages().add(message);
}
/**
* Return the messages list (an ArrayList).
*
* @returns The message list
*/
public List getMessages() {
return (List) this.messages;
}
/**
* Set a new list of messages.
*
* @param The new list of messages
*/
public void setMessages(List messages) {
this.messages = messages;
}
/**
* Field to store dispatch property [null].
*/
private String dispatch = null;
/**
* The dispatch property can be used to re-route control to an non-default location,
* either as a system path or via a logical name (e.g ActionForward).
*
* @see <code>setDispatchPath()</code>
*
* @returns The dispatch advice
*/
public String getDispatch() {
return (this.dispatch);
}
/**
* Set the dispatch advice.
*
* @param dispatch The new dispatch advice.
*/
public void setDispatch(String dispatch) {
this.dispatch = dispatch;
}
/**
* Return whether dispatch advice has been set.
*
* @returns True if dispatch advice has been set.
*/
public boolean isDispatch() {
return (getDispatch()!=null);
}
/**
* Field to store dispatchPath property [false].
*/
private boolean dispatchPath = false;
/**
* Return whether dispatch advice is suppose to be a
* path or a token (e.g. ActionForward name)
*
* @returns True if dispatch advice is a URI
*/
public boolean isDispatchPath() {
return this.dispatchPath;
}
/**
* Set the dispatchPath state.
*
* @param Boolean Set to true if dispatch is a URI
*/
public void setDispatchPath(boolean dispatchPath) {
this.dispatchPath = dispatchPath;
}
// ----------------------------------------------------------- Constructors
/**
* Default constructor.
*/
public ProcessResultBase() {
super();
}
/**
* Convenience constructor to set result object.
*
* @param data The default data object
*/
public ProcessResultBase(Object data) {
super();
setData(data);
} // end ProcessResultBase
/**
* Convenience constructor to set result object
* and singleForm status.
*
* @param data The default data object
*/
public ProcessResultBase(Object data, boolean singleForm) {
super();
setData(data);
setSingleForm(singleForm);
} // end ProcessResultBase
/**
* Convenience constructor to set forwarding advice.
*
* @param dispatch The default dispatch advice
*/
public ProcessResultBase(String dispatch) {
super();
setDispatch(dispatch);
} // end ProcessResultBase
} // end ProcessResultBase
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ProcessResult.java
Index: ProcessResult.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
// ----------------------------------------------------------------------
/**
* Convenient wrapper for the result of a process.
* <p>
* The result property returns any object generated by the
* process that is to be returned to the presentation tier.
*
* The <b>messages</b> property is a list of any confirmation
* messages to be displayed by the presentation tier.
* These may be keys into a resource bundle, or literal text,
* depending on whether the application is localized.
*
* The <b>dispatchPath</b> property returns any special advice regarding
* the next step in the workflow. Null indicates the nominal "success"
* path should be followed.
*
* The <b>data</b> property is any actual data returned from storage.
* This may be a single record or a collection of records
* (see <code>isSingleForm()</code>).
*
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public interface ProcessResult {
/**
* Return the attribute name for the result object.
* <p>
* Typically, this will be set by the caller but is provided
* in case a special name must be used or a way is needed to
* distingish between result objects.
*
* @return the name
*/
public String getName();
/**
* Set the attribute name for this result object.
*
* @param name The new name
*/
public void setName(String name);
/**
* Return the scope under which to store this result object.
*
* @return the scope
*/
public String getScope();
/**
* Set the scope under which to store this result object.
*
* @param scope The new scope
*/
public void setScope(String scope);
/**
* Return the single-form state:
* list of 0 or more records=FALSE, exactly one record=TRUE.
*
* @returns True if this is a single record
*/
public boolean isSingleForm();
/**
* Set the single-form state:
* list of 0 or more records=FALSE, exactly one record=TRUE.
*
* @param Set to true for single form.
*/
public void setSingleForm(boolean singleForm);
/**
* Return the exposed state.
*
* @return True if the result should be exposed
*/
public boolean isExposed();
/**
* Indicates whether the result should be exposed
* to the rest of the application through a context.
*
* @param multiple The new exposed
*/
public void setExposed(boolean exposed);
/**
* Return the data object.
*
* @returns The data object
*/
public Object getData();
/**
* Assign a new data object.
*
* @param data The new data object
*/
public void setData(Object data);
/**
* Return whether data object has been set.
*
* @returns True if this result contains a data object
*/
public boolean isData();
/**
* Return whether the result of this ProcessResult is a collection of
* contains other ProcessResult objects to be handled individually.
* This allows processes to be combined on the business tier and
* returned to controller as a single operation.
*
* @returns True if this ProcessResult contains other ProcessResults
* objects
*/
public boolean isAggregate();
/**
* Assign a new container state.
*
* @param aggregate Set to true for aggregate result
*/
public void setAggregate(boolean aggregate);
/**
* Return the messages list.
*
* @returns The message list
*/
public List getMessages();
/**
* Return whether there are any messages queued.
*
* @returns True if there are messages queued.
*/
public boolean isMessages();
/**
* Add a message to the list.
* Instantiate messages if it does not already exist.
*
* @returns True if message added.
*/
public boolean addMessage(Object message);
/**
* The dispatch property can be used to re-route control to an non-default location,
* either as a system path or via a logical name (e.g ActionForward).
*
* @see <code>setDispatchPath()</code>
*
* @returns The dispatch advice
*/
public String getDispatch();
/**
* Field to store dispatch property.
*/
public void setDispatch(String dispatch);
/**
* Return whether dispatch advice has been set.
*
* @returns True if dispatch advice has been set.
*/
public boolean isDispatch();
/**
* Return whether dispatch advice is suppose to be a
* true path or a logical name (e.g. ActionForward)
*
* @returns True if dispatch advice is an actual path
*/
public boolean isDispatchPath();
/**
* Indicates whether dispatch advice (if any) is suppose to be a
* path or a logical name (e.g. ActionForward).
*
* @param dispatchPath The new dispatch advice
*/
public void setDispatchPath(boolean dispatchPath);
}
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ProcessBeanBase.java
Index: ProcessBeanBase.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.Locale;
import java.util.Map;
// import org.apache.commons.beanutils.BeanUtils; // Struts 1.1
import org.apache.struts.util.BeanUtils; // Struts 1.0.x
import org.apache.commons.scaffold.lang.ChainedException;
/**
* Base implementation of ProcessBean with default functionality.
* The only method that must be overridden is
* <code>Object execute(Object)</code>.
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public abstract class ProcessBeanBase implements ProcessBean {
// ----------------------------------------------------------- Properties
/**
* The locale for this bean instance, if any.
*/
private Locale locale = null;
/**
* Return the locale for this bean instance.
* @return the locale
*/
public Locale getLocale() {
return this.locale;
}
/**
* Set the locale for this bean instance.
* @param locale The new locale
*/
public void setLocale(Locale locale) {
this.locale = locale;
}
/**
* The remote server object for this bean instance, if any.
* This is often an application-scope object that can be used
* to process a JDBC query or equivalent.
* By default, the ProcessAction will set this to any
* application scope object found under the key "REMOTE_SERVER",
* or to null.
*/
private Object server = null;
/**
* Return the remote server, if any.
* @return the remote server
*/
public Object getRemoteServer() {
return this.server;
}
/**
* Set the new remote server.
* @param server The new server
*/
public void setRemoteServer(Object server) {
this.server = server;
}
// --------------------------------------------------------- Public Methods
/**
* Perform business logic for this bean.
* Called by other execute signatures (after populating
* subclass properties).
* The default implementation returns the bean instance (this).
* Subclasses should override to provide functionality.
* @exception Subclasses can throw any Exception
*/
public Object execute() throws Exception {
return this;
} // end execute
/**
* Perform business logic for this instance by obtaining any
* properties from the parameters object.
* The base implementation casts the parameters as a Map,
* populates the bean, and returns execute().
* @exception Subclasses can throw any Exception
*/
public Object execute(Object parameters) throws Exception {
if (parameters!=null) {
Map map = (Map) parameters;
BeanUtils.populate(this,map);
}
return execute();
} // end execute
// end ProcessBeanBase
}
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ProcessBean.java
Index: ProcessBean.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.Locale;
import java.util.Map;
/**
* Simple helper bean that can be used to encapsulate a method
* representing a business process.
* <p>
* The business logic should be implemented in one of the supplied
* execute methods, or by another method called by one of these.
* A concrete subclass may return a default scope and attribute
* name to use when storing the bean (if applicable).
* <p>
* The preferred approach is to implement the <code>Object
* execute(Object)</code> signature, and use execute() to pass
* null, some other default value. If a default value is not
* possible, it is recommended that <code>execute() throw an
* or throw a UnsupportedOperationException.
* <p>
* Known implementations: BusinessBeanBase.
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public interface ProcessBean {
// --------------------------------------------------------- Properties
/**
* The session attribute key for our user profile bean ["userProfile"].
*/
public static String USER_PROFILE_KEY = "userProfile";
/**
* Return the locale for this bean instance.
*
* @return the locale
*/
public Locale getLocale();
/**
* Set the locale for this bean instance.
*
* @param locale The new locale
*/
public void setLocale(Locale locale);
/**
* The remote server object for this bean instance, if any.
* <p>
* This is often an application-scope object that can be used
* to process a JDBC query or equivalent.
* By default, the <code>ProcessAction</code> will set this to any
* application scope object found under the key
* <code>BaseAction.REMOTE_SERVER</code> or to null.
*
* @return the remote server
*/
public Object getRemoteServer();
/**
* Set the remote server
*
* @param server The new server
*/
public void setRemoteServer(Object server);
// ------------------------------------------------------- Public Methods
/**
* Perform business logic for this bean, often by passing default
* values to the <code>Object execute(Object)</code> signature.
* If there is no default, it is recommended that a subclass throw
* an UnsupportedOperationException instead.
*
* @exception Throws Exception on any error. A subclass of
* ChainedException is recommended.
*/
public Object execute() throws Exception;
/**
* Perform business logic for this, by retrieving any settings from
* the parameters object and returning a result object.
*
* @exception Throws Exception on any error. A subclass of
* <code>ChainedException</code> is recommended.
* @param parameters The map or other object to use with this operation
*/
public Object execute(Object parameters) throws Exception;
}
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/Mapped.java
Index: Mapped.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.Map;
/**
* Simple interface to describe an object that can set and
* return its public properties via a Map.
* business logic object.
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public interface Mapped {
// ------------------------------------------------------- Public Methods
/**
* Return a Map of this object's public properties.
* The values may be of any type, though an implementation
* may choose to return only Strings. The keys for the entries
* may or may not exactly match the true public properties
* of the implementing object, as needed.
* @exception Throws Exception on any error. A subclass of
* ChainedException is recommended.
*/
public Map getMap() throws Exception;
/**
* Set this object's public properties via a Map.
* The values may be of any type, though a subclass may
* choose to expect only Strings. The keys for the entries
* may or may not exactly match the true public properties,
* of the object, as required.
* @exception Throws Exception on any error. A subclass of
* ChainedException is recommended.
*/
public void setMap(Map map) throws Exception;
/**
* Returns the value to which this map maps the specified key
* -- the equivalent of <code>Object getMap().get(key).
* @exception Throws Exception on any error. A subclass of
* ChainedException is recommended.
* @param key - key whose associated value is to be returned.
*/
public Object getValue(Object key) throws Exception;
/**
* Associates the specified value with the specified key in
* the property map for this object
* -- the equivalent of <code>getMap().put(key,value).
* @param key - key with which the specified value is to be associated.
* @param value - value to be associated with the specified key.
* @exception Throws Exception on any error. A subclass of
* ChainedException is recommended.
*/
public Object setValue(Object key, Object value) throws Exception;
}
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/Localized.java
Index: Localized.java
===================================================================
package org.apache.commons.scaffold.util;
import java.util.Locale;
/**
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public interface Localized {
// ------------------------------------------------------- Public Methods
/**
*/
public Locale getLocale();
/**
*/
public void setLocale(Locale locale);
}
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/LabelValueBean.java
Index: LabelValueBean.java
===================================================================
package org.apache.commons.scaffold.util;
/**
* Simple JavaBean to represent label-value pairs for use in collections
* that are utilized by the <code><form:options></code> tag.
* <p>
* If you are also use Struts 1.1 or later, you may prefer to use the
* [<code>org.apache.struts.util.LabelValueBean</code>] class instead.
* The classes are identical.
*
* @author Craig R. McClanahan
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public class LabelValueBean {
// ----------------------------------------------------------- Constructors
/**
* Construct a new LabelValueBean with the specified values.
*
* @param label The label to be displayed to the user
* @param value The value to be returned to the server
*/
public LabelValueBean(String label, String value) {
this.label = label;
this.value = value;
}
// ------------------------------------------------------------- Properties
/**
* The label to be displayed to the user.
*/
protected String label = null;
public String getLabel() {
return (this.label);
}
/**
* The value to be returned to the server.
*/
protected String value = null;
public String getValue() {
return (this.value);
}
// --------------------------------------------------------- Public Methods
/**
* Return a string representation of this object.
*/
public String toString() {
StringBuffer sb = new StringBuffer("LabelValueBean[");
sb.append(this.label);
sb.append(", ");
sb.append(this.value);
sb.append("]");
return (sb.toString());
}
}
/*
* $Header: /home/cvs/jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/LabelValueBean.java,v 1.1 2002/08/14 17:52:18 husted Exp $
* $Revision: 1.1 $
* $Date: 2002/08/14 17:52:18 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/FunctionBean.java
Index: FunctionBean.java
===================================================================
package org.apache.commons.scaffold.util;
public class FunctionBean {
/**
* The count
*/
private Integer count = null;
/**
* Return the count.
* @return the count
*/
public Integer getCount() {
return (this.count);
}
/**
* Set the count.
* @param count The new count
*/
public void setCount(Integer count) {
this.count = count;
}
}
1.1 jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/Executable.java
Index: Executable.java
===================================================================
package org.apache.commons.scaffold.util;
/**
* Simple interface to describe public methods on a
* business logic object.
*
* @author Ted Husted
* @version $Revision: 1.1 $ $Date: 2002/08/14 17:52:18 $
*/
public interface Executable {
// ------------------------------------------------------- Public Methods
/**
* Perform business logic for this bean, often by passing default
* values to the <code>Object execute(Object)</code> signature.
* If there is no default, it is recommended that a subclass throw
* an UnsupportedOperationException instead.
* @exception Throws Exception on any error. A subclass of
* ChainedException is recommended.
*/
public Object execute() throws Exception;
/**
* Perform business logic for this, by retrieving any settings from
* the parameter object, and return a result object.
* @exception Throws Exception on any error. A subclass of
* ChainedException is recommended.
*/
public Object execute(Object parameters) throws Exception;
}
/*
*
* Copyright (c) 2002 Synthis Corporation.
* 430 10th Street NW, Suite S-108, Atlanta GA 30318, U.S.A.
* All rights reserved.
*
* This software is licensed to you free of charge under
* the Apache Software License, so long as this copyright
* statement, list of conditions, and comments, remains
* in the source code. See bottom of file for more
* license information.
*
* This software was written to support code generation
* for the Apache Struts J2EE architecture by Synthis'
* visual application modeling tool Adalon.
*
* For more information on Adalon and Struts code
* generation please visit http://www.synthis.com
*
*/
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Scaffold", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>