Knopflerfish OSGi 5.2.0

org.knopflerfish.util.metatype
Class KFLegacyMetaTypeParser

java.lang.Object
  extended by org.knopflerfish.util.metatype.KFLegacyMetaTypeParser

public class KFLegacyMetaTypeParser
extends java.lang.Object

Helper class which loads (and saves) KF Metatype XML.

This implementation uses the nanoxml package for KF Metatype XML.

NanoXML is distributed under the zlib/libpng license.
See http://nanoxml .sourceforge.net/orig/copyright.html for details.
The full license text is also include in the kf_metatype bundle jar.

Nanoxml is Copyrighted 2000-2002 Marc De Scheemaecker, All Rights Reserved.


Constructor Summary
KFLegacyMetaTypeParser()
           
 
Method Summary
static java.lang.Object loadContent(AttributeDefinition attr, net.n3.nanoxml.XMLElement el)
          Load the contents of a tag into a java object.
static java.util.List<java.util.Dictionary<java.lang.String,java.lang.Object>> loadDefaultsFromURL(MTP mtp, java.net.URL url)
          Load defaults from an XML file into an MTP.
static MTP loadMTP(Bundle bundle, java.net.URL sourceURL, net.n3.nanoxml.XMLElement el)
          Load a MetaTypeProvider from an XML "config" element.
static MTP loadMTPFromURL(Bundle bundle, java.net.URL url)
          Load a MetaTypeProvider from an XML file.
static java.util.Vector<java.lang.Object> loadSequence(AttributeDefinition attr, net.n3.nanoxml.XMLElement el, int max, java.lang.String tagName)
           
static java.lang.Object loadValue(AttributeDefinition attr, net.n3.nanoxml.XMLElement el)
          Load a java object from an XML element using type info in the specified definition.
static java.util.Dictionary<java.lang.String,java.lang.Object> loadValues(AttributeDefinition[] attrs, net.n3.nanoxml.XMLElement el)
           
static java.util.List<java.util.Dictionary<java.lang.String,java.lang.Object>> loadValues(MetaTypeProvider mtp, net.n3.nanoxml.XMLElement el)
           
static void printMetatypeXML(MetaTypeProvider mtp, java.lang.String[] servicePIDs, java.lang.String[] factoryPIDs, boolean bXMLHeader, boolean bMetatypeTag, java.util.List<?> propList, java.io.PrintWriter out)
          Print sets of definitions to an XML file.
static void printOCDXML(MetaTypeProvider mtp, java.lang.String[] pids, int maxOccurs, java.io.PrintWriter out)
          Print a set of ObjectClassDefinitions as XML.
static void printValuesXML(java.util.List<?> propList, boolean bXMLHeader, java.io.PrintWriter out)
           
static void printXML(java.io.PrintWriter out, AttributeDefinition ad)
          Print an attribute definition as XML.
static void setDefaultValues(MetaTypeProvider mtp, java.util.List<java.util.Dictionary<java.lang.String,java.lang.Object>> propList)
          Overwrite default values in MTP using a set of dictionaries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KFLegacyMetaTypeParser

public KFLegacyMetaTypeParser()
Method Detail

loadMTPFromURL

public static MTP loadMTPFromURL(Bundle bundle,
                                 java.net.URL url)
                          throws java.io.IOException
Load a MetaTypeProvider from an XML file.

Throws:
java.io.IOException

loadDefaultsFromURL

public static java.util.List<java.util.Dictionary<java.lang.String,java.lang.Object>> loadDefaultsFromURL(MTP mtp,
                                                                                                          java.net.URL url)
                                                                                                   throws java.io.IOException
Load defaults from an XML file into an MTP.

Throws:
java.io.IOException

loadMTP

public static MTP loadMTP(Bundle bundle,
                          java.net.URL sourceURL,
                          net.n3.nanoxml.XMLElement el)
Load a MetaTypeProvider from an XML "config" element.
  1. Load all service and factory definitions into a MetaTypeProvider instance.
  2. Load any default data.
  3. Insert default data into definitions in MetaTypeProvider using the setDefaultValues method.


setDefaultValues

public static void setDefaultValues(MetaTypeProvider mtp,
                                    java.util.List<java.util.Dictionary<java.lang.String,java.lang.Object>> propList)
Overwrite default values in MTP using a set of dictionaries.

Parameters:
mtp - MetaTypeProvider containing instances of AD
propList - List of Dictionary

loadValues

public static java.util.List<java.util.Dictionary<java.lang.String,java.lang.Object>> loadValues(MetaTypeProvider mtp,
                                                                                                 net.n3.nanoxml.XMLElement el)
Returns:
String (pid) -> Dictionary

loadValues

public static java.util.Dictionary<java.lang.String,java.lang.Object> loadValues(AttributeDefinition[] attrs,
                                                                                 net.n3.nanoxml.XMLElement el)

loadValue

public static java.lang.Object loadValue(AttributeDefinition attr,
                                         net.n3.nanoxml.XMLElement el)
Load a java object from an XML element using type info in the specified definition.


loadSequence

public static java.util.Vector<java.lang.Object> loadSequence(AttributeDefinition attr,
                                                              net.n3.nanoxml.XMLElement el,
                                                              int max,
                                                              java.lang.String tagName)

loadContent

public static java.lang.Object loadContent(AttributeDefinition attr,
                                           net.n3.nanoxml.XMLElement el)
Load the contents of a tag into a java object.

Parameters:
el - element which content should be converted to a java object.
attr - definition defining type.

printMetatypeXML

public static void printMetatypeXML(MetaTypeProvider mtp,
                                    java.lang.String[] servicePIDs,
                                    java.lang.String[] factoryPIDs,
                                    boolean bXMLHeader,
                                    boolean bMetatypeTag,
                                    java.util.List<?> propList,
                                    java.io.PrintWriter out)
Print sets of definitions to an XML file.


printOCDXML

public static void printOCDXML(MetaTypeProvider mtp,
                               java.lang.String[] pids,
                               int maxOccurs,
                               java.io.PrintWriter out)
Print a set of ObjectClassDefinitions as XML.

Parameters:
mtp - Metatype provider
pids - Set of String (PIDs)
out - writer to print to.

printXML

public static void printXML(java.io.PrintWriter out,
                            AttributeDefinition ad)
Print an attribute definition as XML.


printValuesXML

public static void printValuesXML(java.util.List<?> propList,
                                  boolean bXMLHeader,
                                  java.io.PrintWriter out)

Knopflerfish OSGi 5.2.0