GNDMS 0.6.0
RESTful verison of GNDMS
Public Member Functions | Protected Member Functions | Protected Attributes | Package Functions | Private Attributes

de.zib.gndms.gndmc.AbstractClient Class Reference

An abstract client which implements the HTTP requests. More...

Inheritance diagram for de.zib.gndms.gndmc.AbstractClient:
de.zib.gndms.gndmc.dspace.DSpaceClient de.zib.gndms.gndmc.dspace.SliceClient de.zib.gndms.gndmc.dspace.SliceKindClient de.zib.gndms.gndmc.dspace.SubspaceClient de.zib.gndms.gndmc.gorfx.GORFXClient de.zib.gndms.gndmc.gorfx.TaskClient de.zib.gndms.gndmc.gorfx.TaskFlowClient de.zib.gndms.gndmc.gorfx.FullGORFXClient

List of all members.

Public Member Functions

 AbstractClient (final String serviceURL)
 The constructor.
final RestOperations getRestTemplate ()
 Gets the rest template.
final void setRestTemplate (final RestOperations restTemplate)
 Sets the rest template.
final String getServiceURL ()
 Gets the service url.
void setServiceURL (final String serviceURL)
 Sets the service url.

Protected Member Functions

 AbstractClient ()
 The constructor.
final< T > ResponseEntity< T > unifiedGet (final Class< T > clazz, final String url, final String dn)
 Executes a GET on a url, where the request header contains a given user name.
final< T > ResponseEntity< T > unifiedGet (final Class< T > clazz, final String url, final String dn, final String wid)
 Executes a GET on a url, where the request header contains a given user name and workflow id.
final< T, P > ResponseEntity< T > unifiedPost (final Class< T > clazz, final P parm, final String url, final String dn)
 Executes a POST on a url.
final< T, P > ResponseEntity< T > unifiedPost (final Class< T > clazz, final P parm, final String url, final String dn, final String wid)
 Executes a POST on a url.
final< T, P > ResponseEntity< T > unifiedPut (final Class< T > clazz, final P parm, final String url, final String dn)
 Executes a PUT on a url.
final< T, P > ResponseEntity< T > unifiedPut (final Class< T > clazz, final P parm, final String url, final String dn, final String wid)
 Executes a PUT on a url.
final ResponseEntity< Void > unifiedDelete (final String url, final String dn)
 Executes a DELETE on a url, where the request header contains a given user name.
final< T > ResponseEntity< T > unifiedDelete (final Class< T > clazz, final String url, final String dn)
 Executes a DELETE on a url, where the request header contains a given user name.
final ResponseEntity< Void > unifiedDelete (final String url, final String dn, final String wid)
 Executes a DELETE on a url, where the request header contains a given user name and workflow id.

Protected Attributes

final Logger logger = LoggerFactory.getLogger(this.getClass())
 The logger.

Package Functions

private< T, P > ResponseEntity< T > unifiedX (final HttpMethod x, final Class< T > clazz, final P parm, final String url, final String dn, final String wid)
 Executes a given HTTP method on a url.

Private Attributes

RestOperations restTemplate
 A rest template for internal use.
String serviceURL
 The service url like http://www.barz.org/gndms/<gridname>.

Detailed Description

An abstract client which implements the HTTP requests.

Author:
Ulrike Golas

Constructor & Destructor Documentation

de.zib.gndms.gndmc.AbstractClient.AbstractClient ( final String  serviceURL)

The constructor.

Parameters:
serviceURLThe base url of the grid.
                                                       {
                this.serviceURL = serviceURL;
        }

Member Function Documentation

final RestOperations de.zib.gndms.gndmc.AbstractClient.getRestTemplate ( )

Gets the rest template.

Returns:
The rest template.
                                                      {
                return restTemplate;
        }
final String de.zib.gndms.gndmc.AbstractClient.getServiceURL ( )

Gets the service url.

Returns:
The service url.
                                            {
                return serviceURL;
        }
final void de.zib.gndms.gndmc.AbstractClient.setRestTemplate ( final RestOperations  restTemplate)

Sets the rest template.

Parameters:
restTemplateThe rest template.
void de.zib.gndms.gndmc.AbstractClient.setServiceURL ( final String  serviceURL)

Sets the service url.

Parameters:
serviceURLThe service url.
                                                           {
                this.serviceURL = serviceURL;
        }
final ResponseEntity<Void> de.zib.gndms.gndmc.AbstractClient.unifiedDelete ( final String  url,
final String  dn,
final String  wid 
) [protected]

Executes a DELETE on a url, where the request header contains a given user name and workflow id.

Parameters:
urlThe url of the request.
dnThe user name.
widThe workflow id.
Returns:
The response as entity with Void body.
                                                           {
                return unifiedX(HttpMethod.DELETE, Void.class, null, url, dn, wid);
        }
final ResponseEntity<Void> de.zib.gndms.gndmc.AbstractClient.unifiedDelete ( final String  url,
final String  dn 
) [protected]

Executes a DELETE on a url, where the request header contains a given user name.

Parameters:
urlThe url of the request.
dnThe user name.
Returns:
The response as entity with Void body.
                                         {
                return unifiedX(HttpMethod.DELETE, Void.class, null, url, dn, null);
        }
final<T> ResponseEntity<T> de.zib.gndms.gndmc.AbstractClient.unifiedDelete ( final Class< T >  clazz,
final String  url,
final String  dn 
) [protected]

Executes a DELETE on a url, where the request header contains a given user name.

Parameters:
<T>The body type of the response.
clazzThe type of the return value.
urlThe url of the request.
dnThe user name.
Returns:
The response as entity.
                                                           {
                return unifiedX(HttpMethod.DELETE, clazz, null, url, dn, null);
        }
final<T> ResponseEntity<T> de.zib.gndms.gndmc.AbstractClient.unifiedGet ( final Class< T >  clazz,
final String  url,
final String  dn 
) [protected]

Executes a GET on a url, where the request header contains a given user name.

Parameters:
<T>The body type of the response.
clazzThe type of the return value.
urlThe url of the request.
dnThe user name.
Returns:
The response as entity.
                                                           {
                return unifiedX(HttpMethod.GET, clazz, null, url, dn, null);
        }
final<T> ResponseEntity<T> de.zib.gndms.gndmc.AbstractClient.unifiedGet ( final Class< T >  clazz,
final String  url,
final String  dn,
final String  wid 
) [protected]

Executes a GET on a url, where the request header contains a given user name and workflow id.

Parameters:
<T>The body type of the response.
clazzThe type of the return value.
urlThe url of the request.
dnThe user name.
widThe workflow id.
Returns:
The response as entity.
                                                                             {
                return unifiedX(HttpMethod.GET, clazz, null, url, dn, wid);
        }
final<T, P> ResponseEntity<T> de.zib.gndms.gndmc.AbstractClient.unifiedPost ( final Class< T >  clazz,
final P  parm,
final String  url,
final String  dn 
) [protected]

Executes a POST on a url.

The request header contains a given user name, the body of the request contains a given object of type P.

Parameters:
<T>The body type of the response.
<P>The body type of the request.
clazzThe type of the return value.
parmThe body of the request.
urlThe url of the request.
dnThe user name.
Returns:
The response as entity.
                                                                         {
                return unifiedX(HttpMethod.POST, clazz, parm, url, dn, null);
        }
final<T, P> ResponseEntity<T> de.zib.gndms.gndmc.AbstractClient.unifiedPost ( final Class< T >  clazz,
final P  parm,
final String  url,
final String  dn,
final String  wid 
) [protected]

Executes a POST on a url.

The request header contains a given user name and workflow id, the body of the request contains a given object of type P.

Parameters:
<T>The body type of the response.
<P>The body type of the request.
clazzThe type of the return value.
parmThe body of the request.
urlThe url of the request.
dnThe user name.
widThe workflow id.
Returns:
The response as entity.
                                                                                           {
                return unifiedX(HttpMethod.POST, clazz, parm, url, dn, wid);
        }
final<T, P> ResponseEntity<T> de.zib.gndms.gndmc.AbstractClient.unifiedPut ( final Class< T >  clazz,
final P  parm,
final String  url,
final String  dn 
) [protected]

Executes a PUT on a url.

The request header contains a given user name, the body of the request contains a given object of type P.

Parameters:
<T>The body type of the response.
<P>The body type of the request.
clazzThe type of the return value.
parmThe body of the request.
urlThe url of the request.
dnThe user name.
Returns:
The response as entity.
                                                                         {
                return unifiedX(HttpMethod.PUT, clazz, parm, url, dn, null);
        }
final<T, P> ResponseEntity<T> de.zib.gndms.gndmc.AbstractClient.unifiedPut ( final Class< T >  clazz,
final P  parm,
final String  url,
final String  dn,
final String  wid 
) [protected]

Executes a PUT on a url.

The request header contains a given user name and workflow id, the body of the request contains a given object of type P.

Parameters:
<T>The body type of the response.
<P>The body type of the request.
clazzThe type of the return value.
parmThe body of the request.
urlThe url of the request.
dnThe user name.
widThe workflow id.
Returns:
The response as entity.
                                                                                           {
                return unifiedX(HttpMethod.PUT, clazz, parm, url, dn, wid);
        }
private<T, P> ResponseEntity<T> de.zib.gndms.gndmc.AbstractClient.unifiedX ( final HttpMethod  x,
final Class< T >  clazz,
final P  parm,
final String  url,
final String  dn,
final String  wid 
) [package]

Executes a given HTTP method on a url.

The request header contains a given user name and workflow id, the body of the request contains a given object of type P.

Parameters:
<T>The body type of the response.
<P>The body type of the request.
xThe kind of HTTP method to be executed.
clazzThe type of the return value.
parmThe body of the request.
urlThe url of the request.
dnThe user name.
widThe workflow id.
Returns:
The response as entity.
                                                           {
                GNDMSResponseHeader requestHeaders = new GNDMSResponseHeader();
                if (dn != null) {
                        requestHeaders.setDN(dn);
                }
                if (wid != null) {
                        requestHeaders.setWId(wid);
                }
                HttpEntity<P> requestEntity = new HttpEntity<P>(parm, requestHeaders);
                return restTemplate.exchange(url, x, requestEntity, clazz);
        }

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables