KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > connector > deployment > dconfigbean > ConfigPropertySettingDConfigBean


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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  */

17
18 package org.apache.geronimo.connector.deployment.dconfigbean;
19
20 import javax.enterprise.deploy.model.DDBean JavaDoc;
21
22 import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
23 import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
24 import org.apache.xmlbeans.SchemaTypeLoader;
25
26 /**
27  *
28  *
29  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
30  *
31  * */

32 public class ConfigPropertySettingDConfigBean extends DConfigBeanSupport {
33
34     public ConfigPropertySettingDConfigBean(DDBean JavaDoc ddBean, GerConfigPropertySettingType configPropertySetting) {
35         super(ddBean, configPropertySetting);
36         String JavaDoc name = ddBean.getText("config-property-name")[0];
37         if (configPropertySetting.getName() == null) {
38             configPropertySetting.setName(name);
39             String JavaDoc[] 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 JavaDoc getConfigPropertyName() {
53         return getConfigPropertySetting().getName();
54     }
55
56     //TODO this needs research about if it works.
57
public String JavaDoc getConfigPropertyType() {
58         return getDDBean().getText("config-property/config-property-type")[0];
59     }
60
61     public String JavaDoc getConfigPropertyValue() {
62         return getConfigPropertySetting().getStringValue();
63     }
64
65     public void setConfigPropertyValue(String JavaDoc configPropertyValue) {
66         getConfigPropertySetting().setStringValue(configPropertyValue);
67     }
68
69     protected SchemaTypeLoader getSchemaTypeLoader() {
70         return ResourceAdapterDConfigRoot.SCHEMA_TYPE_LOADER;
71     }
72
73 }
74
75
Popular Tags