Class CastorXMLUtility

java.lang.Object
org.cristalise.kernel.utils.CastorXMLUtility

public class CastorXMLUtility extends Object
Loads all castor mapfiles, and wraps marshalling/unmarshalling
  • Constructor Details

    • CastorXMLUtility

      public CastorXMLUtility(ResourceLoader aResourceLoader, Properties aAppProperties, URL mapURL) throws InvalidDataException
      Looks for a file called 'index' at the given URL, and loads every file listed in there by relative path
      Parameters:
      aResourceLoader - the resource loader able to return the right class loader
      aAppProperties - the application properties containing optional castor configuration
      mapURL - the root URL for the mapfiles
      Throws:
      InvalidDataException
  • Method Details

    • marshall

      public String marshall(Object obj) throws InvalidDataException
      Marshalls a mapped object to xml string. The mapping must be loaded before. See updateMapping().
      Parameters:
      obj - the object to be marshalled
      Returns:
      the xml string of the marshalled object
      Throws:
      InvalidDataException - all errors captured
    • unmarshall

      public Object unmarshall(String data) throws InvalidDataException
      Unmarshalls a mapped object from XML string. The mapping must be loaded before. See updateMapping().
      Parameters:
      data - the string to be unmarshalled
      Returns:
      the unmarshalled object
      Throws:
      InvalidDataException - all errors captured