org.gcube.common.resources.kxml
Class KGCUBEResource

java.lang.Object
  extended by org.gcube.common.resources.kxml.KGCUBEResource

public class KGCUBEResource
extends Object

Shared parser for all KGCUBEResources. The parser can be shared for serialisation and deserialisation of different resource across multiple threads.

Author:
Fabio Simeoni (University of Strathclyde), Luca Frosini (ISTI-CNR)

Nested Class Summary
protected static class KGCUBEResource.SchemaResolver
           
 
Field Summary
protected static DOMImplementationLS domImplementation
           
protected static GCUBELog logger
           
static String NS
           
static String SCHEMA_RESOURCE_LOCATION
           
protected static Map<Class<? extends GCUBEResourceImpl>,Schema> schemaMap
           
protected static SchemaFactory sfactory
           
 
Constructor Summary
KGCUBEResource()
           
 
Method Summary
static Date fromXMLDateAndTime(String date)
          Transforms the input date in a Date object
protected static Schema getSchema(GCUBEResourceImpl component)
           
static
<T extends GCUBEResource & GCUBEResourceImpl>
void
load(T component, Reader reader)
          Deserialises a GCUBEResourceImpl which implements a GCUBEResource from a serialisation.
static
<T extends GCUBEResource & GCUBEResourceImpl>
void
store(T component, Writer writer)
          Serialises a GCUBEResourceImpl which implements a GCUBEResource.
static String toXMLDateAndTime(Date date)
          Transforms the input Date in a valid string representation for the dateAndTime XML Schema data type
protected static void validate(Reader reader, Schema schema)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NS

public static final String NS

SCHEMA_RESOURCE_LOCATION

public static final String SCHEMA_RESOURCE_LOCATION
See Also:
Constant Field Values

logger

protected static final GCUBELog logger

schemaMap

protected static Map<Class<? extends GCUBEResourceImpl>,Schema> schemaMap

sfactory

protected static final SchemaFactory sfactory

domImplementation

protected static DOMImplementationLS domImplementation
Constructor Detail

KGCUBEResource

public KGCUBEResource()
Method Detail

load

public static <T extends GCUBEResource & GCUBEResourceImpl> void load(T component,
                                                                     Reader reader)
                 throws Exception
Deserialises a GCUBEResourceImpl which implements a GCUBEResource from a serialisation.

Type Parameters:
T - the type of the GCUBEResourceImpl.
Parameters:
component - the GCUBEResourceImpl.
reader - the Reader which gives access to the GCUBEResourceImpl.
Throws:
Exception - if the GCUBEResourceImpl could not be deserialised.

store

public static <T extends GCUBEResource & GCUBEResourceImpl> void store(T component,
                                                                      Writer writer)
                  throws Exception
Serialises a GCUBEResourceImpl which implements a GCUBEResource.

Type Parameters:
T - the type of the GCUBEResourceImpl.
Parameters:
component - the GCUBEResourceImpl.
writer - the Writer which gives access to the serialisation.
Throws:
Exception - if the GCUBEResourceImpl could not be serialised.

getSchema

protected static Schema getSchema(GCUBEResourceImpl component)
                           throws Exception
Throws:
Exception

validate

protected static void validate(Reader reader,
                               Schema schema)
                        throws Exception
Throws:
Exception

toXMLDateAndTime

public static String toXMLDateAndTime(Date date)
Transforms the input Date in a valid string representation for the dateAndTime XML Schema data type

Parameters:
date - the Date object to tranform
Returns:
the String object

fromXMLDateAndTime

public static Date fromXMLDateAndTime(String date)
                               throws ParseException
Transforms the input date in a Date object

Parameters:
date - the string representation of the date
Returns:
the Date object
Throws:
ParseException - if the input date is not in an valid format


Copyright © 2013. All Rights Reserved.