at.ac.tuwien.infosys.sm4all.copal.api.event.xml
Class SchemaURLUnmarshaller

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.api.event.xml.SchemaURLUnmarshaller
All Implemented Interfaces:
Marshaller<java.net.URL>, Unmarshaller<java.net.URL>

public class SchemaURLUnmarshaller
extends java.lang.Object
implements Unmarshaller<java.net.URL>

Unmarshals and marshals a URL to a Schema file from/into an Element.

Author:
sanjin

Nested Class Summary
static class SchemaURLUnmarshaller.Builder
          Builder of SchemaURLUnmarshaller.
 
Field Summary
static java.lang.String CLASSPATH_ELEMENT
          The local name of child Element that holds marshaled classpath location.
static java.lang.String CLASSPATH_LOCATION_ATTRIBUTE
          The name of attribute that holds marshaled classpath location.
static java.lang.String SCHEMA_ELEMENT
          The local name of child Elements used in the ListUnmarshaller.Builder that is returned by the getListBuilder().
static java.lang.String URL_ADDRESS_ATTRIBUTE
          The name of attribute that holds marshaled URL address.
static java.lang.String URL_ELEMENT
          The local name of child Element that holds marshaled URL .
 
Constructor Summary
SchemaURLUnmarshaller(java.lang.ClassLoader classLoader, org.w3c.dom.Element element)
          Creates instance of Schema URL Unmarshaller which uses specified Element for unmarshalling and/or marshalling.
SchemaURLUnmarshaller(org.w3c.dom.Element element)
          Creates instance of Schema URL Unmarshaller which uses specified Element for unmarshalling and/or marshalling.
 
Method Summary
 java.lang.ClassLoader getClassLoader()
          Returns the ClassLoader used for resolving Schema URL that is in the classpath.
 org.w3c.dom.Element getElement()
          Returns the Element used for unmarshalling and marshalling.
static ListUnmarshaller.Builder<java.net.URL> getListBuilder()
          Creates instance of ListUnmarshaller.Builder for Schema URLs.
static ListUnmarshaller.Builder<java.net.URL> getListBuilder(java.lang.ClassLoader classLoader)
          Creates instance of ListUnmarshaller.Builder for Schema URLs.
 void marshal(java.net.URL schemaURL)
          Marshals specified Schema URL into the Element.
 void remove()
          Removes any marshaled Schema URL from the Element .
 java.net.URL unmarshal()
          Unmarshals a Schema URL from the Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHEMA_ELEMENT

public static final java.lang.String SCHEMA_ELEMENT
The local name of child Elements used in the ListUnmarshaller.Builder that is returned by the getListBuilder().

See Also:
Constant Field Values

URL_ELEMENT

public static final java.lang.String URL_ELEMENT
The local name of child Element that holds marshaled URL .

See Also:
Constant Field Values

URL_ADDRESS_ATTRIBUTE

public static final java.lang.String URL_ADDRESS_ATTRIBUTE
The name of attribute that holds marshaled URL address.

See Also:
Constant Field Values

CLASSPATH_ELEMENT

public static final java.lang.String CLASSPATH_ELEMENT
The local name of child Element that holds marshaled classpath location.

See Also:
Constant Field Values

CLASSPATH_LOCATION_ATTRIBUTE

public static final java.lang.String CLASSPATH_LOCATION_ATTRIBUTE
The name of attribute that holds marshaled classpath location.

See Also:
Constant Field Values
Constructor Detail

SchemaURLUnmarshaller

public SchemaURLUnmarshaller(org.w3c.dom.Element element)
Creates instance of Schema URL Unmarshaller which uses specified Element for unmarshalling and/or marshalling.

Parameters:
element - the Element used for unmarshalling and marshalling.
Throws:
java.lang.NullPointerException - if specified Element is null.

SchemaURLUnmarshaller

public SchemaURLUnmarshaller(java.lang.ClassLoader classLoader,
                             org.w3c.dom.Element element)
Creates instance of Schema URL Unmarshaller which uses specified Element for unmarshalling and/or marshalling. The specified ClassLoader is used for resolving Schema URL that is in the classpath.

Parameters:
classLoader - the ClassLoader used for resolving Schema URL that is in the classpath.
element - the Element used for marshalling and unmarshalling.
Throws:
java.lang.NullPointerException - if specified Element is null.
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the ClassLoader used for resolving Schema URL that is in the classpath.

Returns:
the ClassLoader used for resolving Schema URL that is in the classpath.

getElement

public org.w3c.dom.Element getElement()
Returns the Element used for unmarshalling and marshalling.

Returns:
the Element used for unmarshalling and marshalling.

unmarshal

public java.net.URL unmarshal()
                       throws FailedUnmarshallingException
Unmarshals a Schema URL from the Element.

Specified by:
unmarshal in interface Unmarshaller<java.net.URL>
Returns:
the unmarshaled Schema URL.
Throws:
FailedUnmarshallingException - if unmarshalling was unsuccessful.

marshal

public void marshal(java.net.URL schemaURL)
Marshals specified Schema URL into the Element.

Specified by:
marshal in interface Marshaller<java.net.URL>
Parameters:
schemaURL - the Schema URL.
Throws:
java.lang.NullPointerException - if specified Schema URL is null.

remove

public void remove()
Removes any marshaled Schema URL from the Element .

Specified by:
remove in interface Marshaller<java.net.URL>

getListBuilder

public static ListUnmarshaller.Builder<java.net.URL> getListBuilder()
Creates instance of ListUnmarshaller.Builder for Schema URLs. The returned ListUnmarshaller.Builder does not have the parent Element set and caller should set it before building the ListUnmarshaller for Schema URLs. The name for child Elements is set to SCHEMA_ELEMENT.

Returns:
the ListUnmarshaller.Builder for Schema URLs.

getListBuilder

public static ListUnmarshaller.Builder<java.net.URL> getListBuilder(java.lang.ClassLoader classLoader)
Creates instance of ListUnmarshaller.Builder for Schema URLs. The Schema URLs in classpath will be resolved with specified ClassLoader. The returned ListUnmarshaller.Builder does not have the parent Element set and caller should set it before building the ListUnmarshaller for Schema URLs. The name for child Elements is set to SCHEMA_ELEMENT.

Parameters:
classLoader - the ClassLoader used for resolving Schema URLs that are in the classpath.
Returns:
the ListUnmarshaller.Builder for Schema URLs.


Copyright © 2010 Distributed Systems Group, Vienna University of Technology. All Rights Reserved.