1 17 18 package org.apache.geronimo.connector.deployment; 19 20 import javax.enterprise.deploy.model.DeployableObject ; 21 import javax.enterprise.deploy.shared.ModuleType ; 22 import javax.enterprise.deploy.spi.DeploymentConfiguration ; 23 24 import org.apache.geronimo.connector.deployment.dconfigbean.ResourceAdapterDConfigRoot; 25 import org.apache.geronimo.connector.deployment.dconfigbean.ResourceAdapter_1_0DConfigRoot; 26 import org.apache.geronimo.connector.deployment.jsr88.Connector15DCBRoot; 27 import org.apache.geronimo.deployment.ModuleConfigurer; 28 import org.apache.geronimo.gbean.GBeanInfo; 29 import org.apache.geronimo.gbean.GBeanInfoBuilder; 30 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 31 32 37 public class RARConfigurer implements ModuleConfigurer { 38 39 public DeploymentConfiguration createConfiguration(DeployableObject deployable) { 40 if (ModuleType.RAR.equals(deployable.getType())) { 41 String ddBeanRootVersion = deployable.getDDBeanRoot().getDDBeanRootVersion(); 42 if (ddBeanRootVersion != null && ddBeanRootVersion.equals("1.5")) { 43 return new RARConfiguration(deployable, new Connector15DCBRoot(deployable.getDDBeanRoot())); 44 } 45 String [] specVersion = deployable.getDDBeanRoot().getText("connector/spec-version"); 46 if (specVersion.length > 0 && "1.0".equals(specVersion[0])) { 47 return new RARConfiguration(deployable, new ResourceAdapter_1_0DConfigRoot(deployable.getDDBeanRoot())); 48 } 49 throw new IllegalArgumentException ("Unknown resource adapter version: " + deployable.getDDBeanRoot().getDDBeanRootVersion()); 50 } else { 51 return null; 52 } 53 } 54 55 public static final GBeanInfo GBEAN_INFO; 56 57 static { 58 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(RARConfigurer.class, NameFactory.DEPLOYMENT_CONFIGURER); 59 infoFactory.addInterface(ModuleConfigurer.class); 60 GBEAN_INFO = infoFactory.getBeanInfo(); 61 } 62 63 public static GBeanInfo getGBeanInfo() { 64 return GBEAN_INFO; 65 } 66 } 67 | Popular Tags |