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.dconfigbean;
17:
18: import javax.enterprise.deploy.model.DDBean;
19:
20: import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
21: import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
22: import org.apache.xmlbeans.SchemaTypeLoader;
23:
24: /**
25: *
26: *
27: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
28: *
29: * */
30: public class ConfigPropertySettingDConfigBean extends
31: DConfigBeanSupport {
32:
33: public ConfigPropertySettingDConfigBean(DDBean ddBean,
34: GerConfigPropertySettingType configPropertySetting) {
35: super (ddBean, configPropertySetting);
36: String name = ddBean.getText("config-property-name")[0];
37: if (configPropertySetting.getName() == null) {
38: configPropertySetting.setName(name);
39: String[] values = ddBean.getText("config-property-value");
40: if (values != null && values.length == 1) {
41: configPropertySetting.setStringValue(values[0]);
42: }
43: } else {
44: assert name.equals(configPropertySetting.getName());
45: }
46: }
47:
48: GerConfigPropertySettingType getConfigPropertySetting() {
49: return (GerConfigPropertySettingType) getXmlObject();
50: }
51:
52: public String getConfigPropertyName() {
53: return getConfigPropertySetting().getName();
54: }
55:
56: //TODO this needs research about if it works.
57: public String getConfigPropertyType() {
58: return getDDBean().getText(
59: "config-property/config-property-type")[0];
60: }
61:
62: public String getConfigPropertyValue() {
63: return getConfigPropertySetting().getStringValue();
64: }
65:
66: public void setConfigPropertyValue(String configPropertyValue) {
67: getConfigPropertySetting().setStringValue(configPropertyValue);
68: }
69:
70: protected SchemaTypeLoader getSchemaTypeLoader() {
71: return ResourceAdapterDConfigRoot.SCHEMA_TYPE_LOADER;
72: }
73:
74: }
|