01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.connector.deployment;
17:
18: import javax.enterprise.deploy.model.DeployableObject;
19: import javax.enterprise.deploy.shared.ModuleType;
20: import javax.enterprise.deploy.spi.DeploymentConfiguration;
21:
22: import org.apache.geronimo.connector.deployment.dconfigbean.ResourceAdapterDConfigRoot;
23: import org.apache.geronimo.connector.deployment.dconfigbean.ResourceAdapter_1_0DConfigRoot;
24: import org.apache.geronimo.connector.deployment.jsr88.Connector15DCBRoot;
25: import org.apache.geronimo.deployment.ModuleConfigurer;
26: import org.apache.geronimo.gbean.GBeanInfo;
27: import org.apache.geronimo.gbean.GBeanInfoBuilder;
28: import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
29:
30: /**
31: *
32: *
33: * @version $Rev: 493181 $ $Date: 2007-01-05 12:32:03 -0800 (Fri, 05 Jan 2007) $
34: */
35: public class RARConfigurer implements ModuleConfigurer {
36:
37: public DeploymentConfiguration createConfiguration(
38: DeployableObject deployable) {
39: if (ModuleType.RAR.equals(deployable.getType())) {
40: String ddBeanRootVersion = deployable.getDDBeanRoot()
41: .getDDBeanRootVersion();
42: if (ddBeanRootVersion != null
43: && ddBeanRootVersion.equals("1.5")) {
44: return new RARConfiguration(deployable,
45: new Connector15DCBRoot(deployable
46: .getDDBeanRoot()));
47: }
48: String[] specVersion = deployable.getDDBeanRoot().getText(
49: "connector/spec-version");
50: if (specVersion.length > 0 && "1.0".equals(specVersion[0])) {
51: return new RARConfiguration(deployable,
52: new ResourceAdapter_1_0DConfigRoot(deployable
53: .getDDBeanRoot()));
54: }
55: throw new IllegalArgumentException(
56: "Unknown resource adapter version: "
57: + deployable.getDDBeanRoot()
58: .getDDBeanRootVersion());
59: } else {
60: return null;
61: }
62: }
63:
64: public ModuleType getModuleType() {
65: return ModuleType.RAR;
66: }
67:
68: public static final GBeanInfo GBEAN_INFO;
69:
70: static {
71: GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(
72: RARConfigurer.class, NameFactory.DEPLOYMENT_CONFIGURER);
73: infoFactory.addInterface(ModuleConfigurer.class);
74: GBEAN_INFO = infoFactory.getBeanInfo();
75: }
76:
77: public static GBeanInfo getGBeanInfo() {
78: return GBEAN_INFO;
79: }
80: }
|