1 22 package x; 23 24 import a.b.C1; import a.b.C2; 27 import a.b.C3; 28 29 import a.b.*; 32 34 56 public class X 57 extends Y 58 implements Z 59 { 60 62 64 66 68 70 public void startService() throws Exception 71 { 73 Class cls = Class.forName(dataSourceClass); 74 vendorSource = (XADataSource)cls.newInstance(); 75 76 cls = vendorSource.getClass(); 78 79 if(properties != null && properties.length() > 0) 80 { 81 82 try 83 { 84 } 85 catch (IOException ioe) 86 { 87 } 88 for (Iterator i = props.entrySet().iterator(); i.hasNext();) 89 { 90 91 Map.Entry entry = (Map.Entry) i.next(); 93 String attributeName = (String ) entry.getKey(); 94 String attributeValue = (String ) entry.getValue(); 95 96 log.debug("Setting attribute '" + attributeName + "' to '" + 98 attributeValue + "'"); 99 100 Method setAttribute = 102 cls.getMethod("set" + attributeName, 103 new Class [] { String .class }); 104 105 setAttribute.invoke(vendorSource, 107 new Object [] { attributeValue }); 108 } 109 } 110 111 vendorSource.getXAConnection().close(); 113 114 bind(new InitialContext(), "java:/"+getPoolName(), 116 new Reference(vendorSource.getClass().getName(), 117 getClass().getName(), null)); 118 } 119 120 122 124 126 128 130 } 132 | Popular Tags |