Source Code Cross Referenced for XmlReader.java in  » ESB » open-esb » com » sun » jbi » management » internal » support » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ESB » open esb » com.sun.jbi.management.internal.support 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * BEGIN_HEADER - DO NOT EDIT
0003:         *
0004:         * The contents of this file are subject to the terms
0005:         * of the Common Development and Distribution License
0006:         * (the "License").  You may not use this file except
0007:         * in compliance with the License.
0008:         *
0009:         * You can obtain a copy of the license at
0010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
0011:         * See the License for the specific language governing
0012:         * permissions and limitations under the License.
0013:         *
0014:         * When distributing Covered Code, include this CDDL
0015:         * HEADER in each file and include the License file at
0016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
0017:         * If applicable add the following below this CDDL HEADER,
0018:         * with the fields enclosed by brackets "[]" replaced with
0019:         * your own identifying information: Portions Copyright
0020:         * [year] [name of copyright owner]
0021:         */
0022:
0023:        /*
0024:         * @(#)XmlReader.java
0025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
0026:         *
0027:         * END_HEADER - DO NOT EDIT
0028:         */
0029:        package com.sun.jbi.management.internal.support;
0030:
0031:        import com.sun.jbi.component.InstallationContext;
0032:        import com.sun.jbi.management.ComponentInstallationContext;
0033:        import com.sun.jbi.EnvironmentContext;
0034:
0035:        import java.io.File;
0036:        import java.io.FileInputStream;
0037:
0038:        import java.util.Vector;
0039:
0040:        import javax.xml.parsers.DocumentBuilderFactory;
0041:        import javax.xml.parsers.DocumentBuilder;
0042:
0043:        import com.sun.org.apache.xpath.internal.XPathAPI;
0044:
0045:        import org.w3c.dom.Attr;
0046:        import org.w3c.dom.CDATASection;
0047:        import org.w3c.dom.Comment;
0048:        import org.w3c.dom.Document;
0049:        import org.w3c.dom.DocumentType;
0050:        import org.w3c.dom.DocumentFragment;
0051:        import org.w3c.dom.Element;
0052:        import org.w3c.dom.NamedNodeMap;
0053:        import org.w3c.dom.Node;
0054:        import org.w3c.dom.NodeList;
0055:        import org.w3c.dom.Notation;
0056:        import org.w3c.dom.ProcessingInstruction;
0057:        import org.w3c.dom.Text;
0058:
0059:        import org.xml.sax.SAXParseException;
0060:        import org.xml.sax.InputSource;
0061:        import java.io.CharArrayReader;
0062:
0063:        /**
0064:         * XmlReader -- read in and print out expected values from the specified
0065:         * file (supposedly the jbi.xml file from the archive).
0066:         *
0067:         * @author Sun Microsystems, Inc.
0068:         *
0069:         */
0070:        public class XmlReader implements  org.xml.sax.ErrorHandler,
0071:                org.xml.sax.EntityResolver {
0072:
0073:            // ============================= member variables =============================
0074:
0075:            /**
0076:             * The Document being parsed
0077:             */
0078:            private Document mDocument;
0079:
0080:            /**
0081:             * The DocumentFramgment representing the component (part of the spec)
0082:             */
0083:            private DocumentFragment mComponentFragment;
0084:
0085:            /**
0086:             * The DocumentFramgment representing the ID extensions (NOT part of the spec)
0087:             */
0088:            private DocumentFragment mIdentificationFragment;
0089:
0090:            /**
0091:             * Set to true when an error is found
0092:             */
0093:            private boolean mErrorsFound;
0094:
0095:            /**
0096:             * Set to true when a binding was found
0097:             */
0098:            private boolean mSawBinding;
0099:
0100:            /**
0101:             * Set to true when an engine was found
0102:             */
0103:            private boolean mSawEngine;
0104:
0105:            /**
0106:             * Set to true when a service deployment was found
0107:             */
0108:            private boolean mSawDeployment;
0109:
0110:            /**
0111:             * Set to true when a shared library (definition) was found
0112:             */
0113:            private boolean mSawLibrary;
0114:
0115:            /**
0116:             * Save the description on parsing.
0117:             */
0118:            private String mSavedDescription;
0119:
0120:            /**
0121:             * Save the ID on parsing.
0122:             */
0123:            private String mSavedId;
0124:
0125:            /**
0126:             * Save the list of shared libraries
0127:             */
0128:            private Vector mSavedSharedLibraryIds;
0129:
0130:            /**
0131:             * Save the list of life cycle class names
0132:             */
0133:            private Vector mSavedLifecycleClassNames;
0134:
0135:            /**
0136:             * Save the Lifecycle class path
0137:             */
0138:            private Vector mSavedLifecycleClassPath;
0139:
0140:            /**
0141:             * Save the Bootstrap class name
0142:             */
0143:            private String mSavedBootstrapClassName;
0144:
0145:            /**
0146:             * Save the Bootstrap class path
0147:             */
0148:            private Vector mSavedBootstrapClassPath;
0149:
0150:            /**
0151:             * Save the Bootstrap class loader delegation, if specified
0152:             */
0153:            private boolean mSavedBootstrapClassLoaderDelegation;
0154:
0155:            /**
0156:             * Save the Component class loader delegation, if specified
0157:             */
0158:            private boolean mSavedComponentClassLoaderDelegation;
0159:
0160:            /**
0161:             * Save the Shared Library class loader delegation, if specified
0162:             */
0163:            private boolean mSavedSharedLibraryClassLoaderDelegation;
0164:
0165:            /**
0166:             * A pointer to a global environment context
0167:             */
0168:            private EnvironmentContext mEnvironmentContext;
0169:
0170:            /**
0171:             * Path to the jbi.xsd file (from JBI_HOME)
0172:             */
0173:            private static final String PATH_TO_SCHEMA_FILE = "/schemas/jbi.xsd";
0174:
0175:            /**
0176:             * Path to the managementMessage.xsd file (from JBI_HOME)
0177:             */
0178:            private static final String PATH_TO_MM_SCHEMA_FILE = "/schemas/managementMessage.xsd";
0179:
0180:            /**
0181:             * Flag indicating management message validation
0182:             */
0183:            private boolean mIsValidateManagementMsg = false;
0184:
0185:            // ============================== constructors ==============================
0186:
0187:            /**
0188:             * Default constructor.
0189:             */
0190:            public XmlReader() {
0191:                mDocument = null;
0192:                mComponentFragment = null;
0193:                mIdentificationFragment = null;
0194:                mEnvironmentContext = getEnvironmentContext();
0195:                mErrorsFound = false;
0196:                mSawBinding = false;
0197:                mSawEngine = false;
0198:                mSawDeployment = false;
0199:                mSawLibrary = false;
0200:            }
0201:
0202:            // ============================== methods ==============================
0203:
0204:            /**
0205:             * Extract all information from the jbi.xml file.
0206:             * @param aFileName the specified "jbi.xml" file
0207:             * @param isOnlyIdNeeded true if we want to return Id (only)
0208:             * @return the UUID of the JBI component
0209:             * @throws Exception when unable to process a valid
0210:             * configuration file.
0211:             */
0212:            public String loadAndParse(String aFileName, boolean isOnlyIdNeeded)
0213:                    throws Exception {
0214:                try {
0215:                    File configFile = new File(aFileName);
0216:
0217:                    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
0218:                            .newInstance();
0219:
0220:                    DocumentBuilder docBuilder = docBuilderFactory
0221:                            .newDocumentBuilder();
0222:                    docBuilder.setErrorHandler(this );
0223:                    mDocument = docBuilder.parse(configFile);
0224:
0225:                    if (null == mDocument) {
0226:                        return null;
0227:                    }
0228:
0229:                    mSavedId = null; // clear out any previously saved id.
0230:                    jbiParse(!isOnlyIdNeeded);
0231:
0232:                    if (!isOnlyIdNeeded) {
0233:                        tellWhatWeFound();
0234:                    }
0235:                    return mSavedId;
0236:                } catch (java.io.FileNotFoundException nfe) {
0237:                    throw (nfe);
0238:                } catch (org.xml.sax.SAXParseException spe) {
0239:                    throw (spe);
0240:                } catch (Exception e) {
0241:                    throw (e);
0242:                }
0243:                // return null;
0244:            }
0245:
0246:            /**
0247:             * Validate the jbi.xml file.
0248:             * @param istr is the InputStream to the "jbi.xml" file
0249:             * @return true iff the file passes validation
0250:             * @throws Exception when unable to process a valid
0251:             * configuration file.
0252:             */
0253:            public boolean validate(java.io.InputStream istr) throws Exception {
0254:                try {
0255:                    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
0256:                            .newInstance();
0257:
0258:                    docBuilderFactory.setValidating(true);
0259:                    docBuilderFactory.setNamespaceAware(true);
0260:                    docBuilderFactory
0261:                            .setAttribute(
0262:                                    "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
0263:                                    "http://www.w3.org/2001/XMLSchema");
0264:                    String jbiHome = mEnvironmentContext.getJbiInstallRoot();
0265:                    // convert any '\'s into '/'
0266:                    if ((null == jbiHome) || ("".equals(jbiHome))) {
0267:                        return false;
0268:                    }
0269:                    jbiHome = jbiHome.replace('\\', '/');
0270:                    String schema = jbiHome + PATH_TO_SCHEMA_FILE;
0271:                    docBuilderFactory
0272:                            .setAttribute(
0273:                                    "http://java.sun.com/xml/jaxp/properties/schemaSource",
0274:                                    schema);
0275:
0276:                    DocumentBuilder docBuilder = docBuilderFactory
0277:                            .newDocumentBuilder();
0278:                    docBuilder.setErrorHandler(this );
0279:                    docBuilder.setEntityResolver(this );
0280:
0281:                    mDocument = docBuilder.parse(istr);
0282:                    istr.close();
0283:                    return (null != mDocument);
0284:
0285:                } catch (org.xml.sax.SAXParseException spe) {
0286:                    throw (spe);
0287:                } catch (Exception e) {
0288:                    throw (e);
0289:                }
0290:                // return false;
0291:            }
0292:
0293:            /**
0294:             * Validate the jbi.xml file.
0295:             * @param aFileName the specified "jbi.xml" file
0296:             * @return true iff the file passes validation
0297:             * @throws Exception when unable to process a valid
0298:             * configuration file.
0299:             */
0300:            public boolean validate(String aFileName) throws Exception {
0301:                try {
0302:                    File configFile = new File(aFileName);
0303:                    java.io.InputStream config = new FileInputStream(configFile);
0304:                    return validate(config);
0305:                } catch (java.io.FileNotFoundException nfe) {
0306:                    throw (nfe);
0307:                } catch (Exception e) {
0308:                    throw (e);
0309:                }
0310:                // return false;
0311:            }
0312:
0313:            /**
0314:             * Validate management message.
0315:             * @param aMMsgStr management message string
0316:             * @return true iff the file passes validation
0317:             * @throws Exception when unable to process a valid
0318:             * configuration file.
0319:             */
0320:            public boolean validateManagementMessage(String aMMsgStr)
0321:                    throws Exception {
0322:                try {
0323:                    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
0324:                            .newInstance();
0325:
0326:                    mIsValidateManagementMsg = true;
0327:                    docBuilderFactory.setValidating(true);
0328:                    docBuilderFactory.setNamespaceAware(true);
0329:                    docBuilderFactory
0330:                            .setAttribute(
0331:                                    "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
0332:                                    "http://www.w3.org/2001/XMLSchema");
0333:                    String jbiHome = mEnvironmentContext.getJbiInstallRoot();
0334:                    // convert any '\'s into '/'
0335:                    if ((null == jbiHome) || ("".equals(jbiHome))) {
0336:                        return false;
0337:                    }
0338:                    jbiHome = jbiHome.replace('\\', '/');
0339:                    String schema = jbiHome + PATH_TO_MM_SCHEMA_FILE;
0340:                    docBuilderFactory
0341:                            .setAttribute(
0342:                                    "http://java.sun.com/xml/jaxp/properties/schemaSource",
0343:                                    schema);
0344:
0345:                    DocumentBuilder docBuilder = docBuilderFactory
0346:                            .newDocumentBuilder();
0347:                    docBuilder.setErrorHandler(this );
0348:                    docBuilder.setEntityResolver(this );
0349:
0350:                    InputSource isrc = new InputSource((new CharArrayReader(
0351:                            aMMsgStr.toCharArray())));
0352:                    mDocument = docBuilder.parse(isrc);
0353:                    return (null != mDocument);
0354:                } catch (java.io.FileNotFoundException nfe) {
0355:                    throw (nfe);
0356:                } catch (org.xml.sax.SAXParseException spe) {
0357:                    throw (spe);
0358:                } catch (Exception e) {
0359:                    throw (e);
0360:                }
0361:                // return false;
0362:            }
0363:
0364:            /**
0365:             * This is a callback from the XML parser used to handle errors.
0366:             * @param aSaxException SAXParseException is the error.
0367:             * @throws org.xml.sax.SAXException when finished logging.
0368:             */
0369:            public void error(SAXParseException aSaxException)
0370:                    throws org.xml.sax.SAXException {
0371:                throw aSaxException;
0372:            }
0373:
0374:            /**
0375:             * This is a callback from the XML parser used to handle errors.
0376:             * @param aSaxException SAXParseException is the error.
0377:             * @throws org.xml.sax.SAXException when finished logging.
0378:             */
0379:            public void fatalError(SAXParseException aSaxException)
0380:                    throws org.xml.sax.SAXException {
0381:                throw aSaxException;
0382:            }
0383:
0384:            /**
0385:             * The resolveEntity method resolves schema references only,  a reference
0386:             * to the XML definition of the XML configuration file is resolved to return
0387:             * an InputSource created for the local schema definition file. The schema definition
0388:             * file should be present in the EntityResolvers work directory. If the referenced
0389:             * entity is not the schema definition a null value is returned such that the XML
0390:             * parser can apply the default entity resolution logic.
0391:             *
0392:             * @param publicId - The public identifier of the external entity being referenced,
0393:             * or null if none was supplied.
0394:             * @param systemId - The system identifier of the external entity being referenced.
0395:             * @return An InputSource object describing the new input source, or null to request
0396:             * that the parser open a regular URI connection to the system identifier
0397:             *
0398:             * @see org.xml.sax.EntityResolver
0399:             */
0400:            public InputSource resolveEntity(String publicId, String systemId) {
0401:                InputSource mIpSrc = null;
0402:
0403:                String jbiHome = mEnvironmentContext.getJbiInstallRoot();
0404:                // convert any '\'s into '/'
0405:                if ((null == jbiHome) || ("".equals(jbiHome))) {
0406:                    return mIpSrc;
0407:                }
0408:                jbiHome = jbiHome.replace('\\', '/');
0409:
0410:                try {
0411:                    if (mIsValidateManagementMsg) {
0412:                        mIpSrc = new InputSource(new FileInputStream(new File(
0413:                                jbiHome + PATH_TO_MM_SCHEMA_FILE)));
0414:                    } else {
0415:                        mIpSrc = new InputSource(new FileInputStream(new File(
0416:                                jbiHome + PATH_TO_SCHEMA_FILE)));
0417:                    }
0418:                } catch (java.io.FileNotFoundException nfe) {
0419:                    // just drop it and return null.
0420:                }
0421:
0422:                return mIpSrc;
0423:            }
0424:
0425:            /**
0426:             * This is a callback from the XML parser used to handle warnings.
0427:             * @param aSaxException SAXParseException is the warning.
0428:             * @throws org.xml.sax.SAXException when finished logging.
0429:             */
0430:            public void warning(SAXParseException aSaxException)
0431:                    throws org.xml.sax.SAXException {
0432:                throw aSaxException;
0433:            }
0434:
0435:            /**
0436:             * display the information found.
0437:             * @param isRegressTest true iff being run from regress test (println is ok)
0438:             */
0439:            void jbiParse(boolean isRegressTest) {
0440:                String type = null;
0441:                mSavedId = null;
0442:                mSavedDescription = null;
0443:                mSavedBootstrapClassName = null;
0444:                mSavedBootstrapClassPath = null;
0445:                mSavedLifecycleClassNames = null;
0446:                mSavedLifecycleClassPath = null;
0447:                mSavedSharedLibraryIds = null;
0448:                mSawBinding = false;
0449:                mSawEngine = false;
0450:                mSawDeployment = false;
0451:                mSawLibrary = false;
0452:                mComponentFragment = null;
0453:                mIdentificationFragment = null;
0454:                mSavedBootstrapClassLoaderDelegation = false;
0455:                mSavedComponentClassLoaderDelegation = false;
0456:                mSavedSharedLibraryClassLoaderDelegation = false;
0457:
0458:                try {
0459:                    if (null != (strip(XPathAPI.selectNodeList(mDocument,
0460:                            "jbi/component")))) {
0461:                        mSavedId = stripString("jbi/component/identification/name");
0462:                        mSavedDescription = stripString("jbi/component/identification/description");
0463:                        mSavedLifecycleClassNames = stripArray("jbi/component/component-class-name");
0464:                        mSavedLifecycleClassPath = stripArray("jbi/component/component-class-path/path-element");
0465:                        mSavedBootstrapClassName = stripString("jbi/component/bootstrap-class-name");
0466:                        mSavedBootstrapClassPath = stripArray("jbi/component/bootstrap-class-path/path-element");
0467:                        mSavedSharedLibraryIds = stripArray("jbi/component/shared-library");
0468:
0469:                        NodeList componentTree = XPathAPI.selectNodeList(
0470:                                mDocument, "jbi/component");
0471:                        if (null != componentTree.item(0)) {
0472:                            // skip up to the bootstrap-class-path entry
0473:
0474:                            NodeList nl = componentTree.item(0).getChildNodes();
0475:                            boolean foundBootstrap = false;
0476:                            for (int i = 0; i < nl.getLength(); i++) {
0477:                                Node n = nl.item(i);
0478:                                if (n.getNodeType() == Node.ELEMENT_NODE) {
0479:                                    Element elem = (Element) n;
0480:                                    String nn = elem.getTagName();
0481:                                    if (!foundBootstrap) {
0482:                                        foundBootstrap = ("bootstrap-class-path"
0483:                                                .equals(nn));
0484:                                    }
0485:                                    // skip the shared-library elements
0486:                                    else if ("shared-library".equals(nn)) {
0487:                                        // do nothing
0488:                                    } else {
0489:                                        if (null == mComponentFragment) {
0490:                                            mComponentFragment = mDocument
0491:                                                    .createDocumentFragment();
0492:                                        }
0493:                                        mComponentFragment.appendChild(n);
0494:                                    }
0495:                                }
0496:                            }
0497:                        }
0498:
0499:                        // was an optional BootstrapClassLoaderDelegation specified?
0500:                        Node typeNode = componentTree.item(0).getAttributes()
0501:                                .getNamedItem(
0502:                                        "bootstrap-class-loader-delegation");
0503:                        if (null != typeNode) {
0504:                            type = typeNode.getNodeValue();
0505:                            mSavedBootstrapClassLoaderDelegation = ("self-first"
0506:                                    .equals(type));
0507:                            // reset type for later
0508:                            type = null;
0509:                        }
0510:
0511:                        // was an optional ComponentClassLoaderDelegation specified?
0512:                        typeNode = componentTree.item(0).getAttributes()
0513:                                .getNamedItem(
0514:                                        "component-class-loader-delegation");
0515:                        if (null != typeNode) {
0516:                            type = typeNode.getNodeValue();
0517:                            mSavedComponentClassLoaderDelegation = ("self-first"
0518:                                    .equals(type));
0519:                            // reset type for later
0520:                            type = null;
0521:                        }
0522:
0523:                        // make sure that either a Binding or Engine was specified
0524:                        typeNode = componentTree.item(0).getAttributes()
0525:                                .getNamedItem("type");
0526:                        if (null != typeNode) {
0527:                            type = typeNode.getNodeValue();
0528:                        }
0529:                        if ("binding-component".equals(type)) {
0530:                            mSawBinding = true;
0531:                        } else if ("service-engine".equals(type)) {
0532:                            mSawEngine = true;
0533:                        } else {
0534:                            // error
0535:                            if (isRegressTest) {
0536:                                System.out
0537:                                        .println("Invalid Component subtype: "
0538:                                                + type);
0539:                            }
0540:                            mSavedId = null;
0541:                        }
0542:
0543:                        componentTree = XPathAPI.selectNodeList(mDocument,
0544:                                "jbi/component/identification");
0545:                        if (null != componentTree.item(0)) {
0546:                            // skip name and description entries
0547:
0548:                            NodeList nl = componentTree.item(0).getChildNodes();
0549:                            for (int i = 0; i < nl.getLength(); i++) {
0550:                                Node n = nl.item(i);
0551:                                if (n.getNodeType() == Node.ELEMENT_NODE) {
0552:                                    Element elem = (Element) n;
0553:                                    String nn = elem.getTagName();
0554:                                    if ("name".equals(nn)) {
0555:                                        // skip it
0556:                                    } else if ("description".equals(nn)) {
0557:                                        // skip that one too
0558:                                    } else {
0559:                                        if (null == mIdentificationFragment) {
0560:                                            mIdentificationFragment = mDocument
0561:                                                    .createDocumentFragment();
0562:                                        }
0563:                                        mIdentificationFragment.appendChild(n);
0564:                                    }
0565:                                }
0566:                            }
0567:                        }
0568:                    }
0569:
0570:                    else if (null != (strip(XPathAPI.selectNodeList(mDocument,
0571:                            "jbi/service-assembly")))) {
0572:                        mSawDeployment = true;
0573:                        mSavedId = stripString("jbi/service-assembly/identification/component-name");
0574:                        mSavedDescription = stripString("jbi/service-assembly/identification/description");
0575:                        NodeList componentTree = XPathAPI.selectNodeList(
0576:                                mDocument,
0577:                                "jbi/service-assembly/identification");
0578:                        if (null != componentTree.item(0)) {
0579:                            // skip name and description entries
0580:
0581:                            NodeList nl = componentTree.item(0).getChildNodes();
0582:                            for (int i = 0; i < nl.getLength(); i++) {
0583:                                Node n = nl.item(i);
0584:                                if (n.getNodeType() == Node.ELEMENT_NODE) {
0585:                                    Element elem = (Element) n;
0586:                                    String nn = elem.getTagName();
0587:                                    if ("name".equals(nn)) {
0588:                                        // skip it
0589:                                    } else if ("description".equals(nn)) {
0590:                                        // skip that one too
0591:                                    } else {
0592:                                        if (null == mIdentificationFragment) {
0593:                                            mIdentificationFragment = mDocument
0594:                                                    .createDocumentFragment();
0595:                                        }
0596:                                        mIdentificationFragment.appendChild(n);
0597:                                    }
0598:                                }
0599:                            }
0600:                        }
0601:                    } else if (null != (strip(XPathAPI.selectNodeList(
0602:                            mDocument, "jbi/shared-library")))) {
0603:                        mSawLibrary = true;
0604:                        mSavedId = stripString("jbi/shared-library/identification/name");
0605:                        mSavedDescription = stripString("jbi/shared-library/identification/description");
0606:                        mSavedLifecycleClassPath = stripArray("jbi/shared-library/shared-library-class-path/path-element");
0607:                        // was an optional ComponentClassLoaderDelegation specified?
0608:                        NodeList componentTree = XPathAPI.selectNodeList(
0609:                                mDocument, "jbi/shared-library");
0610:                        Node typeNode = componentTree.item(0).getAttributes()
0611:                                .getNamedItem("class-loader-delegation");
0612:                        if (null != typeNode) {
0613:                            type = typeNode.getNodeValue();
0614:                            mSavedSharedLibraryClassLoaderDelegation = ("self-first"
0615:                                    .equals(type));
0616:                        }
0617:                        componentTree = XPathAPI.selectNodeList(mDocument,
0618:                                "jbi/shared-library/identification");
0619:                        if (null != componentTree.item(0)) {
0620:                            // skip name and description entries
0621:
0622:                            NodeList nl = componentTree.item(0).getChildNodes();
0623:                            for (int i = 0; i < nl.getLength(); i++) {
0624:                                Node n = nl.item(i);
0625:                                if (n.getNodeType() == Node.ELEMENT_NODE) {
0626:                                    Element elem = (Element) n;
0627:                                    String nn = elem.getTagName();
0628:                                    if ("name".equals(nn)) {
0629:                                        // skip it
0630:                                    } else if ("description".equals(nn)) {
0631:                                        // skip that one too
0632:                                    } else {
0633:                                        if (null == mIdentificationFragment) {
0634:                                            mIdentificationFragment = mDocument
0635:                                                    .createDocumentFragment();
0636:                                        }
0637:                                        mIdentificationFragment.appendChild(n);
0638:                                    }
0639:                                }
0640:                            }
0641:                        }
0642:                    } else {
0643:                        // error
0644:                        if (isRegressTest) {
0645:                            System.out.println("Invalid Component type.");
0646:                        }
0647:                    }
0648:                } catch (javax.xml.transform.TransformerException te) {
0649:                    if (isRegressTest) {
0650:                        System.out.println("Unexpected Exception: "
0651:                                + te.toString());
0652:                    }
0653:                    // throw(te);
0654:                } catch (Throwable t) {
0655:                    if (isRegressTest) {
0656:                        System.out.println("Unexpected Exception: "
0657:                                + t.getClass().getName());
0658:                        t.printStackTrace();
0659:                    }
0660:                }
0661:
0662:            }
0663:
0664:            /**
0665:             * display the information found.
0666:             *
0667:             * Note: This routine is *not* called from anywhere that records to the
0668:             * server.log file (it's only used by regression test manage00002), so the
0669:             * println messages in this routine are known to not be I18N'd.
0670:             */
0671:            void tellWhatWeFound() {
0672:                int totalMatches = 0;
0673:                int matched;
0674:
0675:                String type = null;
0676:                try {
0677:                    if (null != (strip(XPathAPI.selectNodeList(mDocument,
0678:                            "jbi/component")))) {
0679:                        NodeList componentTree = XPathAPI.selectNodeList(
0680:                                mDocument, "jbi/component");
0681:                        Node typeNode = componentTree.item(0).getAttributes()
0682:                                .getNamedItem("type");
0683:                        if (null != typeNode) {
0684:                            type = typeNode.getNodeValue();
0685:                        }
0686:                    } else if (null != (strip(XPathAPI.selectNodeList(
0687:                            mDocument, "jbi/service-assembly")))) {
0688:                        type = "service-assembly";
0689:                    } else if (null != (strip(XPathAPI.selectNodeList(
0690:                            mDocument, "jbi/shared-library")))) {
0691:                        type = "shared-library";
0692:                    } else {
0693:                        type = "invalid";
0694:                    }
0695:                } catch (javax.xml.transform.TransformerException te) {
0696:                    System.out
0697:                            .println("Unexpected Exception: " + te.toString());
0698:                    // throw(te);
0699:                }
0700:
0701:                if (mSawEngine || mSawBinding) {
0702:                    System.out.println("JBI Type:" + type);
0703:                    System.out
0704:                            .println("COMPONENT CLASS LOADER DELEGATION: "
0705:                                    + delegationToString(mSavedComponentClassLoaderDelegation));
0706:                    System.out
0707:                            .println("BOOTSTRAP CLASS LOADER DELEGATION: "
0708:                                    + delegationToString(mSavedBootstrapClassLoaderDelegation));
0709:                    System.out.println("ID: " + mSavedId);
0710:                    System.out.println("DESCRIPTION: " + getDescription());
0711:                    System.out.println("COMPONENT CLASS: "
0712:                            + mSavedLifecycleClassNames);
0713:                    System.out.println("COMPONENT CLASSPATH: "
0714:                            + mSavedLifecycleClassPath);
0715:                    System.out.println("BOOTSTRAP CLASS: "
0716:                            + mSavedBootstrapClassName);
0717:                    System.out.println("BOOTSTRAP CLASSPATH: "
0718:                            + mSavedBootstrapClassPath);
0719:                    System.out.println("SHARED LIBRARY ID:"
0720:                            + mSavedSharedLibraryIds);
0721:                    if (null != mComponentFragment) {
0722:                        System.out.println("COMPONENT DOCUMENT FRAGMENT:"
0723:                                + documentFragmentToString(mComponentFragment));
0724:                    }
0725:                    if (null != mIdentificationFragment) {
0726:                        System.out
0727:                                .println("IDENTIFICATION DOCUMENT FRAGMENT:"
0728:                                        + documentFragmentToString(mIdentificationFragment));
0729:                    }
0730:                } else if (mSawDeployment) {
0731:                    System.out.println("JBI Type:" + type);
0732:                    System.out.println("ID: " + mSavedId);
0733:                    System.out.println("DESCRIPTION: " + getDescription());
0734:                    if (null != mIdentificationFragment) {
0735:                        System.out
0736:                                .println("IDENTIFICATION DOCUMENT FRAGMENT:"
0737:                                        + documentFragmentToString(mIdentificationFragment));
0738:                    }
0739:                } else if (mSawLibrary) {
0740:                    System.out.println("JBI Type:" + type);
0741:                    System.out
0742:                            .println("CLASS LOADER DELEGATION: "
0743:                                    + delegationToString(mSavedSharedLibraryClassLoaderDelegation));
0744:                    System.out.println("ID: " + mSavedId);
0745:                    System.out.println("DESCRIPTION: " + getDescription());
0746:                    System.out.println("COMPONENT CLASSPATH: "
0747:                            + mSavedLifecycleClassPath);
0748:                    if (null != mIdentificationFragment) {
0749:                        System.out
0750:                                .println("IDENTIFICATION DOCUMENT FRAGMENT:"
0751:                                        + documentFragmentToString(mIdentificationFragment));
0752:                    }
0753:                } else {
0754:                    System.out.println("VALIDATION ERROR.");
0755:                }
0756:            }
0757:
0758:            /**
0759:             * Function to specify if the parsed component was a binding.
0760:             * @return true iff the last component parsed was a binding
0761:             */
0762:            public boolean isBinding() {
0763:                return mSawBinding;
0764:            }
0765:
0766:            /**
0767:             * Function to specify if the parsed component was an engine.
0768:             * @return true iff the last component parsed was an engine
0769:             */
0770:            public boolean isEngine() {
0771:                return mSawEngine;
0772:            }
0773:
0774:            /**
0775:             * Function to specify if the parsed component was a deployment.
0776:             * @return true iff the last component parsed was a deployment
0777:             */
0778:            public boolean isDeployment() {
0779:                return mSawDeployment;
0780:            }
0781:
0782:            /**
0783:             * Function to specify if the parsed component was a shared library.
0784:             * @return true iff the last component parsed was a shared library
0785:             */
0786:            public boolean isSharedLibrary() {
0787:                return mSawLibrary;
0788:            }
0789:
0790:            /**
0791:             * Function to return the last description parsed.
0792:             * @return the last description we saw
0793:             */
0794:            public String getDescription() {
0795:                return mSavedDescription;
0796:            }
0797:
0798:            /**
0799:             * Function to return the last component ID parsed.
0800:             * @return the last component ID we saw
0801:             */
0802:            public String getId() {
0803:                return mSavedId;
0804:            }
0805:
0806:            /**
0807:             * Function to return the last bootstrap class parsed.
0808:             * @return the bootstrap class name
0809:             */
0810:            public String getBootstrapClassName() {
0811:                return mSavedBootstrapClassName;
0812:            }
0813:
0814:            /**
0815:             * Function to return the last bootstrap classpath parsed.
0816:             * @return the bootstrap class path
0817:             */
0818:            public Vector getBootstrapClassPath() {
0819:                return mSavedBootstrapClassPath;
0820:            }
0821:
0822:            /**
0823:             * Function to return the last lifecycle classes parsed.
0824:             * @return the lifecycle classes names
0825:             */
0826:            public Vector getLifecycleClassNames() {
0827:                return mSavedLifecycleClassNames;
0828:            }
0829:
0830:            /**
0831:             * Function to return the last lifecycle classpath parsed.
0832:             * @return the lifecycle class path
0833:             */
0834:            public Vector getLifecycleClassPath() {
0835:                return mSavedLifecycleClassPath;
0836:            }
0837:
0838:            /**
0839:             * Function to return the last list of shared library ids parsed.
0840:             * @return the shared Library Ids list
0841:             */
0842:            public Vector getSharedLibraryIds() {
0843:                return mSavedSharedLibraryIds;
0844:            }
0845:
0846:            /**
0847:             * Function to return the installation context for the component.
0848:             * @return the installation context for the component.
0849:             */
0850:            public ComponentInstallationContext getInstallationContext() {
0851:                String className = null;
0852:                if (null != mSavedLifecycleClassNames
0853:                        && mSavedLifecycleClassNames.size() > 0) {
0854:                    className = (String) mSavedLifecycleClassNames.get(0);
0855:                }
0856:                ComponentInstallationContext ic = new ComponentInstallationContext(
0857:                        mSavedId, (mSawBinding ? InstallationContext.BINDING
0858:                                : InstallationContext.ENGINE), className,
0859:                        mSavedLifecycleClassPath, mComponentFragment);
0860:                ic.setDescription(mSavedDescription);
0861:                if (isAlternateBootstrapClassLoaderDelegation()) {
0862:                    ic.setBootstrapClassLoaderSelfFirst();
0863:                }
0864:                if (isAlternateComponentClassLoaderDelegation()) {
0865:                    ic.setComponentClassLoaderSelfFirst();
0866:                }
0867:                return ic;
0868:            }
0869:
0870:            /**
0871:             * Function to specify if the parsed component had an alternate bootstrap
0872:             * class loader delegation.
0873:             * @return true iff the last component parsed had an alternate bootstrap
0874:             * class loader delegation.
0875:             */
0876:            public boolean isAlternateBootstrapClassLoaderDelegation() {
0877:                return mSavedBootstrapClassLoaderDelegation;
0878:            }
0879:
0880:            /**
0881:             * Function to specify if the parsed component had an alternate component
0882:             * class loader delegation.
0883:             * @return true iff the last component parsed had an alternate component
0884:             * class loader delegation.
0885:             */
0886:            public boolean isAlternateComponentClassLoaderDelegation() {
0887:                return mSavedComponentClassLoaderDelegation;
0888:            }
0889:
0890:            /**
0891:             * Function to specify if the parsed shared library had an alternate
0892:             * class loader delegation.
0893:             * @return true iff the last shared library parsed had an alternate
0894:             * class loader delegation.
0895:             */
0896:            public boolean isAlternateSharedLibraryClassLoaderDelegation() {
0897:                return mSavedSharedLibraryClassLoaderDelegation;
0898:            }
0899:
0900:            /**
0901:             * Specify the global environment context.
0902:             * @param aContext the global environment context
0903:             */
0904:            public void setEnvironmentContext(EnvironmentContext aContext) {
0905:                mEnvironmentContext = aContext;
0906:            }
0907:
0908:            /**
0909:             * Return the XML Document.
0910:             * @return the document as a DOM tree
0911:             */
0912:            public Document getXmlDocument() {
0913:                return mDocument;
0914:            }
0915:
0916:            /**
0917:             * Return the XML Document Fragment from the component section.
0918:             * @return the document fragment from the component section.
0919:             */
0920:            public DocumentFragment getComponentDocumentFragment() {
0921:                return mComponentFragment;
0922:            }
0923:
0924:            /**
0925:             * Return the XML Document Fragment from the identification section.
0926:             * @return the document fragment from the identification section.
0927:             */
0928:            public DocumentFragment getIdentificationDocumentFragment() {
0929:                return mIdentificationFragment;
0930:            }
0931:
0932:            /**
0933:             * Convert the given node list to a Vector of strings.
0934:             * @param aNodeList the list of nodes we want
0935:             * @return the node list as a vector
0936:             */
0937:            Vector stripArray(NodeList aNodeList) {
0938:                Vector elements = new Vector();
0939:                for (int j = 0; j < aNodeList.getLength(); ++j) {
0940:                    Text text = (Text) aNodeList.item(j).getFirstChild();
0941:                    if (null == text) {
0942:                        continue;
0943:                    }
0944:                    String theData = text.getData();
0945:                    if (null != theData) {
0946:                        elements.addElement(theData.trim());
0947:                    }
0948:                }
0949:                return elements;
0950:            }
0951:
0952:            /**
0953:             * Convert the given node list to a single string.
0954:             * @param aNodeList the list of nodes (should be 1) we want
0955:             * @return the element as a string
0956:             */
0957:            String strip(NodeList aNodeList) {
0958:                if (aNodeList == null) {
0959:                    /* throw a parse error */
0960:                    return null;
0961:                }
0962:                if (aNodeList.getLength() == 1) {
0963:                    Text text = (Text) aNodeList.item(0).getFirstChild();
0964:                    if (null == text) {
0965:                        return null;
0966:                    }
0967:                    String theData = text.getData();
0968:                    if (null == theData) {
0969:                        return null;
0970:                    } else {
0971:                        return theData.trim();
0972:                    }
0973:                }
0974:                return null;
0975:            }
0976:
0977:            /**
0978:             * Find the specified Xpath element, and return it as a string.
0979:             * @param anXpath the path to the element we want
0980:             * @return the element as a string
0981:             * @throws javax.xml.transform.TransformerException unexpectedly.
0982:             */
0983:            String stripString(String anXpath)
0984:                    throws javax.xml.transform.TransformerException {
0985:                return strip(XPathAPI.selectNodeList(mDocument, anXpath));
0986:            }
0987:
0988:            /**
0989:             * Find the specified Xpath element, and return it as an array.
0990:             * @param anXpath the path to the element we want
0991:             * @return the element as an array
0992:             * @throws javax.xml.transform.TransformerException unexpectedly.
0993:             */
0994:            Vector stripArray(String anXpath)
0995:                    throws javax.xml.transform.TransformerException {
0996:                return stripArray(XPathAPI.selectNodeList(mDocument, anXpath));
0997:            }
0998:
0999:            /**
1000:             * Present the class loader delegation as "parent-first" or "self-first"
1001:             * @param aDelegation true if self-first, false if parent first.
1002:             * @return the delegation as "parent-first" or "self-first".
1003:             */
1004:            private String delegationToString(boolean aDelegation) {
1005:                if (aDelegation) {
1006:                    return "self-first";
1007:                } else {
1008:                    return "parent-first";
1009:                }
1010:            }
1011:
1012:            /**
1013:             * Present a Document Fragment representing extension elements as a String.
1014:             * @param aDocumentFragment the optional extension elements.
1015:             * @return the String representation of the DocumentFragment.
1016:             */
1017:            private String documentFragmentToString(
1018:                    DocumentFragment aDocumentFragment) {
1019:                return childrenAsString(aDocumentFragment);
1020:            }
1021:
1022:            /**
1023:             * Present a Node as a String.
1024:             * @param aNode the node to pretty print.
1025:             * @return the String representation of the pretty-printed Node.
1026:             */
1027:            private String nodeToString(Node aNode) {
1028:                short type = aNode.getNodeType();
1029:                switch (type) {
1030:                case Node.DOCUMENT_NODE:
1031:                    return documentToString((Document) aNode);
1032:
1033:                case Node.DOCUMENT_FRAGMENT_NODE:
1034:                    return documentFragmentToString((DocumentFragment) aNode);
1035:
1036:                case Node.DOCUMENT_TYPE_NODE:
1037:                    return documentTypeToString((DocumentType) aNode);
1038:
1039:                case Node.ELEMENT_NODE:
1040:                    return elementToString((Element) aNode);
1041:
1042:                case Node.ATTRIBUTE_NODE:
1043:                    return attributeToString((Attr) aNode);
1044:
1045:                case Node.ENTITY_REFERENCE_NODE:
1046:                    // return entityReferenceToString( (EntityReference) aNode);
1047:                    break;
1048:
1049:                case Node.ENTITY_NODE:
1050:                    // return entityToString( (Entity) aNode);
1051:                    break;
1052:
1053:                case Node.NOTATION_NODE:
1054:                    return notationToString((Notation) aNode);
1055:
1056:                case Node.PROCESSING_INSTRUCTION_NODE:
1057:                    return procInstToString((ProcessingInstruction) aNode);
1058:
1059:                case Node.TEXT_NODE:
1060:                    return textToString((Text) aNode);
1061:
1062:                case Node.COMMENT_NODE:
1063:                    return commentToString((Comment) aNode);
1064:
1065:                case Node.CDATA_SECTION_NODE:
1066:                    return cDataToString((CDATASection) aNode);
1067:                }
1068:                return null;
1069:            }
1070:
1071:            /**
1072:             * Pretty-print the children of a Node as a String.
1073:             * @param aNode the node to pretty print.
1074:             * @return the String representation of the pretty-printed Node.
1075:             */
1076:            private String prettyPrintChildren(Node node) {
1077:                StringBuffer sb = new StringBuffer();
1078:                NodeList l = node.getChildNodes();
1079:                int size = l.getLength();
1080:                for (int i = 0; i < size; i++) {
1081:                    Node n = l.item(i);
1082:                    if (n.getNodeType() == Node.TEXT_NODE) {
1083:                        Text t = (Text) n;
1084:                        sb.append("CHILD #" + i);
1085:                        sb.append(t.getData() + "\n");
1086:                    } else {
1087:                        sb.append("CHILD #" + i + "is not a Text node.\n");
1088:                        sb.append(nodeToString(n));
1089:                    }
1090:                }
1091:                return sb.toString();
1092:            }
1093:
1094:            /**
1095:             * Return the children of a Node as a String.
1096:             * @param aNode the node to pretty print.
1097:             * @return the String representation of the children of the Node.
1098:             */
1099:            private String childrenAsString(Node aNode) {
1100:                StringBuffer sb = new StringBuffer();
1101:                NodeList l = aNode.getChildNodes();
1102:                int size = l.getLength();
1103:                for (int i = 0; i < size; i++) {
1104:                    Node n = l.item(i);
1105:                    sb.append(nodeToString(n));
1106:                }
1107:                return sb.toString();
1108:            }
1109:
1110:            /**
1111:             * Present a Document representing extension elements as a String.
1112:             * @param aDocument a Document Node.
1113:             * @return the String representation of the Document.
1114:             */
1115:            private String documentToString(Document aDocument) {
1116:                return childrenAsString(aDocument);
1117:            }
1118:
1119:            /**
1120:             * Present a DocumentType as a String.
1121:             * @param aDocumentType a DocumentType Node.
1122:             * @return the String representation of the DocumentType.
1123:             */
1124:            private String documentTypeToString(DocumentType docType) {
1125:                StringBuffer sb = new StringBuffer();
1126:                sb.append("<!DOCTYPE " + docType.getName());
1127:                String pubID = docType.getPublicId();
1128:                String sysID = docType.getSystemId();
1129:                if (pubID != null) {
1130:                    sb.append(" PUBLIC " + pubID);
1131:                    if (sysID != null) {
1132:                        sb.append(" " + sysID);
1133:                    }
1134:                } else if (sysID != null) {
1135:                    sb.append(" SYSTEM " + sysID);
1136:                }
1137:                String is = docType.getInternalSubset();
1138:                if (is != null) {
1139:                    sb.append(" [" + is + "]");
1140:                }
1141:                sb.append("\n");
1142:                return sb.toString();
1143:            }
1144:
1145:            /**
1146:             * Present an Element as a String.
1147:             * @param aDocument a Element Node.
1148:             * @return the String representation of the Element.
1149:             */
1150:            private String elementToString(Element elem) {
1151:                StringBuffer sb = new StringBuffer();
1152:                String n = elem.getTagName();
1153:                sb.append("<" + n);
1154:
1155:                NamedNodeMap a = elem.getAttributes();
1156:                for (int i = 0; i < a.getLength(); i++) {
1157:                    Attr att = (Attr) a.item(i);
1158:                    sb.append(" ");
1159:                    sb.append(nodeToString(att));
1160:                }
1161:
1162:                if (elem.hasChildNodes()) {
1163:                    sb.append(">" + childrenAsString(elem));
1164:                    sb.append("</" + n + ">");
1165:                } else {
1166:                    sb.append("/>");
1167:                }
1168:                return sb.toString();
1169:            }
1170:
1171:            /**
1172:             * Present an Attribute as a String.
1173:             * @param anAttribute an Attribute Node.
1174:             * @return the String representation of the Attribute.
1175:             */
1176:            private String attributeToString(Attr anAttribute) {
1177:                return anAttribute.getName() + "=\"" + anAttribute.getValue()
1178:                        + "\"";
1179:            }
1180:
1181:            /**
1182:             * Present a Notation as a String.
1183:             * @param notation a Notation Node.
1184:             * @return the String representation of the Notation.
1185:             */
1186:            private String notationToString(Notation notation) {
1187:                StringBuffer sb = new StringBuffer();
1188:                sb.append("<!NOTATION " + notation.getNodeName());
1189:                String pubID = notation.getPublicId();
1190:                String sysID = notation.getSystemId();
1191:                if (pubID != null) {
1192:                    sb.append(" PUBLIC " + pubID);
1193:                    if (sysID != null) {
1194:                        sb.append(" " + sysID);
1195:                    }
1196:                } else if (sysID != null) {
1197:                    sb.append(" SYSTEM " + sysID);
1198:                }
1199:                sb.append("\n");
1200:                return sb.toString();
1201:            }
1202:
1203:            /**
1204:             * Present a ProcessingInstruction as a String.
1205:             * @param pi a ProcessingInstruction Node.
1206:             * @return the String representation of the ProcessingInstruction.
1207:             */
1208:            private String procInstToString(ProcessingInstruction pi) {
1209:                return "<?" + pi.getTarget() + " " + pi.getData() + "?>\n";
1210:            }
1211:
1212:            /**
1213:             * Present a Text Node as a String.
1214:             * @param text the Text Node.
1215:             * @return the String representation of the Text node.
1216:             */
1217:            private String textToString(Text text) {
1218:                return text.getData();
1219:            }
1220:
1221:            /**
1222:             * Present a cDataSection Node as a String.
1223:             * @param cdata the cDataSection Node.
1224:             * @return the String representation of the cDataSection node.
1225:             */
1226:            private String cDataToString(CDATASection cdata) {
1227:                return "<![CDATA[" + cdata.getData() + "]]>\n";
1228:            }
1229:
1230:            /**
1231:             * Present a comment Node as a String.
1232:             * @param comment the Comment Node.
1233:             * @return the String representation of the Comment node.
1234:             */
1235:            private String commentToString(Comment comment) {
1236:                return "<!--" + comment.getData() + "-->\n";
1237:            }
1238:
1239:            /**
1240:             * Get the Environment Context
1241:             */
1242:            private EnvironmentContext getEnvironmentContext() {
1243:                if (mEnvironmentContext == null) {
1244:                    mEnvironmentContext = com.sun.jbi.util.EnvironmentAccess
1245:                            .getContext();
1246:                }
1247:                return mEnvironmentContext;
1248:
1249:            }
1250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.