|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.keel.services.model.defaultmodel.DefaultModelRequest
| Field Summary | |
private java.util.Map |
attributes |
private boolean |
configured |
private Context |
keelContext |
private Logger |
log |
private Configuration |
myConfig |
private ModelValidator |
myDefaultValidator |
private java.lang.String |
myModel |
private java.util.Map |
params |
private java.util.Map |
previousRequest |
protected KeelServiceableDelegate |
svcDelegate |
private java.util.Map |
validationErrors |
| Fields inherited from interface org.keel.services.model.ModelRequest |
ROLE |
| Constructor Summary | |
DefaultModelRequest() |
|
| Method Summary | |
void |
addError(java.lang.String name, java.lang.String message)Add a validation error to the collection of errors in this request. |
protected ModelResponse |
afterExecute(ModelResponse res, Configuration modelConfig) |
void |
configure(Configuration conf)Pass the Configuration to the Configurable class. |
void |
copyFrom(KeelRequest newRequest)Copy the values from another Keel Request into this one. |
ModelResponse |
createResponse()Used by the model to generate the "empty" response object, which the model then populates with Inputs, Outputs and Commands |
KeelRequest |
deserialize(byte[] bytes) |
void |
enableLogging(Logger logger)Provide component with a logger. |
ModelResponse |
execute()Actually execute the requested model object's logic, returning the ModelResponse it creates |
java.lang.Object |
getAttribute(java.lang.String key) |
java.util.Map |
getAttributes() |
java.lang.Object |
getConfiguration()Get the configuration object for this Request's Model |
Context |
getContext()Get the Keel Context object indiciating the current context for this request. |
java.lang.Object |
getDefaultService(java.lang.String role)This method is used by Model objects to get access to other services or services in the system. |
java.lang.String |
getDomain() |
java.util.Map |
getErrors()Return a map of error names and messages produced by validation of the parameters before entering this model. |
Context |
getKeelContext() |
java.lang.String |
getModel()Return the name of the model currently being requested |
java.util.Set |
getOperations() |
java.lang.Object |
getParameter(java.lang.String paramKey)Retrieve the named parameter as a "raw" object - e.g. |
java.lang.Object[] |
getParameterAsArray(java.lang.String name)Return the values of a multi-valued parameter as an array of objects. |
java.util.Date |
getParameterAsDate(java.lang.String name)Return the value of the specified parameter as a date |
java.util.Date |
getParameterAsDate(java.lang.String name, java.util.Date defaultValue)Return the specified parameter's value as a date, or the default value if no such parameter exists. |
double |
getParameterAsDouble(java.lang.String name)Return the specified parameter's value as a double |
double |
getParameterAsDouble(java.lang.String name, double defaultValue) |
float |
getParameterAsFloat(java.lang.String name)Return the value of a parameter as a float |
float |
getParameterAsFloat(java.lang.String name, float defaultValue)Return the specified parameter's value as a float |
int |
getParameterAsInt(java.lang.String name)Type-specific access to request parameters ***** |
int |
getParameterAsInt(java.lang.String name, int defaultValue)Return the specified parameter as an integer, returning the supplied default value if no such parameter exists. |
java.util.List |
getParameterAsList(java.lang.String name)Return the values of a parameter which has more than one value |
java.util.List |
getParameterAsList(java.lang.String name, java.util.List defaultValue)Return the values of a parameter which has more than one value |
long |
getParameterAsLong(java.lang.String name)Return the specified parameter as a long |
long |
getParameterAsLong(java.lang.String name, long defaultValue)Return the specified parameter as a long, or the default value if there is no such parameter. |
java.lang.String |
getParameterAsString(java.lang.String name)Return the specified parameter's value as a string |
java.lang.String |
getParameterAsString(java.lang.String name, java.lang.String defaultValue) |
java.util.Map |
getParameters()Retrieve the entire mapping of parameters and values |
java.util.Map |
getPreviousRequest()A request for a model may involve a jump to another model, or back to the same model in the event of an error (for the user to input new data, for example). |
java.lang.Object |
getService(java.lang.String role, java.lang.String hint)This method first checks if the current model is securable. |
java.lang.Object |
getService(java.lang.String role, java.lang.String hint, Context ctx)This method is used by a model when it wants to access a particular service (often a factory for another service) and specify the hint itself. |
int |
getUid()Return the user identifier of the user who has submitted this request. |
void |
recycle()Model requests can be "recycled", that is, cleared and used again for a new request. |
byte[] |
serialize() |
void |
service(ServiceManager manager)Pass the ServiceManager to the Serviceable. |
void |
setAttribute(java.lang.String key, java.lang.Object value)Set the value of an attribute of this response |
void |
setKeelContext(Context keelContext) |
void |
setModel(java.lang.String modelName)The name of the model and the state allow us to determine the actual Java class that is going to be invoked, and how we're going to communicate with it |
void |
setParameter(java.lang.String paramKey, java.lang.Object param) |
void |
setPreviousRequest(java.util.Map newPrevious) |
private Command |
validate(Model newModel) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Logger log
private ModelValidator myDefaultValidator
protected KeelServiceableDelegate svcDelegate
private java.util.Map params
private boolean configured
private java.util.Map attributes
private Context keelContext
private java.lang.String myModel
private Configuration myConfig
private java.util.Map previousRequest
private java.util.Map validationErrors
| Constructor Detail |
public DefaultModelRequest()
| Method Detail |
public java.lang.String getModel()
KeelRequestgetModel in interface KeelRequestpublic void recycle()
recycle in interface Recyclablepublic java.lang.Object getParameter(java.lang.String paramKey)
getParameter in interface KeelRequestparamKey - The name of the requested parameterpublic java.util.Map getParameters()
getParameters in interface KeelRequest
public void setParameter(java.lang.String paramKey,
java.lang.Object param)
setParameter in interface KeelRequestpublic void setModel(java.lang.String modelName)
setModel in interface KeelRequest
public ModelResponse execute()
throws ModelException
ModelRequestexecute in interface ModelRequestModelException
public ModelResponse createResponse()
throws ModelException
ModelRequestcreateResponse in interface ModelRequestModelExceptionpublic Context getContext()
ModelRequestgetContext in interface ModelRequestpublic int getUid()
ModelRequestgetUid in interface ModelRequestpublic java.lang.String getDomain()
getDomain in interface ModelRequestpublic java.util.Map getPreviousRequest()
ModelRequestgetPreviousRequest in interface ModelRequestpublic void setPreviousRequest(java.util.Map newPrevious)
setPreviousRequest in interface ModelRequest
public void configure(Configuration conf)
throws ConfigurationException
ConfigurableConfiguration to the Configurable class.
configure in interface Configurableconf - the class configurations. Must not be null.ConfigurationException - if an error occurspublic java.lang.Object getConfiguration()
ModelRequestgetConfiguration in interface ModelRequest
protected ModelResponse afterExecute(ModelResponse res,
Configuration modelConfig)
throws ModelException
ModelExceptionpublic java.lang.Object getAttribute(java.lang.String key)
getAttribute in interface KeelRequestpublic java.util.Map getAttributes()
getAttributes in interface KeelRequest
public void setAttribute(java.lang.String key,
java.lang.Object value)
KeelRequestsetAttribute in interface KeelRequestpublic java.util.Set getOperations()
public java.lang.Object getService(java.lang.String role,
java.lang.String hint)
throws ModelException
getService in interface ModelRequestModelException
public byte[] serialize()
throws java.io.IOException
serialize in interface KeelRequestjava.io.IOException
public KeelRequest deserialize(byte[] bytes)
throws java.io.IOException
deserialize in interface KeelRequestjava.io.IOException
public void copyFrom(KeelRequest newRequest)
throws ModelException
ModelRequestcopyFrom in interface ModelRequestnewRequest - The request to copy fromModelException - If an error occurs during the copypublic void enableLogging(Logger logger)
LogEnabledenableLogging in interface LogEnabledlogger - the logger. Must not be null.
public java.lang.Object getDefaultService(java.lang.String role)
throws ModelException
ModelRequestgetDefaultService in interface ModelRequestModelException
public java.lang.Object getService(java.lang.String role,
java.lang.String hint,
Context ctx)
throws ModelException
ModelRequestgetService in interface ModelRequestModelException
public void service(ServiceManager manager)
throws ServiceException
ServiceableServiceManager to the Serviceable. The Serviceable implementation should use the specified ServiceManager to acquire the components it needs for execution.
service in interface Serviceablemanager - The ServiceManager which this Serviceable uses. Must not be null.ServiceException - if an error occurspublic Context getKeelContext()
getKeelContext in interface KeelContextualizableKeelContextualizable.getKeelContext()
public void setKeelContext(Context keelContext)
throws ContextException
setKeelContext in interface KeelContextualizableContextExceptionKeelContextualizable.setKeelContext(org.apache.avalon.framework.context.Context)public int getParameterAsInt(java.lang.String name)
getParameterAsInt in interface ModelRequestname - Name of the required parameter
public int getParameterAsInt(java.lang.String name,
int defaultValue)
ModelRequestgetParameterAsInt in interface ModelRequestname - Name of the required parameterdefaultValue - The value returned if no such parameter existspublic java.lang.String getParameterAsString(java.lang.String name)
ModelRequestgetParameterAsString in interface ModelRequestname - Name of the required parameter
public java.lang.String getParameterAsString(java.lang.String name,
java.lang.String defaultValue)
getParameterAsString in interface ModelRequestname - Name of the required parameterdefaultValue -public java.lang.Object[] getParameterAsArray(java.lang.String name)
ModelRequestgetParameterAsArray in interface ModelRequestname - Name of the required parameterpublic java.util.Date getParameterAsDate(java.lang.String name)
ModelRequestgetParameterAsDate in interface ModelRequestname - Name of the required parameter
public java.util.Date getParameterAsDate(java.lang.String name,
java.util.Date defaultValue)
ModelRequestgetParameterAsDate in interface ModelRequestname - Name of the required parameterdefaultValue - The date value to return if no such parameter existspublic java.util.List getParameterAsList(java.lang.String name)
ModelRequestgetParameterAsList in interface ModelRequestname - Name of the required parameter
public java.util.List getParameterAsList(java.lang.String name,
java.util.List defaultValue)
ModelRequestgetParameterAsList in interface ModelRequestname - Name of the required parameterdefaultValue - The list returned if no such parameter exists.
public long getParameterAsLong(java.lang.String name,
long defaultValue)
ModelRequestgetParameterAsLong in interface ModelRequestname - Name of the required parameterdefaultValue - The value to be returned if no such parameter existspublic java.util.Map getErrors()
ModelRequestgetErrors in interface ModelRequestpublic double getParameterAsDouble(java.lang.String name)
ModelRequestgetParameterAsDouble in interface ModelRequestname - Name of the required parameterpublic float getParameterAsFloat(java.lang.String name)
ModelRequestgetParameterAsFloat in interface ModelRequestname - Name of the required parameter
public float getParameterAsFloat(java.lang.String name,
float defaultValue)
ModelRequestgetParameterAsFloat in interface ModelRequestname - Name of the required parameterdefaultValue -
public double getParameterAsDouble(java.lang.String name,
double defaultValue)
getParameterAsDouble in interface ModelRequestname - Name of the required parameterdefaultValue -public long getParameterAsLong(java.lang.String name)
ModelRequestgetParameterAsLong in interface ModelRequestname - Name of the required parameter
public void addError(java.lang.String name,
java.lang.String message)
addError in interface ModelRequestname - A name for this error message, which may (or may not) correspond to the UI element from which the error originated.message - A human-readable error message to be displayed to the user. Messages beginning with "$" will be taken to be internationalized keys to look up in the appropriate message bundle for this locale.
private Command validate(Model newModel)
throws ModelException,
ConfigurationException
ModelExceptionConfigurationException
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||