Source Code Cross Referenced for Parser.java in  » UML » MetaBoss » com » metaboss » sdlctools » frameworks » generation » pluggable » 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 » UML » MetaBoss » com.metaboss.sdlctools.frameworks.generation.pluggable 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.metaboss.sdlctools.frameworks.generation.pluggable;
016:
017:        import java.io.IOException;
018:        import java.io.InputStream;
019:        import java.net.URLConnection;
020:
021:        import javax.xml.bind.JAXBContext;
022:        import javax.xml.bind.JAXBException;
023:        import javax.xml.bind.Marshaller;
024:        import javax.xml.bind.Unmarshaller;
025:        import javax.xml.bind.Validator;
026:
027:        import org.apache.commons.logging.Log;
028:        import org.apache.commons.logging.LogFactory;
029:
030:        import com.metaboss.enterprise.bs.BSException;
031:        import com.metaboss.enterprise.bs.BSIllegalArgumentException;
032:        import com.metaboss.enterprise.bs.BSServiceProviderException;
033:        import com.metaboss.sdlctools.frameworks.generation.pluggable.plandetails.GenerationStep;
034:
035:        /** This class is an internal parsing helper wrapped around JAXB */
036:        class Parser {
037:            private static final Log sLogger = LogFactory.getLog(Parser.class);
038:
039:            private static JAXBContext cJAXBContext = null;
040:            private static Unmarshaller cUnmarshaller = null;
041:            private static Marshaller cMarshaller = null;
042:            private static Validator cValidator = null;
043:
044:            // Helper. Provides single point of access to JAXBContext
045:            private static JAXBContext getJAXBContext() throws JAXBException {
046:                if (cJAXBContext == null) {
047:                    // create a JAXBContext capable of handling classes generated into the primer.po package
048:                    cJAXBContext = JAXBContext
049:                            .newInstance("com.metaboss.sdlctools.frameworks.generation.pluggable.plandetails");
050:                }
051:                return cJAXBContext;
052:            }
053:
054:            // Helper. Provides single point of access to Unmarshaller
055:            private static Unmarshaller getUnmarshaller() throws JAXBException {
056:                if (cUnmarshaller == null) {
057:                    // create an Unmarshaller
058:                    cUnmarshaller = getJAXBContext().createUnmarshaller();
059:                }
060:                return cUnmarshaller;
061:            }
062:
063:            // Helper. Provides single point of access to Marshaller
064:            private static Marshaller getMarshaller() throws JAXBException {
065:                if (cMarshaller == null) {
066:                    // create an Marshaller
067:                    cMarshaller = getJAXBContext().createMarshaller();
068:                    cMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
069:                            Boolean.TRUE);
070:                }
071:                return cMarshaller;
072:            }
073:
074:            // Helper. Provides single point of access to Validator
075:            private static Validator getValidator() throws JAXBException {
076:                if (cValidator == null) {
077:                    // create an Marshaller
078:                    cValidator = getJAXBContext().createValidator();
079:                }
080:                return cValidator;
081:            }
082:
083:            /** Returns the parsed root element from the given URL or throws exception if there was a problem */
084:            public static GenerationStep parseGenerationPlan(
085:                    URLConnection pGenerationPlan) throws BSException {
086:                InputStream lInputStream = null;
087:                try {
088:                    lInputStream = pGenerationPlan.getInputStream();
089:                    if (lInputStream != null) {
090:                        GenerationStep lRet = (GenerationStep) getUnmarshaller()
091:                                .unmarshal(lInputStream);
092:                        return lRet;
093:                    } else
094:                        throw new BSIllegalArgumentException(
095:                                "Unable to open stream to URL "
096:                                        + pGenerationPlan.getURL()
097:                                                .toExternalForm());
098:                } catch (IOException e) {
099:                    throw new BSServiceProviderException(
100:                            "Error reading from URL "
101:                                    + pGenerationPlan.getURL().toExternalForm(),
102:                            e);
103:                } catch (JAXBException e) {
104:                    throw new BSServiceProviderException(
105:                            "Error parsing document from URL "
106:                                    + pGenerationPlan.getURL().toExternalForm(),
107:                            e);
108:                } finally {
109:                    try {
110:                        if (lInputStream != null)
111:                            lInputStream.close();
112:                    } catch (IOException e) {
113:                    }
114:                }
115:            }
116:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.