eu.planets_project.services.utils
Class ServiceUtils

java.lang.Object
  extended by eu.planets_project.services.utils.ServiceUtils

public class ServiceUtils
extends java.lang.Object

A class to hold some utility functions for Planets Service developers.


Field Summary
static javax.xml.ws.WebServiceFeature[] JAXWS_FEATURES
          Standardised web service features - MTOM and Streaming.
static int JAXWS_SIZE_THRESHOLD
          Standard threshold before chunking data, currently 10 MB
 
Method Summary
static java.util.Set<java.net.URI> asSet(java.net.URI... uris)
           
static double calculateDuration(long startTime, long endTime)
           
static ServiceReport createErrorReport(java.lang.String message)
           
static ServiceReport createExceptionErrorReport(java.lang.String message, java.lang.Exception e)
           
static ServiceReport createExceptionErrorReport(java.lang.String message, java.lang.Exception e, int errorType)
           
static MigrationPath[] createMigrationPathways(java.util.List<java.net.URI> inputFormats, java.util.List<java.net.URI> outputFormats)
          Creates a simple MigrationPath Matrix needed by most Migrate services.
static
<T> T
createService(javax.xml.namespace.QName interfaceName, java.lang.Class<T> interfaceType, java.net.URL wsdlLocation)
           
static
<T> T
createService(ServiceDescription description)
           
static java.lang.String getSystemDateAndTimeFormatted()
          Convenience method to get the current System date and time as a formatted String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAXWS_SIZE_THRESHOLD

public static final int JAXWS_SIZE_THRESHOLD
Standard threshold before chunking data, currently 10 MB

See Also:
Constant Field Values

JAXWS_FEATURES

public static final javax.xml.ws.WebServiceFeature[] JAXWS_FEATURES
Standardised web service features - MTOM and Streaming. We require at least MTOM feature, and the chunk size set, to get streaming to work. See https://jax-ws.dev.java.net/guide/Large_Attachments.html NOTE that MTOM does not need to be forced in order to work with the DIaLOGIKa service.

Method Detail

createExceptionErrorReport

public static ServiceReport createExceptionErrorReport(java.lang.String message,
                                                       java.lang.Exception e,
                                                       int errorType)
Parameters:
message - A message that described the error.
e - The Exception that caused the error - can be NULL.
errorType - The kind of error, ServiceReport.TOOL_ERROR, ServiceReport.INSTALLATION_ERROR, ...
Returns:
The service report

createExceptionErrorReport

public static ServiceReport createExceptionErrorReport(java.lang.String message,
                                                       java.lang.Exception e)
Parameters:
message - The message
e - The exception
Returns:
service report from exception and message

createErrorReport

public static ServiceReport createErrorReport(java.lang.String message)
Parameters:
message - The message
Returns:
service report from message

getSystemDateAndTimeFormatted

public static java.lang.String getSystemDateAndTimeFormatted()
Convenience method to get the current System date and time as a formatted String. Example: "29/01/2009 - 16:39:26,937"

Returns:
the current System time and date as String

calculateDuration

public static double calculateDuration(long startTime,
                                       long endTime)
Parameters:
startTime - the start time
endTime - The end time
Returns:
The duration

createMigrationPathways

public static MigrationPath[] createMigrationPathways(java.util.List<java.net.URI> inputFormats,
                                                      java.util.List<java.net.URI> outputFormats)
Creates a simple MigrationPath Matrix needed by most Migrate services. It's not possible to add Parameters per Path...

Parameters:
inputFormats - List of URIs with possible Inputformats
outputFormats - List of URIs with possible Outputformats
Returns:
a MigrationPath[] containing all possible combinations of formats

asSet

public static java.util.Set<java.net.URI> asSet(java.net.URI... uris)
Parameters:
uris - The URIs
Returns:
The uris as a set

createService

public static <T> T createService(javax.xml.namespace.QName interfaceName,
                                  java.lang.Class<T> interfaceType,
                                  java.net.URL wsdlLocation)
Type Parameters:
T - The type of the implementation class to instantiate
Parameters:
interfaceName - The QName of the service interface, e.g. Migrate.QNAME
interfaceType - The Class of the service interface, e.g. Migrate.class
wsdlLocation - The full URL of the WSDL for the service to create
Returns:
An instance of T, representing the service running at the given URL

createService

public static <T> T createService(ServiceDescription description)
Type Parameters:
T - The type of the service to create
Parameters:
description - The description to instantiate a service for. Needs endpoint and type set
Returns:
A service proxy for a service running at the descriptions endpoint


Copyright © 2007-2010 The Planets Consortium. All Rights Reserved.