at.ac.tuwien.infosys.sm4all.copal.api.event.xml.type
Class SchemaURL

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

public class SchemaURL
extends ElementUtil
implements Unmarshaller<URL>, Marshaller<XMLContextEventType>

Command that marshalls and unmarshalls schema URL of a ContextEventType into/from an Element.

Author:
sanjin

Constructor Summary
SchemaURL(ClassLoader classLoader, Element element)
          Creates instance of ContextEventType schema URL unmarshaller which uses specified Element to unmarshal the schema URL.
SchemaURL(Element element)
          Creates instance of ContextEventType schema URL unmarshaller which uses specified Element to unmarshal the schema URL.
 
Method Summary
 void marshal(XMLContextEventType eventType)
          Possibly removes the ClassPath child Element of specified Element if there is one and removes the URL child Element of specified Element if specified XMLContextEventType does not have schema; otherwise the address attribute of the URL child Element is set to specified XMLContextEventType's schema.
 URL unmarshal()
          Returns the address attribute of URL child Element of specified Element.
 
Methods inherited from class at.ac.tuwien.infosys.sm4all.copal.api.xml.ElementUtil
getChildElement, getChildElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaURL

public SchemaURL(Element element)
Creates instance of ContextEventType schema URL unmarshaller which uses specified Element to unmarshal the schema URL.

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

SchemaURL

public SchemaURL(ClassLoader classLoader,
                 Element element)
Creates instance of ContextEventType schema URL unmarshaller which uses specified Element to unmarshal the schema URL. The specified ClassLoader is used for resolving URL for a schema that is in the classpath.

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

unmarshal

public URL unmarshal()
              throws ParsingException
Returns the address attribute of URL child Element of specified Element. Additionally, if the non- null ClassLoader in the SchemaURL(ClassLoader, Element) constructor was used, the ClassPath child Element will be permitted and the location attribute will be used to find the resource in the classpath of specified ClassLoader.

Specified by:
unmarshal in interface Unmarshaller<URL>
Returns:
the address or location attribute.
Throws:
MissingFieldException - if specified Element does not have a URL or ClassPath child Element, the URL child Element does not have an address attribute, or the ClassPath child Element does not have a location attribute.
InvalidFieldValueException - if specified Element has a non-URL or ClassPath child Element, the address attribute is empty or blank or is malformed URL, or the location attribute is empty or blank or there is no such resource in the classpath.
ParsingException

marshal

public void marshal(XMLContextEventType eventType)
Possibly removes the ClassPath child Element of specified Element if there is one and removes the URL child Element of specified Element if specified XMLContextEventType does not have schema; otherwise the address attribute of the URL child Element is set to specified XMLContextEventType's schema.

Specified by:
marshal in interface Marshaller<XMLContextEventType>
Parameters:
eventType - the XMLContextEventType.
Throws:
NullPointerException - if specified XMLContextEventType is null.
IllegalArgumentException - if specified XMLContextEventType has no schema.


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