org.apache.servicemix.jbi.deployer.descriptor
Class DescriptorFactory

java.lang.Object
  extended by org.apache.servicemix.jbi.deployer.descriptor.DescriptorFactory

public class DescriptorFactory
extends Object

Factory to read a JBI descriptor from a file, url or stream.


Field Summary
static String DESCRIPTOR_FILE
          The location of the JBI descriptor in a JBI artifact.
 
Constructor Summary
DescriptorFactory()
           
 
Method Summary
static Descriptor buildDescriptor(byte[] bytes)
          Build a jbi descriptor from the specified binary data.
static Descriptor buildDescriptor(File descriptorFile)
          Build a jbi descriptor from a file archive.
static Descriptor buildDescriptor(InputStream stream)
          Build a jbi descriptor from the specified stream
static Descriptor buildDescriptor(URL url)
          Build a jbi descriptor from the specified URL
static void checkDescriptor(Descriptor descriptor)
          Check validity of the JBI descriptor.
static void copyInputStream(InputStream in, OutputStream out)
          Copy in stream to an out stream
static QName createQName(Element element, String qualifiedName)
          Creates a QName instance from the given namespace context for the given qualifiedName
static String getDescriptorAsText(File descriptorFile)
          Retrieves the jbi descriptor as a string
static String getDescriptorAsText(URL descriptorURL)
          Retrieves the jbi descriptor as a string
static String getElementText(Element element)
          Returns the text of the element
static Element getFirstChildElement(Node parent)
          Get the first child element
static Element getNextSiblingElement(Element el)
          Get the next sibling element
static String recursiveGetAttributeValue(Element element, String attributeName)
          Recursive method to find a given attribute value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIPTOR_FILE

public static final String DESCRIPTOR_FILE
The location of the JBI descriptor in a JBI artifact.

See Also:
Constant Field Values
Constructor Detail

DescriptorFactory

public DescriptorFactory()
Method Detail

buildDescriptor

public static Descriptor buildDescriptor(File descriptorFile)
Build a jbi descriptor from a file archive.

Parameters:
descriptorFile - path to the jbi descriptor, or to the root directory
Returns:
the Descriptor object

buildDescriptor

public static Descriptor buildDescriptor(URL url)
Build a jbi descriptor from the specified URL

Parameters:
url - url to the jbi descriptor
Returns:
the Descriptor object

buildDescriptor

public static Descriptor buildDescriptor(InputStream stream)
Build a jbi descriptor from the specified stream

Parameters:
stream - input stream to the jbi descriptor
Returns:
the Descriptor object

buildDescriptor

public static Descriptor buildDescriptor(byte[] bytes)
Build a jbi descriptor from the specified binary data. The descriptor is validated against the schema, but no semantic validation is performed.

Parameters:
bytes - hold the content of the JBI descriptor xml document
Returns:
the Descriptor object

checkDescriptor

public static void checkDescriptor(Descriptor descriptor)
Check validity of the JBI descriptor.

Parameters:
descriptor - the descriptor to check
Throws:
Exception - if the descriptor is not valid

getDescriptorAsText

public static String getDescriptorAsText(File descriptorFile)
Retrieves the jbi descriptor as a string

Parameters:
descriptorFile - path to the jbi descriptor, or to the root directory
Returns:
the contents of the jbi descriptor

getDescriptorAsText

public static String getDescriptorAsText(URL descriptorURL)
Retrieves the jbi descriptor as a string

Parameters:
descriptorURL - URL pointing to the JBI descriptor
Returns:
the contents of the jbi descriptor

copyInputStream

public static void copyInputStream(InputStream in,
                                   OutputStream out)
                            throws IOException
Copy in stream to an out stream

Parameters:
in -
out -
Throws:
IOException

createQName

public static QName createQName(Element element,
                                String qualifiedName)
Creates a QName instance from the given namespace context for the given qualifiedName

Parameters:
element - the element to use as the namespace context
qualifiedName - the fully qualified name
Returns:
the QName which matches the qualifiedName

recursiveGetAttributeValue

public static String recursiveGetAttributeValue(Element element,
                                                String attributeName)
Recursive method to find a given attribute value


getElementText

public static String getElementText(Element element)
Returns the text of the element


getFirstChildElement

public static Element getFirstChildElement(Node parent)
Get the first child element

Parameters:
parent -
Returns:

getNextSiblingElement

public static Element getNextSiblingElement(Element el)
Get the next sibling element

Parameters:
el -
Returns:


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.