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: LdapRmsManagedConnectionFactory.java,v 1.4.4.1 2007/11/05 20:14:12 mlipp Exp $
021: *
022: * $Log: LdapRmsManagedConnectionFactory.java,v $
023: * Revision 1.4.4.1 2007/11/05 20:14:12 mlipp
024: * Added authentication properties.
025: *
026: * Revision 1.4 2007/09/02 22:19:53 mlipp
027: * Made LDAP EIS RA realy work.
028: *
029: * Revision 1.3 2007/05/17 21:52:59 mlipp
030: * Refactored resource adaptors.
031: *
032: * Revision 1.2 2006/09/29 12:32:07 drmlipp
033: * Consistently using WfMOpen as projct name now.
034: *
035: * Revision 1.1 2006/09/24 20:57:16 mlipp
036: * Moved RMS implementations in own sub-package.
037: *
038: * Revision 1.1 2006/07/11 09:00:31 drmlipp
039: * Started LDAP RMS RA.
040: *
041: */
042: package de.danet.an.workflow.rmsimpls.ldaprmsra;
043:
044: import java.io.Serializable;
045: import java.util.HashMap;
046: import java.util.Map;
047:
048: import javax.resource.ResourceException;
049: import javax.resource.spi.ConnectionManager;
050: import javax.resource.spi.ConnectionRequestInfo;
051: import javax.resource.spi.ManagedConnection;
052: import javax.resource.spi.ManagedConnectionMetaData;
053: import javax.security.auth.Subject;
054:
055: import de.danet.an.util.ra.ManagedConnectionFactorySupport;
056: import de.danet.an.workflow.rmsimpls.eisrms.aci.RmsEntry;
057:
058: /**
059: * The managed connection factory of the resource adapter for the properties
060: * files based RMS.
061: * @author Michael Lipp
062: */
063: public class LdapRmsManagedConnectionFactory extends
064: ManagedConnectionFactorySupport implements Serializable {
065:
066: private String javaNamingFactoryInitial = null;
067: private String javaNamingSecurityAuthentication = null;
068: private String javaNamingProviderUrl = null;
069: private String javaNamingSecurityPrincipal = null;
070: private String javaNamingSecurityCredentials = null;
071:
072: private String userCtxDN = null;
073: private String userFilter = null;
074: private String userSearchAttribute = null;
075: private String userResourceNameAttribute = null;
076: private String userMemberKeyAttribute = null;
077: private String groupCtxDN = null;
078: private String groupFilter = null;
079: private String groupSearchAttribute = null;
080: private String groupResourceNameAttribute = null;
081: private String groupMemberAttribute = null;
082: private String roleCtxDN = null;
083: private String roleFilter = null;
084: private String roleSearchAttribute = null;
085: private String roleResourceNameAttribute = null;
086: private String roleMemberAttribute = null;
087:
088: private Map queryInfos = null;
089:
090: /* (non-Javadoc)
091: * @see javax.resource.spi.ManagedConnectionFactory#createConnectionFactory
092: */
093: public Object createConnectionFactory(
094: ConnectionManager connectionManager)
095: throws ResourceException {
096: return new LdapRmsConnectionFactory(this , connectionManager);
097: }
098:
099: /* (non-Javadoc)
100: * @see javax.resource.spi.ManagedConnectionFactory#createManagedConnection
101: */
102: public ManagedConnection createManagedConnection(Subject subject,
103: ConnectionRequestInfo requestInfo) throws ResourceException {
104: if (queryInfos == null) {
105: queryInfos = new HashMap();
106: queryInfos.put(new Integer(RmsEntry.RESOURCE_TYPE_USER),
107: new QueryInfos(RmsEntry.RESOURCE_TYPE_USER,
108: userCtxDN, userFilter, userSearchAttribute,
109: userResourceNameAttribute,
110: userMemberKeyAttribute));
111: queryInfos.put(new Integer(RmsEntry.RESOURCE_TYPE_GROUP),
112: new QueryInfos(RmsEntry.RESOURCE_TYPE_GROUP,
113: groupCtxDN, groupFilter,
114: groupSearchAttribute,
115: groupResourceNameAttribute,
116: groupMemberAttribute));
117: queryInfos.put(new Integer(RmsEntry.RESOURCE_TYPE_ROLE),
118: new QueryInfos(RmsEntry.RESOURCE_TYPE_ROLE,
119: roleCtxDN, roleFilter, roleSearchAttribute,
120: roleResourceNameAttribute,
121: roleMemberAttribute));
122: }
123: return new LdapRmsManagedConnection(this , subject);
124: }
125:
126: /**
127: * @return Returns the queryInfos.
128: */
129: public QueryInfos getQueryInfos(int resType) {
130: return (QueryInfos) queryInfos.get(new Integer(resType));
131: }
132:
133: /* (non-Javadoc)
134: * Comment copied from interface or superclass.
135: */
136: public ManagedConnectionMetaData createMetaData(String user) {
137: return new LdapRmsManagedConnectionMetaData(user);
138: }
139:
140: /**
141: * @return Returns the javaNamingFactoryInitial.
142: */
143: public String getJavaNamingFactoryInitial() {
144: return javaNamingFactoryInitial;
145: }
146:
147: /**
148: * @param javaNamingFactoryInitial The javaNamingFactoryInitial to set.
149: */
150: public void setJavaNamingFactoryInitial(
151: String javaNamingFactoryInitial) {
152: this .javaNamingFactoryInitial = javaNamingFactoryInitial;
153: }
154:
155: /**
156: * @return Returns the javaNamingSecurityAuthentication.
157: */
158: public String getJavaNamingSecurityAuthentication() {
159: return javaNamingSecurityAuthentication;
160: }
161:
162: /**
163: * @param javaNamingSecurityAuthentication
164: * The javaNamingSecurityAuthentication to set.
165: */
166: public void setJavaNamingSecurityAuthentication(
167: String javaNamingSecurityAuthentication) {
168: this .javaNamingSecurityAuthentication = javaNamingSecurityAuthentication;
169: }
170:
171: /**
172: * @return Returns the javaNamingProviderUrl.
173: */
174: public String getJavaNamingProviderUrl() {
175: return javaNamingProviderUrl;
176: }
177:
178: /**
179: * @param javaNamingProviderUrl The javaNamingProviderUrl to set.
180: */
181: public void setJavaNamingProviderUrl(String javaNamingProviderUrl) {
182: this .javaNamingProviderUrl = javaNamingProviderUrl;
183: }
184:
185: /**
186: * @return Returns the javaNamingSecurityPrincipal.
187: */
188: public String getJavaNamingSecurityPrincipal() {
189: return javaNamingSecurityPrincipal;
190: }
191:
192: /**
193: * @param javaNamingSecurityPrincipal
194: * The javaNamingSecurityPrincipal to set.
195: */
196: public void setJavaNamingSecurityPrincipal(
197: String javaNamingSecurityPrincipal) {
198: this .javaNamingSecurityPrincipal = javaNamingSecurityPrincipal;
199: }
200:
201: /**
202: * @return Returns the javaNamingSecurityCredentials.
203: */
204: public String getJavaNamingSecurityCredentials() {
205: return javaNamingSecurityCredentials;
206: }
207:
208: /**
209: * @param javaNamingSecurityCredentials The javaNamingSecurityCredentials
210: * to set.
211: */
212: public void setJavaNamingSecurityCredentials(
213: String javaNamingSecurityCredentials) {
214: this .javaNamingSecurityCredentials = javaNamingSecurityCredentials;
215: }
216:
217: /**
218: * @return Returns the userCtxDN.
219: */
220: public String getUserCtxDN() {
221: return userCtxDN;
222: }
223:
224: /**
225: * @param userCtxDN The userCtxDN to set.
226: */
227: public void setUserCtxDN(String userCtxDN) {
228: this .userCtxDN = userCtxDN;
229: }
230:
231: /**
232: * @return Returns the userFilter.
233: */
234: public String getUserFilter() {
235: return userFilter;
236: }
237:
238: /**
239: * @param userFilter The userFilter to set.
240: */
241: public void setUserFilter(String userFilter) {
242: this .userFilter = userFilter;
243: }
244:
245: /**
246: * @return Returns the userSearchAttribute.
247: */
248: public String getUserSearchAttribute() {
249: return userSearchAttribute;
250: }
251:
252: /**
253: * @param userSearchAttribute The userSearchAttribute to set.
254: */
255: public void setUserSearchAttribute(String userSearchAttribute) {
256: this .userSearchAttribute = userSearchAttribute;
257: }
258:
259: /**
260: * @return Returns the userResourceNameAttribute.
261: */
262: public String getUserResourceNameAttribute() {
263: return userResourceNameAttribute;
264: }
265:
266: /**
267: * @param userResourceNameAttribute The userResourceNameAttribute to set.
268: */
269: public void setUserResourceNameAttribute(
270: String userResourceNameAttribute) {
271: this .userResourceNameAttribute = userResourceNameAttribute;
272: }
273:
274: /**
275: * @return Returns the userMemberKeyAttribute.
276: */
277: public String getUserMemberKeyAttribute() {
278: return userMemberKeyAttribute;
279: }
280:
281: /**
282: * @param userMemberKeyAttribute The userMemberKeyAttribute to set.
283: */
284: public void setUserMemberKeyAttribute(String userMemberKeyAttribute) {
285: this .userMemberKeyAttribute = userMemberKeyAttribute;
286: }
287:
288: /**
289: * @return Returns the groupCtxDN.
290: */
291: public String getGroupCtxDN() {
292: return groupCtxDN;
293: }
294:
295: /**
296: * @param groupCtxDN The groupCtxDN to set.
297: */
298: public void setGroupCtxDN(String groupCtxDN) {
299: this .groupCtxDN = groupCtxDN;
300: }
301:
302: /**
303: * @return Returns the groupFilter.
304: */
305: public String getGroupFilter() {
306: return groupFilter;
307: }
308:
309: /**
310: * @param groupFilter The groupFilter to set.
311: */
312: public void setGroupFilter(String groupFilter) {
313: this .groupFilter = groupFilter;
314: }
315:
316: /**
317: * @return Returns the groupSearchAttribute.
318: */
319: public String getGroupSearchAttribute() {
320: return groupSearchAttribute;
321: }
322:
323: /**
324: * @param groupSearchAttribute The groupSearchAttribute to set.
325: */
326: public void setGroupSearchAttribute(String groupSearchAttribute) {
327: this .groupSearchAttribute = groupSearchAttribute;
328: }
329:
330: /**
331: * @return Returns the groupResourceNameAttribute.
332: */
333: public String getGroupResourceNameAttribute() {
334: return groupResourceNameAttribute;
335: }
336:
337: /**
338: * @param groupResourceNameAttribute The groupResourceNameAttribute to set.
339: */
340: public void setGroupResourceNameAttribute(
341: String groupResourceNameAttribute) {
342: this .groupResourceNameAttribute = groupResourceNameAttribute;
343: }
344:
345: /**
346: * @return Returns the groupMemberAttribute.
347: */
348: public String getGroupMemberAttribute() {
349: return groupMemberAttribute;
350: }
351:
352: /**
353: * @param groupMemberAttribute The groupMemberAttribute to set.
354: */
355: public void setGroupMemberAttribute(String groupMemberAttribute) {
356: this .groupMemberAttribute = groupMemberAttribute;
357: }
358:
359: /**
360: * @return Returns the roleCtxDN.
361: */
362: public String getRoleCtxDN() {
363: return roleCtxDN;
364: }
365:
366: /**
367: * @param roleCtxDN The roleCtxDN to set.
368: */
369: public void setRoleCtxDN(String roleCtxDN) {
370: this .roleCtxDN = roleCtxDN;
371: }
372:
373: /**
374: * @return Returns the roleFilter.
375: */
376: public String getRoleFilter() {
377: return roleFilter;
378: }
379:
380: /**
381: * @param roleFilter The roleFilter to set.
382: */
383: public void setRoleFilter(String roleFilter) {
384: this .roleFilter = roleFilter;
385: }
386:
387: /**
388: * @return Returns the roleSearchAttribute.
389: */
390: public String getRoleSearchAttribute() {
391: return roleSearchAttribute;
392: }
393:
394: /**
395: * @param roleSearchAttribute The roleSearchAttribute to set.
396: */
397: public void setRoleSearchAttribute(String roleSearchAttribute) {
398: this .roleSearchAttribute = roleSearchAttribute;
399: }
400:
401: /**
402: * @return Returns the roleResourceNameAttribute.
403: */
404: public String getRoleResourceNameAttribute() {
405: return roleResourceNameAttribute;
406: }
407:
408: /**
409: * @param roleResourceNameAttribute The roleResourceNameAttribute to set.
410: */
411: public void setRoleResourceNameAttribute(
412: String roleResourceNameAttribute) {
413: this .roleResourceNameAttribute = roleResourceNameAttribute;
414: }
415:
416: /**
417: * @return Returns the roleMemberAttribute.
418: */
419: public String getRoleMemberAttribute() {
420: return roleMemberAttribute;
421: }
422:
423: /**
424: * @param roleMemberAttribute The roleMemberAttribute to set.
425: */
426: public void setRoleMemberAttribute(String roleMemberAttribute) {
427: this.roleMemberAttribute = roleMemberAttribute;
428: }
429: }
|