XML Middleware Documentation


Preface:  

Points to Note:

  1. The XML Middleware Code is written in Java.
  2. It stems from the XML-DBMS Code base but has an expanded set of uses
  3. It has been designed as a suite of components which can be used by themselves or together to form an application.
  4. Here is the documentation for the version of XML-DBMS on which this is based.

    Back to XMLMiddleware

Files:

The Code uses property files in order to run. The GUI also uses XML Files.
The properties keys used by the code to get the values are contained in the classes in the .props package.

The XML files are:

The Container XML File - This contains the settings for the Container itself such that it can find & load the Plugins

an example would be:

<Settings>
<Application>
<MenuName>XML-DBMS MapBuilder</MenuName>
<Argument>File=D:\Move\aat\MB\MapProps.txt</Argument>
<Handler>net.xmlmiddleware.xmldbms.gui.mapbuilder.MapbuilderPlugIn</Handler>
<DocType>xmldbms.dtd</DocType>
</Application>
</Settings>

Where there are multiple Application elements. You can write your own plugins & then edit the relevant XML file to show your application on the main Menu. The Doctype is used such that if a certain XML file with that DTD as it's DTD the container can automatically load the relevant Handler.

e.g. to start the Container you would need to either provide the path to this file in the args or the path to a properties file which contains the path to this file

The Arg for a property file is File=  so if the properties file was in D:\Move\aat & was called MyProps.txt then you could start the Container with

File=D:\Move\aat\MyProps.txt

& in that you would need the following (assuming the XML file was called ContSettings.xml)

ContSettingsFile=D\:\\Move\\aat\\ContSettings.xml

or you could start the Container simply with ContSettingsFile=D\:\\Move\\aat\\ContSettings.xml if you had no other properties you wished to pass in.

MapBuilder XML File -

See the XMsettings.dtd for structure.

This contains everything for the MapBuilder e.g.  for Databases both db types & names e.g:

  </Type>
  <Type Description="Oracle(Thin)">
   <Driver>oracle.jdbc.driver.OracleDriver</Driver>
   <StdURL>jdbc:oracle:thin:@MACHINE:PORT:DATABASE</StdURL>
  </Type>

and instance specific information such as

  <Name desc="EXAMPLE" Type="Oracle(Thin)" JDBCLevel="1">
   <URL>jdbc:oracle:thin:@EXAMPLESERVER:1521:EXAMPLE</URL>
   <user>me</user>
   <password>mypassword</password>
   <initialcontext />
   <datasource />
  </Name>

JMS is handled the same way (i.e. type + specific info)

Structure & Classes:

The base namespace is:  net.xmlmiddleware. The rest of the documentation will assume that is prepended except where it is explicitly stated.

The Code tree is as follows (explanation / contents discussed below)

.gui
.gui.treebuilder
.gui.utils

.io

.messaging
.messaging.jms

.objectcache
.props
.samples

.server
.server.mdb

.transform
.transform.xslt

.xmldbms
.xmldbms.gui
.xmldbms.gui.mapbuilder
.xmldbms.v1
.xmldbms.v1.gui


Contents:

.gui

This is the base level GUI package for XMLMiddleware.net & contains:

Container -  which acts as a plugin resolver & Basic JFrame for the GUI.

The Plugin Interface - An interface a Plugin should have to plug into the Container.

.gui.treebuilder

This is where all the JDOM Treebuilding classes are & contains:

BasicNode -  This is a basic extension of javax.swing.tree.DefaultMutableTreeNode.

ElementNode - This is an extension of BasicNode which encapsulates a JDOM Element. This is the fundamental link between a JDOM Document and the JTree GUI Component via the JDOMTreeModel.

BasicTreeListener - This is a Multiple Jtree Listener which extends  java.awt.event.MouseAdapter
& implements javax.swing.event.TreeExpansionListener & javax.swing.event.TreeSelectionListener
It will get the menu relevant for a given Node/ JDOM Element from the .xmldbms.gui.mapbuilder.StaticMenuh & show it as well as controlling the various tree events (e.g. TreeCollapsed).

JDOMTreeModel  - This extends DefaultTreeModel & is the basis for displaying "live" JDOM Documents as a JTree.

DBModel  - extends JDOMTreeModel. I am not sure it is needed as it does not do a lot. I might scrap it.

JDBCTreeBuilder -  This builds a JDOM Document from the metadata returned by the Database.

.gui.utils

This is a collection of usefull GUI classes & contains

DocView - A GUI JFrame which displays a document

MessageDialog - A GUI JFrame which is used to display Error Messages (or indeed any Message if you wish).

WindowPositioner - A  class which positions a Window in a position on the screen (e.g. centers it).

.io

This is where all the base Level IO classes live & contains:

The GetFile Interface - This is an interface which allows classes to call the relevant GetFile implementing class & get a File.

GetFileException - A Simple Excption class thrown if there is an error in getting a file.

GetFileJNDI -  implements GetFile & allows for the getting of files via JNDI

GetFileURL - the main implementation of GetFile. It will get files from a local disk, a URL or from within a Zip / Jar file.

ProcessProperties - This is the basic class used to process properties files & args & in effect provides the arg / commandline handling for an application. Args are fed in as if they were properties (i.e. x=y sort of thing e.g. File=myfile.txt)

StringStore - This is a class which stores / writes out to file a string. It is used with classes which don't have a native way of persisting text (XML or otherwise).

JDOMDocumentHandler - This is a class which gets JDOM Documents from either disk or the objectcache & saves them (again to both a file & to the objectcache).

.messaging

This is a container for all messaging classes. At the moment this is only JMS but I would like to do some web services classes as well.

.messaging.jms - This contains the JMS Messaging Code & contains:

JMSWrapper - This is a class which wraps all the JMS related actions. At the moment it only handles topics but it would be extremely easy to modify it to cope with queues as well (but I simply haven't needed to use Queues so.....). It has a variety of methods from sending to receiving & will run as a messageListener for testing (or possibly even production) purposes (using the receiveTest() method for normal text messages &  receiveTestObj() for Objects sent via JMS. It will cope with every JMS Implementation I have tried it with including SonicMQ & it's unique way of doing things.

.objectcache

This contains a single class which is:

ObjectCache - This acts as an objectcache such that files which are processed & can then be reused such as xslt sheets, map files, property files etc can be processed once & then resused directly as objects thus speeding things up especially when the code is being used in a server.

.props

This package contains classes which the static values for different parts of the code. These are then used when trying to get the relevant values from properties objects . The classes are:

ContainerProps - This is the static values for the Container class.

JMSProps -  This is the static values for use with JMS

MapbuilderProps - This is the static values for the Mapbuilder.

ServerProps - This is the static values for the server code.

XMLDBMSProps - This is the static values for the XMLDBMS version 1 code

XSLTProps - This is the static values for use with XSLT.

.samples

This contains various useable sample programs. Most are simple and are test classes e.g. XSLTTest allows you to provide a source XML file & an XSLT Sheet & then to look at the output. The Package contains:

GeneratePropFile - This allows you to feed in a set of args in the standard x=y way & it will take these args & produce a properties file.

jartest - A Class to test loading files from a jar/zip file.

JMSReceive - a Class which when running will sit & wait for Messages coming from a JMS Topic.

JMSReceiveObject - the same as above but will work with Objects instead of text messages

JMSSend - a class whihc allows you to send files via JMS.

MDB - An empty example Message Driven Bean.

Proptest - a simple class to test loading properties from a properties file.

XSLTest - a class which allows you to test your XSLT sheets.

.server
.server.mdb

I am working on these so I will only give a brief description. The Server classes are for running the code within a server. At the moment only Message Driven actions / useage is in existence. I will do a servlet implementation & a stored Proceedure implementation.

.transform

This is the package where any XML Transformation classes go. At present this is only XSLT.

.transform.xslt

This package contains the XSLT classes & contains:

ProcessXslt - This is the basic interface

XSLTLoader - This class loads the relevant ProcessXslt implementation

ProcessXalan1 - The Xalan 1 implementation

ProcessXalan2 - The Xalan 2 implementation

.xmldbms

This is the package which contains XML-DBMS (XD) specific code.

.xmldbms.gui

This is where the version independant GUI code for  XD goes & contains:

PropertiesEditor - an Editor / builder for the properties files that the code uses.

.xmldbms.gui.mapbuilder

This package is where the version independant Map Builder code goes & contains the code needed for the GUI in order to build Map Files. It contains:

DBAnalyser - This class Analyses the Databases by going to get specific pieces of the Database Metadata e.g. getCatalogs() goes & calls DatabaseMetadata.getCatalogs()

DBSettings - GUI which handles the Database settings (contained in the settings XML File).

FileChooser - A Genericized FileChooser for loading & saving files.

JMSSettings - GUI which handles the JMS settings (contained in the settings XML File).

SaveSettingsDialog - A Dialog for use when saving settings.

StaticDBDoc - the Database JDOM Document.

StaticMapDocI - An interface allowing the GUI to load different Mapfiles & their handlers (e.g. V1 & V2)

StaticMBJDOMTrees - Contains the 2 JDOMTreemodels (the Db one & the Map file one)

StaticMenuh - A Static Hashtable for containing the menu & submenu objects.

StaticProp - the Properties Object in use by the GUI.

StaticSettingsDoc - the settings JDOM Doc.


.xmldbms.v1

This contains the general (commandline) tools for XML-DBMS version 1. It contains:

GenerateMap - If you have the DTD you can use this to generate the mapfile & the SQL files needed to build the tables to hold the information contained in an XML File.

MapEngine - the engine used by GenerateMap which builds the Map Files.

Transfer - the Class which allows you to store or retrieve XML Documents to / from a DBMS

.xmldbms.v1.gui

This Package contains all the XML-DBMS Version 1 specific GUI code. It contains:

ClassMap -  an extension of JInternalFrame which handles ClassMap elements.

CMFromTable - This transforms the information contained within the StaticDBDoc for a given (chosen) table into a ClassMap Element

DBHandler - Handles all the DB Connections (e.g. used by DBAnalyser)

IgnoreRoot -  an extension of JInternalFrame which handles IgnoreRoot elements.

InternalFrameHandler - Works out what sort of element it is dealing with & calls the relevant GUI part (e.g. IgnoreRoot)

MapBuilderPlugin - the MapBuilder Main Plugin (this is what is called by Container).

Options-  an extension of JInternalFrame which handles Options elements.

StaticMapDoc - The Map Document being used in the GUI.

TestXD - the Test Class Allowing you to test your Mapfiles etc from within the GUI.