Source Code Cross Referenced for TyrexUtil.java in  » UML » MetaBoss » com » metaboss » enterprise » spi » inprocessimpl » 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.enterprise.spi.inprocessimpl 
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.enterprise.spi.inprocessimpl;
016:
017:        import org.apache.commons.logging.Log;
018:        import org.apache.commons.logging.LogFactory;
019:
020:        /** Makes sure that domain is inialisd by whoever wants to get TransactionDomain first */
021:        public class TyrexUtil {
022:            private static final Log sLogger = LogFactory
023:                    .getLog(TyrexUtil.class);
024:
025:            private static String sDomainName;
026:            static {
027:                try {
028:                    tyrex.tm.TransactionDomain lDomain = tyrex.tm.TransactionDomain
029:                            .createDomain("domainconfig.xml");
030:                    sDomainName = lDomain.getDomainName();
031:                    // Initialise all datasources
032:                    /*          This code was commented out, because tyrex works from XML file out of the box 
033:                     tyrex.resource.Resources lDomainResources = lDomain.getResources();
034:                     java.util.Iterator lIterator = lDomainResources.listConfigurations();
035:                     for( int i = 0; lIterator.hasNext(); i++)
036:                     {
037:                     // Initialise factories
038:                     tyrex.resource.ResourceConfig lConfig = (tyrex.resource.ResourceConfig)lIterator.next();
039:                     Object lFactory = lConfig.createFactory();
040:                     //-------------------------------------------------------------------------------------------------
041:                     // General tyrex problem is that config is not passed to factory correctly (or at least we could not see it
042:                     // for now we will use simple, but dirty solution
043:                     // we will try to load additional properties file with the datatsource name and
044:                     // set all the properties is it
045:                     {
046:                     String lPropertiesFileName = lConfig.getName() + ".properties";
047:                     java.io.File lFile = new java.io.File(lPropertiesFileName);
048:                     if (lFile.exists() && lFile.isFile() && lFile.canRead())
049:                     {
050:                     try
051:                     {
052:                     java.util.Properties lExtraProps = new java.util.Properties();
053:                     lExtraProps.load(new java.io.FileInputStream(lFile));
054:                     java.util.Enumeration lPropertyNames = lExtraProps.propertyNames();
055:                     Class lFactoryClass = lFactory.getClass();
056:                     while(lPropertyNames.hasMoreElements())
057:                     {
058:                     String lPropertyName = (String)lPropertyNames.nextElement();
059:                     java.lang.reflect.Method lSetMethod = lFactoryClass.getMethod("set" + lPropertyName, new Class[] { String.class });
060:                     if (lSetMethod != null)
061:                     {
062:                     lSetMethod.invoke(lFactory, new Object[] {lExtraProps.getProperty(lPropertyName)});
063:                     }
064:                     }
065:                     }
066:                     catch(Exception e)
067:                     {
068:                     // Ignore - just means that thre are no extra properties to set
069:                     sLogger.error("Exception caught while configurring " + lConfig.getName() + " datasource from file " + lPropertiesFileName, e);
070:                     }
071:                     }
072:                     else
073:                     sLogger.warn("File " + lPropertiesFileName + " not found. " + lConfig.getName() + " data source is likely to be not configurred properly.");
074:                     }
075:                     // Cloudscape only problem. Think about it latter
076:                     //                if (lFactory instanceof com.ibm.db2j.jdbc.DB2jXADataSource)
077:                     //                {
078:                     //                    if (lConfig.getName().equals("DataSources_HatMaker_Core"))
079:                     //                        ((com.ibm.db2j.jdbc.DB2jXADataSource)lFactory).setDatabaseName("C:/Cloudscape_5.1/demo/databases/HatMaker_Core");
080:                     //                    else
081:                     //                    if (lConfig.getName().equals("DataSources_HatMaker_Main"))
082:                     //                        ((com.ibm.db2j.jdbc.DB2jXADataSource)lFactory).setDatabaseName("C:/Cloudscape_5.1/demo/databases/HatMaker_Main");
083:                     //                }
084:                     // Oracle only problem. Think about it latter
085:                     lConfig.setFactory(lFactory);
086:                     }
087:                     */
088:                    // Now that we are fully setup - do recovery
089:                    lDomain.recover();
090:
091:                } catch (tyrex.tm.DomainConfigurationException e) {
092:                    sLogger
093:                            .error(
094:                                    "Error loading Tyrex domain details. Transaction and resource management facilities are not initialised properly and will not work as expected.",
095:                                    e);
096:                } catch (tyrex.tm.RecoveryException e) {
097:                    for (int i = 1; e != null; i++) {
098:                        sLogger
099:                                .error(
100:                                        "Error ("
101:                                                + i
102:                                                + ") recovering outstanding Tyrex domain transactions. Manual intervention may be required.",
103:                                        e);
104:                        e = e.getNextException();
105:                    }
106:                }
107:            }
108:
109:            /** Method used to obtain JTA's user transaction */
110:            public static tyrex.tm.TransactionDomain getTransactionDomain() {
111:                return tyrex.tm.TransactionDomain.getDomain(sDomainName);
112:            }
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.