D. How to customize a UWS ?

1. Name, description and home page

UWS resource

In the IVOA Recommendation, jobs list and jobs are described as web resources. Thus there is an XML schema for both of them. About the UWS itself nothing exist: no URI, no XML schema and no actions.

However in this library the UWS can be viewed also as a web-resource. This resource corresponds to the URI /{uws} which is the base of all the other URIs: /{uws}/{job-list1}, /{uws}/{job-list2}, /{uws}/{job-list1}/{job1}, .... Like a jobs list and a job, this resource returns by default a XML document whose the format is:

UWS Name & Description

The UWS name is by default the corresponding part of the URI. For instance: the URI of the job list timers of the first UWS example is /basic/timers, so the default UWS name is basic. This name can be changed thanks to the method setName(String).

Changing the UWS name does not change the URI ! If the URI of a UWS is /basic and if you have changed its name into My first UWS, the URI will still be /basic !

By default a UWS has no description. But if you want, you can set one by using the method setDescription(String).

Here is example:

public class MyExtendedUWS extends QueuedExtendedUWS {
	...
	public MyExtendedUWS(int nbMaxRunningJobs) throws UWSException {
		super(nbMaxRunningJobs);
		
		// Set name:
		setName("Algorithms");
		
		// Set description:
		setDescription("This UWS aims to manage several JobLists. Each one manages one different type of Job. Jobs are \"famous\" algorithms which may take a long time in function of their parameters.");
		
		...
	}
	...
}

Home Page

As said previously the home page of a UWS is its corresponding resource (by default a XML document). However, you can replace this resource by another one with the method setHomePage(String) or setHomePage(URL, boolean). With the second method you can specify the URL of the replacement resource and whether a redirection to this resource must be done. If false, the full content of the specified resource will be copied when the home page of the UWS will be asked. In another hand, the first method always does a redirection to the specified resource (which can be either a URL or a URI).

Here is an example:

public class UWSAlgorithms extends HttpServlet {
	...
	@Override
	public void init(ServletConfig config) throws ServletException {
		...
		// Create our UWS (with a user identification):
		uws = new MyExtendedUWS(3);
		...
		// Set the UWS home page:
		uws.setHomePage(contextPath+"/extended.html");
		...
	}
	...
}

To go back to the default resource, use the method setDefaultHomePage().

Add actions

Provided this resource has not been described in the IVOA Recommendation, there is no actions for this resource contrary to the jobs list and job resources. Nevertheless with this library it is possible: for more details see the part D.6. Actions.