001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.geronimo.connector.deployment.dconfigbean; 019 020 import javax.enterprise.deploy.model.DDBean; 021 022 import org.apache.geronimo.deployment.plugin.DConfigBeanSupport; 023 import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType; 024 import org.apache.xmlbeans.SchemaTypeLoader; 025 026 /** 027 * 028 * 029 * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $ 030 * 031 * */ 032 public class ConfigPropertySettingDConfigBean extends DConfigBeanSupport { 033 034 public ConfigPropertySettingDConfigBean(DDBean ddBean, GerConfigPropertySettingType configPropertySetting) { 035 super(ddBean, configPropertySetting); 036 String name = ddBean.getText("config-property-name")[0]; 037 if (configPropertySetting.getName() == null) { 038 configPropertySetting.setName(name); 039 String[] values = ddBean.getText("config-property-value"); 040 if (values != null && values.length == 1) { 041 configPropertySetting.setStringValue(values[0]); 042 } 043 } else { 044 assert name.equals(configPropertySetting.getName()); 045 } 046 } 047 048 GerConfigPropertySettingType getConfigPropertySetting() { 049 return (GerConfigPropertySettingType) getXmlObject(); 050 } 051 052 public String getConfigPropertyName() { 053 return getConfigPropertySetting().getName(); 054 } 055 056 //TODO this needs research about if it works. 057 public String getConfigPropertyType() { 058 return getDDBean().getText("config-property/config-property-type")[0]; 059 } 060 061 public String getConfigPropertyValue() { 062 return getConfigPropertySetting().getStringValue(); 063 } 064 065 public void setConfigPropertyValue(String configPropertyValue) { 066 getConfigPropertySetting().setStringValue(configPropertyValue); 067 } 068 069 protected SchemaTypeLoader getSchemaTypeLoader() { 070 return ResourceAdapterDConfigRoot.SCHEMA_TYPE_LOADER; 071 } 072 073 } 074