Source Code Cross Referenced for PropsRmsManagedConnectionFactory.java in  » Workflow-Engines » wfmopen-2.1.1 » de » danet » an » workflow » rmsimpls » propsrmsra » 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 » Workflow Engines » wfmopen 2.1.1 » de.danet.an.workflow.rmsimpls.propsrmsra 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of the WfMOpen project.
003:         * Copyright (C) 2001-2005 Danet GmbH (www.danet.de), BU BTS.
004:         * All rights reserved.
005:         *
006:         * This program is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU General Public License as published by
008:         * the Free Software Foundation; either version 2 of the License, or
009:         * (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         *
020:         * $Id: PropsRmsManagedConnectionFactory.java,v 1.3 2007/05/17 21:53:00 mlipp Exp $
021:         *
022:         * $Log: PropsRmsManagedConnectionFactory.java,v $
023:         * Revision 1.3  2007/05/17 21:53:00  mlipp
024:         * Refactored resource adaptors.
025:         *
026:         * Revision 1.2  2006/09/29 12:32:07  drmlipp
027:         * Consistently using WfMOpen as projct name now.
028:         *
029:         * Revision 1.1  2006/09/24 20:57:16  mlipp
030:         * Moved RMS implementations in own sub-package.
031:         *
032:         * Revision 1.5  2006/07/11 11:13:13  drmlipp
033:         * Props RMS running.
034:         *
035:         * Revision 1.4  2006/07/10 19:18:07  mlipp
036:         * Improved equals.
037:         *
038:         * Revision 1.3  2006/07/10 13:47:46  drmlipp
039:         * Some issues (preliminaryly) fixed.
040:         *
041:         * Revision 1.2  2006/07/07 14:12:08  drmlipp
042:         * Added configuration properties.
043:         *
044:         * Revision 1.1  2006/07/05 10:58:52  drmlipp
045:         * Renamed package.
046:         *
047:         * Revision 1.1  2006/07/05 10:53:26  drmlipp
048:         * Separated generic RMS adapter client from properties based adapter.
049:         *
050:         */
051:        package de.danet.an.workflow.rmsimpls.propsrmsra;
052:
053:        import java.io.File;
054:        import java.io.FileInputStream;
055:        import java.io.IOException;
056:        import java.io.Serializable;
057:        import java.net.URI;
058:        import java.net.URISyntaxException;
059:        import java.util.Properties;
060:
061:        import javax.resource.ResourceException;
062:        import javax.resource.spi.ConnectionManager;
063:        import javax.resource.spi.ConnectionRequestInfo;
064:        import javax.resource.spi.ManagedConnection;
065:        import javax.resource.spi.ManagedConnectionFactory;
066:        import javax.resource.spi.ManagedConnectionMetaData;
067:        import javax.resource.spi.ResourceAdapterInternalException;
068:        import javax.security.auth.Subject;
069:
070:        import de.danet.an.util.ra.ManagedConnectionFactorySupport;
071:
072:        /**
073:         * The managed connection factory of the resource adapter for the properties 
074:         * files based RMS.
075:         * @author Michael Lipp
076:         */
077:        public class PropsRmsManagedConnectionFactory extends
078:                ManagedConnectionFactorySupport implements  Serializable {
079:
080:            private String propertiesDirUrl;
081:            private String usersPropertiesFile;
082:            private String groupsPropertiesFile;
083:            private String rolesPropertiesFile;
084:
085:            private Properties usersProps = null;
086:            private Properties groupsProps = null;
087:            private Properties rolesProps = null;
088:
089:            /* (non-Javadoc)
090:             * @see javax.resource.spi.ManagedConnectionFactory#createConnectionFactory
091:             */
092:            public Object createConnectionFactory(
093:                    ConnectionManager connectionManager)
094:                    throws ResourceException {
095:                return new PropsRmsConnectionFactory(this , connectionManager);
096:            }
097:
098:            /* (non-Javadoc)
099:             * @see javax.resource.spi.ManagedConnectionFactory#createManagedConnection
100:             */
101:            public ManagedConnection createManagedConnection(Subject subject,
102:                    ConnectionRequestInfo requestInfo) throws ResourceException {
103:                if (usersProps == null) {
104:                    try {
105:                        File propsDir = new File(new URI(propertiesDirUrl));
106:                        usersProps = new Properties();
107:                        if (usersPropertiesFile != null) {
108:                            usersProps.load(new FileInputStream(new File(
109:                                    propsDir, usersPropertiesFile)));
110:                        }
111:                        groupsProps = new Properties();
112:                        if (groupsPropertiesFile != null) {
113:                            groupsProps.load(new FileInputStream(new File(
114:                                    propsDir, groupsPropertiesFile)));
115:                        }
116:                        rolesProps = new Properties();
117:                        if (rolesPropertiesFile != null) {
118:                            rolesProps.load(new FileInputStream(new File(
119:                                    propsDir, rolesPropertiesFile)));
120:                        }
121:                    } catch (URISyntaxException e) {
122:                        throw (ResourceException) (new ResourceAdapterInternalException(
123:                                "Cannot access properties files: "
124:                                        + e.getMessage()).initCause(e));
125:                    } catch (IOException e) {
126:                        throw (ResourceException) (new ResourceAdapterInternalException(
127:                                "Cannot access properties files: "
128:                                        + e.getMessage()).initCause(e));
129:                    }
130:                }
131:                return new PropsRmsManagedConnection(this , subject, usersProps,
132:                        groupsProps, rolesProps);
133:            }
134:
135:            /* (non-Javadoc)
136:             * Comment copied from interface or superclass.
137:             */
138:            public ManagedConnectionMetaData createMetaData(String user) {
139:                return new PropsRmsManagedConnectionMetaData(user);
140:            }
141:
142:            /* (non-Javadoc)
143:             * @see java.lang.Object#equals(java.lang.Object)
144:             */
145:            public boolean equals(Object obj) {
146:                PropsRmsManagedConnectionFactory other = (PropsRmsManagedConnectionFactory) obj;
147:                return equals(propertiesDirUrl, other.propertiesDirUrl)
148:                        && equals(usersPropertiesFile,
149:                                other.usersPropertiesFile)
150:                        && equals(groupsPropertiesFile,
151:                                other.groupsPropertiesFile)
152:                        && equals(rolesPropertiesFile,
153:                                other.rolesPropertiesFile);
154:            }
155:
156:            /* (non-Javadoc)
157:             * @see java.lang.Object#hashCode()
158:             */
159:            public int hashCode() {
160:                return propertiesDirUrl.hashCode();
161:            }
162:
163:            /**
164:             * @return Returns the propertiesDirUrl.
165:             */
166:            public String getPropertiesDirUrl() {
167:                return propertiesDirUrl;
168:            }
169:
170:            /**
171:             * @param propertiesDirUrl The propertiesDirUrl to set.
172:             */
173:            public void setPropertiesDirUrl(String propertiesDirUrl) {
174:                this .propertiesDirUrl = propertiesDirUrl;
175:            }
176:
177:            /**
178:             * @return Returns the userPropertiesFile.
179:             */
180:            public String getUsersPropertiesFile() {
181:                return usersPropertiesFile;
182:            }
183:
184:            /**
185:             * @param userPropertiesFile The userPropertiesFile to set.
186:             */
187:            public void setUsersPropertiesFile(String userPropertiesFile) {
188:                this .usersPropertiesFile = userPropertiesFile;
189:            }
190:
191:            /**
192:             * @return Returns the groupsPropertiesFile.
193:             */
194:            public String getGroupsPropertiesFile() {
195:                return groupsPropertiesFile;
196:            }
197:
198:            /**
199:             * @param groupsPropertiesFile The groupsPropertiesFile to set.
200:             */
201:            public void setGroupsPropertiesFile(String groupsPropertiesFile) {
202:                this .groupsPropertiesFile = groupsPropertiesFile;
203:            }
204:
205:            /**
206:             * @return Returns the rolesPropertiesFile.
207:             */
208:            public String getRolesPropertiesFile() {
209:                return rolesPropertiesFile;
210:            }
211:
212:            /**
213:             * @param rolesPropertiesFile The rolesPropertiesFile to set.
214:             */
215:            public void setRolesPropertiesFile(String rolesPropertiesFile) {
216:                this.rolesPropertiesFile = rolesPropertiesFile;
217:            }
218:
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.