|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uws.job.SerializableUWSObject uws.service.AbstractUWS<JobList<J>,J> uws.service.BasicUWS<J>
public class BasicUWS<J extends AbstractJob>
Convenient implementation of AbstractUWS
.
You do not have to extend this implementation to create a job. The function createJob(Map)
uses
the Constructor
found in the Class
given at the instantiation of this UWS to create a new job.
Thus whatever is the type of the extension of AbstractJob
this method will always call its constructor
which contains a Map
IMPORTANT: THE EXTENSION OF AbstractJob
MUST CONTAIN A CONSTRUCTOR
WITH ONLY ONE PARAMETER OF TYPE MAP<STRING,STRING> !!!
public class MyServlet extends HttpServlet { private BasicUWS<JobImpl> uws = null; public void init(ServletConfig conf) throws ServletException { super.init(conf); try{ uws = new BasicUWS<JobImpl>(JobImpl.class); uws.addJobList(new JobList<JobImpl>("myJobList")); }catch(UWSException ex){ throw new ServletException(ex); } } public void destroy(){ uws.removeAllJobLists(); super.destroy(); } public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try{ uws.executeRequest(request, response); }catch(UWSException ex){ res.sendError(uwsEx.getHttpErrorCode(), uwsEx.getMessage()); } } }
Field Summary | |
---|---|
protected java.lang.reflect.Constructor<J> |
constructor
The constructor to use when the method createJob(Map) is called. |
protected java.lang.Class<J> |
jobClass
The class object of the type of job to manage. |
Fields inherited from class uws.service.AbstractUWS |
---|
choosenSerializer, defaultSerializer, description, executedAction, homePage, homeRedirection, mapJobLists, name, reInitUrlInterpreter, serializers, urlInterpreter, userIdentifier, uwsActions |
Constructor Summary | |
---|---|
BasicUWS(java.lang.Class<J> cl)
Builds a BasicUWS with the class object of the type of job to manage. |
|
BasicUWS(java.lang.Class<J> cl,
java.lang.String baseURI)
Builds a BasicUWS with the class object of the type of job to manage and the base UWS URI. |
|
BasicUWS(java.lang.Class<J> cl,
UWSUrl urlInterpreter)
Builds a BasicUWS with the class object of the type of job to manage and the UWS URL interpreter to use. |
Method Summary | |
---|---|
J |
createJob(java.util.Map<java.lang.String,java.lang.String> parameters)
Creates a job of the type (extension of AbstractJob ) which parameterized this implementation of AbstractUWS. |
protected java.lang.reflect.Constructor<J> |
getConstructor()
Gets the constructor of the type of job to use. |
Methods inherited from class uws.job.SerializableUWSObject |
---|
serialize, serialize, serialize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.lang.Class<J extends AbstractJob> jobClass
protected transient java.lang.reflect.Constructor<J extends AbstractJob> constructor
createJob(Map)
is called.
Constructor Detail |
---|
public BasicUWS(java.lang.Class<J> cl) throws UWSException
cl
- The class object of the type of job to manage.
UWSException
- AbstractUWS.AbstractUWS()
,
getConstructor()
public BasicUWS(java.lang.Class<J> cl, java.lang.String baseURI) throws UWSException
cl
- The class object of the type of job to manage.baseURI
- The base UWS URI.
UWSException
- AbstractUWS.AbstractUWS(String)
,
getConstructor()
public BasicUWS(java.lang.Class<J> cl, UWSUrl urlInterpreter) throws UWSException
cl
- The class object of the type of job to manage.urlInterpreter
- The UWS URL interpreter to use in this UWS.
UWSException
- AbstractUWS.AbstractUWS(UWSUrl)
,
getConstructor()
Method Detail |
---|
protected final java.lang.reflect.Constructor<J> getConstructor() throws UWSException
Gets the constructor of the type of job to use. This constructor has only one parameter of type Map<String,String>.
Note: If this UWS has just been de-serialized, the constructor is extracted one more time from the stored class object !
UWSException
- If it is impossible to extract the constructor with one parameter
(Map<String, String>) from the stored class object.public J createJob(java.util.Map<java.lang.String,java.lang.String> parameters) throws UWSException
AbstractUWS
AbstractJob
) which parameterized this implementation of AbstractUWS.
createJob
in class AbstractUWS<JobList<J extends AbstractJob>,J extends AbstractJob>
parameters
- The map of parameters to give to the constructor of AbstractJob
.
UWSException
- If any error occurs while creating the job.AbstractUWS.createJob(java.util.Map)
,
getConstructor()
,
Constructor.newInstance(Object...)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |