/*
* This file is part of PFIXCORE.
*
* PFIXCORE is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PFIXCORE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with PFIXCORE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package de.schlund.pfixcore.generator;
import java.io.IOException;
import de.schlund.pfixxml.resources.FileResource;
import de.schlund.util.statuscodes.StatusCode;
/**
* IWrappers are objects which aggregate part of the submitted data
* of a HTTP post or get event in a typesafe way and present getter
* and setter methods to manipulate that data.</br>
* Classes which implement the IWrapper interface are not written by
* hand, but are autogenerated from a describtion written in a
* special xml format.</br>
* From the application programmers point of view IWrappers
* are never instanciated directly. Following snipplet
* shows the use of an <code>IWrapper</code> in the handleSubmittedData method
* of an {@link IHandler}.
* <pre>
* public void handleSubmittedData(Context context, IWrapper wrapper) throws Exception {
* AdultInfo info = (AdultInfo) wrapper;
* }
* </pre>
* <br/>
* For more information see the 'IWrapper_XML_Description_Language.txt' in the docs
* directory of the Pfixcore package.
*/
public interface IWrapper extends Comparable<IWrapper> {
void init(String prefix) throws Exception;
void initLogging(FileResource logdir, String pagename, String visitid);
void tryParamLogging() throws IOException;
void tryErrorLogging() throws IOException;
void load(RequestData req) throws Exception;
/**
* Load the IWrapper's typed data from the String representations set via the
* setStringValXXX methods, i.e. the string values are processed (checked and casted)
* just like values provided by a RequestData object.
* This method requires that the IWrapper is already initialized (that the init
* method has been called). Amongst others it can be used to manually instantiate
* and populate IWrapper objects within unit tests.
* @throws Exception
*/
void loadFromStringValues() throws Exception;
boolean errorHappened();
void defineOrder(int order);
// The reason for these to not being called get* is to avoid nameclashes with
// descendents who may want to use a Parameter called e.g. "Prefix" (which would
// result in a method getPrefix be generated)
Integer gimmeOrder();
String gimmePrefix();
IHandler gimmeIHandler();
IWrapperParam[] gimmeAllParams();
IWrapperParam[] gimmeAllParamsWithErrors();
IWrapperParamDefinition[] gimmeAllParamDefinitions();
void addSCode(IWrapperParam param, StatusCode scode, String[] args, String level);
}
|