|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuws.job.SerializableUWSObject
uws.service.AbstractUWS<JobList<AbstractJob>,AbstractJob>
uws.service.ExtendedUWS
public class ExtendedUWS
Convenient implementation of AbstractUWS.
Contrary to BasicUWS this implementation of a UWS can manage several JobLists of a different kind of Job.
That means it is possible to manage a JobList of JobA and another JobList of JobB whereas BasicUWS could manage
several JobList only of JobA or of JobB.
IMPORTANT: THE EXTENSIONS OF AbstractJob MUST CONTAIN A CONSTRUCTOR
WITH ONLY ONE PARAMETER OF TYPE MAP<STRING,STRING> !!!
public class MyServlet extends HttpServlet {
private ExtendedUWS uws = null;
public void init(ServletConfig conf) throws ServletException {
super.init(conf);
try{
uws = new ExtendedUWS();
uws.addJobList(new JobList<JobA>("JobListA"), JobA.class);
uws.addJobList(new JobList<JobB>("JobListB"), JobB.class);
}catch(UWSException ex){
ex.printStackTrace();
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());
}
}
}
| Nested Class Summary | |
|---|---|
protected class |
ExtendedUWS.AddJobWithConstructor
Action AddJob which initializes the attribute jlDestination with the job list in which a job must be added. |
| Field Summary | |
|---|---|
protected java.util.Map<JobList<? extends AbstractJob>,java.lang.Class<? extends AbstractJob>> |
assocJobListClass
Association between each JobList and the class object of the type of job that this JobList manages. |
protected java.util.Map<JobList<? extends AbstractJob>,java.lang.reflect.Constructor<? extends AbstractJob>> |
assocJobListConstructor
Association between each JobList and the constructor to use when a job must be created and added into this JobList. |
protected JobList<? extends AbstractJob> |
jlDestination
Current JobList. |
| Fields inherited from class uws.service.AbstractUWS |
|---|
choosenSerializer, defaultSerializer, description, executedAction, homePage, homeRedirection, mapJobLists, name, reInitUrlInterpreter, serializers, urlInterpreter, userIdentifier, uwsActions |
| Constructor Summary | |
|---|---|
ExtendedUWS()
Builds an ExtendedUWS. |
|
ExtendedUWS(java.lang.String baseURI)
Builds an ExtendedUWS with its base URI. |
|
ExtendedUWS(UWSUrl urlInterpreter)
Builds an ExtendedUWS with the UWS URL interpreter to use. |
|
| Method Summary | ||
|---|---|---|
protected void |
addConstructor(JobList<? extends AbstractJob> jl)
Searches in assocJobListClass for the Class object of the given jobs list,
gets the constructor with only one parameter of type Map<String,String> into this Class object,
and finally saves in assocJobListConstructor the association between the given jobs list and the found constructor. |
|
|
addJobList(JobList<J> jl,
java.lang.Class<J> cl)
Adds a JobList with the constructor of the type of job to use. |
|
AbstractJob |
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. |
|
boolean |
destroyJobList(JobList<AbstractJob> jl)
Destroys the given jobs list. |
|
protected java.lang.reflect.Constructor<? extends AbstractJob> |
getConstructor(JobList<? extends AbstractJob> jl)
Gets the constructor of the type of job to use. |
|
boolean |
removeJobList(JobList<AbstractJob> jl)
Removes the given jobs list from this UWS. |
|
| 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.util.Map<JobList<? extends AbstractJob>,java.lang.Class<? extends AbstractJob>> assocJobListClass
protected transient java.util.Map<JobList<? extends AbstractJob>,java.lang.reflect.Constructor<? extends AbstractJob>> assocJobListConstructor
protected JobList<? extends AbstractJob> jlDestination
| Constructor Detail |
|---|
public ExtendedUWS()
AbstractUWS.AbstractUWS(),
AbstractUWS.replaceUWSAction(uws.service.actions.UWSAction),
ExtendedUWS.AddJobWithConstructor
public ExtendedUWS(java.lang.String baseURI)
throws UWSException
baseURI - The base UWS URI.
UWSException - If there is an error when calling the constructor super(String).AbstractUWS.AbstractUWS(String),
AbstractUWS.replaceUWSAction(uws.service.actions.UWSAction),
ExtendedUWS.AddJobWithConstructorpublic ExtendedUWS(UWSUrl urlInterpreter)
urlInterpreter - The UWS URL interpreter this UWS must use.AbstractUWS.AbstractUWS(UWSUrl),
AbstractUWS.replaceUWSAction(uws.service.actions.UWSAction),
ExtendedUWS.AddJobWithConstructor| Method Detail |
|---|
protected final java.lang.reflect.Constructor<? extends AbstractJob> getConstructor(JobList<? extends AbstractJob> jl)
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 !
jl - The job list which manages the kind of job whose the constructor must be extracted.
UWSException - If it is impossible to extract the constructor with one parameter
(Map<String, String>) from a stored class object.addConstructor(JobList)
protected final void addConstructor(JobList<? extends AbstractJob> jl)
throws UWSException
assocJobListClass for the Class object of the given jobs list,
gets the constructor with only one parameter of type Map<String,String> into this Class object,
and finally saves in assocJobListConstructor the association between the given jobs list and the found constructor.
jl - The jobs list with which a job constructor must be associated.
UWSException - If no corresponding Class object can be found
or if the found class is abstract
or if there is no constructor with only one parameter of type Map<String,String>.
public <J extends AbstractJob> boolean addJobList(JobList<J> jl,
java.lang.Class<J> cl)
throws UWSException
J - The type of job that the given JobList manages.jl - The JobList to add.cl - The class of job J which are managed in the given JobList.
UWSException - If the given class object corresponds to an abstract class
or if the given class does not contain a constructor with only one parameter of type Map<String,String>.public boolean removeJobList(JobList<AbstractJob> jl)
AbstractUWS
removeJobList in class AbstractUWS<JobList<AbstractJob>,AbstractJob>jl - The jobs list to remove.
JobList.removeAll(),
JobList.setUWS(AbstractUWS)public boolean destroyJobList(JobList<AbstractJob> jl)
AbstractUWS
destroyJobList in class AbstractUWS<JobList<AbstractJob>,AbstractJob>jl - The jobs list to destroy.
JobList.clear(),
JobList.setUWS(AbstractUWS)
public AbstractJob createJob(java.util.Map<java.lang.String,java.lang.String> parameters)
throws UWSException
AbstractUWSAbstractJob) which parameterized this implementation of AbstractUWS.
createJob in class AbstractUWS<JobList<AbstractJob>,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),
Constructor.newInstance(Object...)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||