Deploying Generated Code

If your XSLT application uses Stylus Studio's adapter file system technology - to convert CSV or EDI to XML, or to render relational data as XML, for example - you need to use the optional Stylus Studio 2007 XML Deployment Adapters if you wish to deploy your code to a test or application server. The Stylus Studio 2007 XML Deployment Adapters are purchased and installed separately from Stylus Studio 2007 XML Enterprise Suite. Write Stylus Studio at stylusstudio@stylusstudio.com, or call 781.280.4488 for more information.

Overview

The process for deploying generated XSLT code that uses Stylus Studio's adapter file system technology includes the following steps:

In Stylus Studio
1. Build and test the application in Stylus Studio. When testing, be sure to use the XSLT processor you will be using in your production environment. You specify the XSLT processor on the Processors tab of the Scenario Properties dialog box.
2. Generate and compile Java code for the XSLT in Stylus Studio ( myApplication.java, for example).
3. Copy the XSLT ( .xsl), source ( .edi, for example), and Java file for the generated application ( .java) to the target production server.
On the Production Server
1. If you have not done so already, install the Stylus Studio 2007 XML Deployment Adapters module.
2. Modify the classpath to include the location of the Jar files associated with the Stylus Studio 2007 XML Deployment Adapters module.
3. Open the .java file ( myApplication.java, for example) and edit the following:
    • StylusFileFactory.unlockAPI() - this method's argument requires the installation ID of the the Stylus Studio 2007 XML Deployment Adapters module.
    • setProp() - these methods identify the location of Stylus Studio 2007 XML Deployment Adapters module directories.
    • m_scriptSource.setFile - this data member is the XSLT file ( .xsl).
    • m_xmlSource.setFile - this data member is the source file referenced in the XSLT.

The section of code in which you will find these files is shown here:

// This section performs initialization required by the
               
// Stylus Studio URIresolver. Further details can be found in
               
// the Stylus Studio Javadoc for package com.exln.stylus.io.
               
// setProp will not change any System properties that were
               
// set before this method was run. 
               
   StylusFileFactory.unlockAPI("310279283224998-1175126951");
               
   setProp("bindir", "C:/Program Files/Stylus Studio 2007 XML Enterprise Suite/bin");
               
   setProp("rootdir", "C:/Program Files/Stylus Studio 2007 XML Enterprise Suite");
               
   setProp("appdata", "C:/Documents and Settings/All Users/Application Data/Stylus Studio");
               
 
               
   m_useResolver = true;
               
 
               
   m_scriptSource = new ResolverSource();
               
   m_xmlSource = new ResolverSource();
               
   m_finalResult = new ResolverResult();
               
   m_scriptSource.setFile("c:/Program Files/Stylus Studio 2007 XML Enterprise 
Suite/test/myApplication.xsl");
               
   m_xmlSource.setFile("c:/Program Files/Stylus Studio 2007 XML Enterprise 
Suite/test/books.xml");
               
   m_finalResult.setNone();
               

            

4. Compile the .java file.

You can now run the application code independently, or incorporate it in another application on the same server.

About the unlockAPI() Method

The unlockAPI() method is part of the Stylus Studio Custom File System API. This method takes as its argument a Stylus Studio installation ID, one from either Stylus Studio 2007 XML Enterprise Suite, or from the Stylus Studio 2007 XML Deployment Adapter.

The Enterprise Suite installation ID is adequate for testing purposes on your local workstation, but if you want to deploy an XSLT application that uses Stylus Studio adapters on one or more test or application servers, you need to use the Deployment Adapter installation ID for the unlockAPI() method's argument.

 
Free Stylus Studio XML Training:
W3C Member