Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.opstring
Class OpStringLoader

    java.lang.Object
      org.jini.rio.opstring.OpStringLoader

    public class OpStringLoader

extends Object

The OpStringLoader utility is a helper class used to parse, validate and return an `OperationalString`.

Nested Class Summary
`static class` | `OpStringLoader.XMLErrorHandler` An ErrorHandler for parsing

Field Summary
`protected String` | `codebaseOverride` If not `null`, this property will override codebase attribute when parsing OperationalStrings
`static String` | `DEFAULT_FDH` Default FaultDetectionHandler
`protected String[]` | `defaultExportJars` An array of default export jar names to always include
`protected String` | `loadPath` Path location of an OperationalString loaded from the file system
`protected boolean` | `processingOverrides` Flag to indicate that overrides are being parsed

Constructor Summary
`OpStringLoader()` Simple constructor which instantiates an OpStringLoader object that validates XML documents as they are parsed
`OpStringLoader(boolean verify)` Create a new OpStringLoader
`OpStringLoader(boolean verify, ClassLoader loader)` Create a new OpStringLoader
`OpStringLoader(ClassLoader loader)` Create a new OpStringLoader, validating documents as they are parsed.

Method Summary
`static String` | `createConfigEntry(String item)` Create a Configuration entry
`DocumentBuilder` | `getDocumentBuilder()` Get the DocumentBuilder created
`Element[]` | `getElements(NodeList nList)` Get all Element object from a NodeList
`static String` | `getTextValue(Node node)` Get the text value for a node
`static String` | `getTextValue(Node node, boolean replaceProperties)` Get the text value for a node
`protected URL` | `getURL(String location)` Get the URL from a file or http connection
`static void` | `main(String[] args)`
`static ServiceBeanConfig` | `makeServiceBeanConfig(ParsedService parsedService)` Create a ServiceBeanConfig from a ParsedService
`static ServiceElement` | `makeServiceElement(ParsedService parsedSvc)` Create a ServiceElement object from a ParsedService
`protected void` | `parseAssociation(Node assoc, OperationalString opString, GlobalAttrs global, ParsedService sDescriptor)` Parse the Association element
`static String[]` | `parseConfiguration(Element element)` Parse a Configuration entry
`protected void` | `parseElement(Element element, GlobalAttrs global, ParsedService sDescriptor, OpString opString)` Parse the Element
`protected OperationalString[]` | `parseOperationalString(Document document, URL loadedFrom)` Parse on OperationalString from a Document
`OperationalString[]` | `parseOperationalString(File xmlFile)` Parse on OperationalString from a File
`OperationalString[]` | `parseOperationalString(String xmlLocation)` Parse on OperationalString from a File a String location.
`OperationalString[]` | `parseOperationalString(URL xmlURL)` Parse on OperationalString from a File an URL location.
`static Properties` | `parseParameters(Element element)` Parse the element
`protected void` | `processChildren(NodeList nodeList, GlobalAttrs global, ParsedService sDescriptor, OpString opString)` Process the child list
`void` | `setCodebaseOverride(String codebase)` This will override any codebase that has been set in the OperationalString
`void` | `setDefaultExportJars(String[] jars)` Set an array of jar names to be always included in a service's declaration
`void` | `setDefaultGroups(String[] groups)` Set the default groups to add into the parsed OperationalString.
`void` | `setServiceOverride(String override)` Set the override file

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### loadPath

    protected String loadPath

  Path location of an OperationalString loaded from the file system

### codebaseOverride

    protected String codebaseOverride

  If not `null`, this property will override codebase attribute when parsing OperationalStrings

### defaultExportJars

    protected String[] defaultExportJars

  An array of default export jar names to always include

### DEFAULT_FDH

    public static final String DEFAULT_FDH

  Default FaultDetectionHandler

  See Also:
    Constant Field Values

### processingOverrides

    protected boolean processingOverrides

  Flag to indicate that overrides are being parsed

Constructor Detail

### OpStringLoader

    public OpStringLoader()
                   throws Exception

  Simple constructor which instantiates an OpStringLoader object that validates XML documents as they are parsed

  Throws:
    `Exception` - if there are errors creating the utility

### OpStringLoader

    public OpStringLoader(boolean verify)
                   throws Exception

  Create a new OpStringLoader

  Parameters:
    `verify` - If true specifies that the parser produced by this code will validate documents as they are parsed.
  Throws:
    `Exception` - if there are errors creating the utility

### OpStringLoader

    public OpStringLoader(ClassLoader loader)
                   throws Exception

  Create a new OpStringLoader, validating documents as they are parsed.

  Parameters:
    `loader` - The parent ClassLoader to use for delegation
  Throws:
    `Exception` - if there are errors creating the utility

### OpStringLoader

    public OpStringLoader(boolean verify,
                          ClassLoader loader)
                   throws Exception

  Create a new OpStringLoader

  Parameters:
    `verify` - If true specifies that the parser produced by this code will validate documents as they are parsed.
    `loader` - The parent ClassLoader to use for delegation
  Throws:
    `Exception` - if there are errors creating the utility

Method Detail

### getDocumentBuilder

    public DocumentBuilder getDocumentBuilder()

  Get the DocumentBuilder created

  Returns:
    The DocumentBuilder

### setCodebaseOverride

    public void setCodebaseOverride(String codebase)

  This will override any codebase that has been set in the OperationalString

  Parameters:
    `codebase` - The codebase to use when loading jars and resources for the OperationalString. this proeprty will behave as a "global property", being applied to all services declared in the OperationalString, including any nested OperationalStrings

### setDefaultExportJars

    public void setDefaultExportJars(String[] jars)

  Set an array of jar names to be always included in a service's declaration

  Parameters:
    `jars` - An array of jar names which will be verified as part of the services resources

### setDefaultGroups

    public void setDefaultGroups(String[] groups)

  Set the default groups to add into the parsed OperationalString. This will result in not having to declare a element in the XML opstring

  Parameters:
    `groups` - The groups to set, must not be null
  Throws:
    `NullPointerException` - if the groups parameter is null
    `IllegalArgumentException` - if the groups parameter is a zero-length array

### setServiceOverride

    public void setServiceOverride(String override)
                            throws MalformedURLException

  Set the override file

  Parameters:
    `override` - The XML file to use for overide values
  Throws:
    `MalformedURLException` - If the override document url is not correct

### parseOperationalString

    public OperationalString[] parseOperationalString(File xmlFile)
                                               throws Exception

  Parse on OperationalString from a File

  Parameters:
    `xmlFile` - A File object for an XML file
  Returns:
    An array of OperationalString objects parsed from an XML file.
  Throws:
    `Exception` - if any errors occur parsing the document

### parseOperationalString

    public OperationalString[] parseOperationalString(URL xmlURL)
                                               throws Exception

  Parse on OperationalString from a File an URL location.

  Parameters:
    `xmlURL` - URL location of the XML file
  Returns:
    An array of OperationalString objects parsed from an XML document loaded from the URL.
  Throws:
    `Exception` - if any errors occur parsing the document

### parseOperationalString

    public OperationalString[] parseOperationalString(String xmlLocation)
                                               throws Exception

  Parse on OperationalString from a File a String location.

  Parameters:
    `xmlLocation` - String location of the XML file. The parameter passed in can either point to an URL (prefixed by http) or a file found in the classpath.
  Returns:
    An array of OperationalString objects parsed from an XML document loaded from the location.
  Throws:
    `Exception` - if any errors occur parsing the document

### getURL

    protected URL getURL(String location)
                  throws MalformedURLException

  Get the URL from a file or http connection

  Parameters:
    `location` - The location string
  Returns:
    A URL
  Throws:
    `MalformedURLException` - If the location string is bogus

### parseOperationalString

    protected OperationalString[] parseOperationalString(Document document,
                                                         URL loadedFrom)
                                                  throws Exception

  Parse on OperationalString from a Document

  Parameters:
    `document` - The DOM org.w3c.dom.Document object from an XML document
    `loadedFrom` - The URL the OperationalString is loaded from
  Returns:
    An array of OperationalString objects parsed from an XML document loaded from the location.
  Throws:
    `Exception` - If errors occur parsing the OperationalString

### parseElement

    protected void parseElement(Element element,
                                GlobalAttrs global,
                                ParsedService sDescriptor,
                                OpString opString)
                         throws Exception

  Parse the Element

  Parameters:
    `element` - The Element
    `global` - Class to hold global elements
    `sDescriptor` - The parsedService object
    `opString` - The OpString object
  Throws:
    `Exception` - if the element cannot be parsed

### processChildren

    protected void processChildren(NodeList nodeList,
                                   GlobalAttrs global,
                                   ParsedService sDescriptor,
                                   OpString opString)
                            throws Exception

  Process the child list

  Parameters:
    `nodeList` - A Nodelist for the Element
    `global` - GlobalAttrrs
    `sDescriptor` - The parsedService object opString - The OpString object
    `opString` - The OperationalString
  Throws:
    `Exception` - if errors occur

### parseAssociation

    protected void parseAssociation(Node assoc,
                                    OperationalString opString,
                                    GlobalAttrs global,
                                    ParsedService sDescriptor)
                             throws Exception

  Parse the Association element

  Parameters:
    `assoc` - The Association element
    `opString` - The OperationalString
    `global` - Global attributes
    `sDescriptor` - The service descriptor
  Throws:
    `Exception` - if errors occur

### makeServiceElement

    public static ServiceElement makeServiceElement(ParsedService parsedSvc)
                                             throws Exception

  Create a ServiceElement object from a ParsedService

  Parameters:
    `parsedSvc` - A ParsedService object, typically from loading and parsing an XML OperationalString
  Returns:
    The ServiceElement object
  Throws:
    `Exception` - if errors occur parsing the service element

### makeServiceBeanConfig

    public static ServiceBeanConfig makeServiceBeanConfig(ParsedService parsedService)
                                                   throws Exception

  Create a ServiceBeanConfig from a ParsedService

  Parameters:
    `parsedService` - A ParsedService object, typically from loading and parsing an XML OperationalString
  Returns:
    The ServiceBeanConfig object
  Throws:
    `Exception` - if the service bean config cannot be created

### getTextValue

    public static String getTextValue(Node node)

  Get the text value for a node

  Parameters:
    `node` - The Node to get the text value for
  Returns:
    The text value for the Node, or a zero-length String if the Node is not recognized

### getTextValue

    public static String getTextValue(Node node,
                                      boolean replaceProperties)

  Get the text value for a node

  Parameters:
    `node` - The Node to get the text value for
    `replaceProperties` - If true replace system properties
  Returns:
    The text value for the Node, or a zero-length String if the Node is not recognized

### parseConfiguration

    public static String[] parseConfiguration(Element element)
                                       throws Exception

  Parse a Configuration entry

  Parameters:
    `element` - The Element to parse
  Returns:
    A String[] suitable for use with Configuration object
  Throws:
    `Exception` - if the element cannot be parsed

### createConfigEntry

    public static String createConfigEntry(String item)

  Create a Configuration entry

  Parameters:
    `item` - The item to create a configuration entry for
  Returns:
    A string suitable for use in a Jini configuration

### parseParameters

    public static Properties parseParameters(Element element)
                                      throws Exception

  Parse the element

  Parameters:
    `element` - The element
  Returns:
    A Properties object containing name/value pairs
  Throws:
    `Exception` - if the properties element cannot be parsed

### getElements

    public Element[] getElements(NodeList nList)

  Get all Element object from a NodeList

  Parameters:
    `nList` - The NodeList
  Returns:
    Array of Element instances

### main

    public static void main(String[] args)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.