org.gcube.common.resources.kxml
Class KGCUBEResource
java.lang.Object
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)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
KGCUBEResource
public KGCUBEResource()
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 © 2012. All Rights Reserved.