You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/10/20 20:23:42 UTC
svn commit: r706357 [7/13] - in
/geronimo/server/trunk/plugins/connector-1_6: ./ client-transaction-1_6/
client-transaction-1_6/src/ client-transaction-1_6/src/main/
client-transaction-1_6/src/main/history/
client-transaction-1_6/src/main/plan/ client-...
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionInstanceBeanInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionInstanceBeanInfo.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionInstanceBeanInfo.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionInstanceBeanInfo.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,159 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.dconfigbean;
+
+import java.beans.*;
+import java.awt.*;
+
+/**
+ * @version $Revision: 1.0$
+ */
+public class ConnectionDefinitionInstanceBeanInfo implements BeanInfo {
+ /**
+ * A bean may have a "default" event that is the event that will
+ * mostly commonly be used by humans when using the bean.
+ *
+ * @return Index of default event in the EventSetDescriptor array
+ * returned by getEventSetDescriptors.
+ * <P> Returns -1 if there is no default event.
+ */
+ public int getDefaultEventIndex() {
+ return -1;
+ }
+
+ /**
+ * A bean may have a "default" property that is the property that will
+ * mostly commonly be initially chosen for update by human's who are
+ * customizing the bean.
+ *
+ * @return Index of default property in the PropertyDescriptor array
+ * returned by getPropertyDescriptors.
+ * <P> Returns -1 if there is no default property.
+ */
+ public int getDefaultPropertyIndex() {
+ return -1;
+ }
+
+ /**
+ * This method returns an image object that can be used to
+ * represent the bean in toolboxes, toolbars, etc. Icon images
+ * will typically be GIFs, but may in future include other formats.
+ * <p/>
+ * Beans aren't required to provide icons and may return null from
+ * this method.
+ * <p/>
+ * There are four possible flavors of icons (16x16 color,
+ * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
+ * support a single icon we recommend supporting 16x16 color.
+ * <p/>
+ * We recommend that icons have a "transparent" background
+ * so they can be rendered onto an existing background.
+ *
+ * @param iconKind The kind of icon requested. This should be
+ * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
+ * ICON_MONO_16x16, or ICON_MONO_32x32.
+ * @return An image object representing the requested icon. May
+ * return null if no suitable icon is available.
+ */
+ public Image getIcon(int iconKind) {
+ return null;
+ }
+
+ /**
+ * Gets the beans <code>BeanDescriptor</code>.
+ *
+ * @return A BeanDescriptor providing overall information about
+ * the bean, such as its displayName, its customizer, etc. May
+ * return null if the information should be obtained by automatic
+ * analysis.
+ */
+ public BeanDescriptor getBeanDescriptor() {
+ BeanDescriptor bd = new BeanDescriptor(ConnectionDefinitionInstance.class);
+ bd.setDisplayName("Geronimo Connection Configurations");
+ bd.setShortDescription("The Resource Adapter defines what type of connections may be made (e.g. to a database, or to JMS). These entries configure a specific connection instance (to a specific database or JMS server). This is done primarily by setting appropriate config properties.");
+ return bd;
+ }
+
+ /**
+ * This method allows a BeanInfo object to return an arbitrary collection
+ * of other BeanInfo objects that provide additional information on the
+ * current bean.
+ * <P>
+ * If there are conflicts or overlaps between the information provided
+ * by different BeanInfo objects, then the current BeanInfo takes precedence
+ * over the getAdditionalBeanInfo objects, and later elements in the array
+ * take precedence over earlier ones.
+ *
+ * @return an array of BeanInfo objects. May return null.
+ */
+ public BeanInfo[] getAdditionalBeanInfo() {
+ return null;
+ }
+
+ /**
+ * Gets the beans <code>EventSetDescriptor</code>s.
+ *
+ * @return An array of EventSetDescriptors describing the kinds of
+ * events fired by this bean. May return null if the information
+ * should be obtained by automatic analysis.
+ */
+ public EventSetDescriptor[] getEventSetDescriptors() {
+ return null;
+ }
+
+ /**
+ * Gets the beans <code>MethodDescriptor</code>s.
+ *
+ * @return An array of MethodDescriptors describing the externally
+ * visible methods supported by this bean. May return null if
+ * the information should be obtained by automatic analysis.
+ */
+ public MethodDescriptor[] getMethodDescriptors() {
+ return new MethodDescriptor[0];
+ }
+
+ /**
+ * Gets the beans <code>PropertyDescriptor</code>s.
+ *
+ * @return An array of PropertyDescriptors describing the editable
+ * properties supported by this bean. May return null if the
+ * information should be obtained by automatic analysis.
+ * <p/>
+ * If a property is indexed, then its entry in the result array will
+ * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
+ * A client of getPropertyDescriptors can use "instanceof" to check
+ * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
+ */
+ public PropertyDescriptor[] getPropertyDescriptors() {
+ try {
+ PropertyDescriptor name = new PropertyDescriptor("name", ConnectionDefinitionInstance.class);
+ name.setDisplayName("Connection Name");
+ name.setShortDescription("A name that identifies this connection. It will be used by application resource references to map to this connection.");
+ PropertyDescriptor jndiName = new PropertyDescriptor("globalJNDIName", ConnectionDefinitionInstance.class);
+ jndiName.setDisplayName("Global JNDI Name");
+ jndiName.setShortDescription("Where to register this connection in the global JNDI tree. This is only necessary for non-J2EE application clients; it is not used for nornal resource references.");
+ PropertyDescriptor configs = new PropertyDescriptor("configProperty", ConnectionDefinitionInstance.class, "getConfigProperty", null);
+ configs.setDisplayName("Configuration Properties");
+ configs.setShortDescription("The configuration properties that point this connection instance to a particular destination (database, JMS server, etc.).");
+ return new PropertyDescriptor[]{
+ name, jndiName, configs
+ };
+ } catch (IntrospectionException e) {
+ throw new RuntimeException("Unable to configure bean properties", e);
+ }
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionInstanceBeanInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionInstanceBeanInfo.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionInstanceBeanInfo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.connector.deployment.dconfigbean;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.enterprise.deploy.model.DDBean;
+import javax.enterprise.deploy.spi.DConfigBean;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+
+import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
+import org.apache.geronimo.xbeans.geronimo.GerOutboundResourceadapterType;
+import org.apache.geronimo.xbeans.geronimo.GerResourceadapterInstanceType;
+import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ *
+ * */
+public class ResourceAdapterDConfigBean extends DConfigBeanSupport {
+
+ private final static String[][] RESOURCE_ADAPTER_XPATHS = {
+ {"config-property"},
+ {"outbound-resourceadapter", "connection-definition"},
+ {"adminobject"}};
+ private Map configPropertiesMap = new HashMap();
+ private Map connectionDefinitionsMap = new HashMap();
+ private Map adminObjectsMap = new HashMap();
+
+ public ResourceAdapterDConfigBean(DDBean ddBean, final GerResourceadapterType resourceadapter) {
+ super(ddBean, resourceadapter);
+ if (getResourceadapterInstance() == null) {
+ resourceadapter.addNewResourceadapterInstance();
+ }
+ ConfigPropertiesHelper.initializeConfigSettings(ddBean, new ConfigPropertiesHelper.ConfigPropertiesSource() {
+ public GerConfigPropertySettingType[] getConfigPropertySettingArray() {
+ return getResourceadapterInstance().getConfigPropertySettingArray();
+ }
+
+ public GerConfigPropertySettingType addNewConfigPropertySetting() {
+ return getResourceadapterInstance().addNewConfigPropertySetting();
+ }
+
+ public void removeConfigPropertySetting(int j) {
+ }
+
+ public ConfigPropertySettings[] getConfigPropertySettings() {
+ return new ConfigPropertySettings[0];
+ }
+
+ public void setConfigPropertySettings(ConfigPropertySettings[] configs) {
+ }
+
+ }, configPropertiesMap, "config-property", "config-property-name");
+ //initialize connection definitions
+ GerOutboundResourceadapterType outboundResourceadapter = resourceadapter.getOutboundResourceadapter();
+ if (outboundResourceadapter == null) {
+ outboundResourceadapter = resourceadapter.addNewOutboundResourceadapter();
+ }
+ DDBean[] connectionDefinitionDDBeans = ddBean.getChildBean(getXpaths()[1]);
+ GerConnectionDefinitionType[] connectionDefinitions = outboundResourceadapter.getConnectionDefinitionArray();
+
+ if (connectionDefinitions.length == 0) {
+ //we are new
+ for (int i = 0; i < connectionDefinitionDDBeans.length; i++) {
+ DDBean connectionDefinitionDdBean = connectionDefinitionDDBeans[i];
+ GerConnectionDefinitionType connectionDefinition = outboundResourceadapter.addNewConnectionDefinition();
+ String connectionfactoryInterface = connectionDefinitionDdBean.getText("connectionfactory-interface")[0];
+ ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(connectionDefinitionDdBean, connectionDefinition);
+ connectionDefinitionsMap.put(connectionfactoryInterface, connectionDefinitionDConfigBean);
+ }
+ } else {
+ //we are read in from xml. Check correct length
+ assert connectionDefinitionDDBeans.length == connectionDefinitions.length;
+ for (int i = 0; i < connectionDefinitionDDBeans.length; i++) {
+ DDBean connectionDefinitionDdBean = connectionDefinitionDDBeans[i];
+ GerConnectionDefinitionType connectionDefinition = connectionDefinitions[i];
+ String connectionfactoryInterface = connectionDefinitionDdBean.getText("connectionfactory-interface")[0];
+ assert connectionfactoryInterface.equals(connectionDefinition.getConnectionfactoryInterface());
+ ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(connectionDefinitionDdBean, connectionDefinition);
+ connectionDefinitionsMap.put(connectionfactoryInterface, connectionDefinitionDConfigBean);
+ }
+ }
+
+ //admin objects
+// DDBean[] adminObjecDdBeans = ddBean.getChildBean(getXpaths()[2]);
+// GerAdminobjectType[] adminobjectTypes = getResourceadapter().getAdminobjectArray();
+//
+// if (adminobjectTypes.length == 0) {
+// //we are new
+// for (int i = 0; i < adminObjecDdBeans.length; i++) {
+// DDBean adminObjectDdBean = adminObjecDdBeans[i];
+// GerAdminobjectType adminobjectType = getResourceadapter().addNewAdminobject();
+// String adminObjectInterface = adminObjectDdBean.getText("adminobject-interface")[0];
+// String adminObjectClass = adminObjectDdBean.getText("adminobject-class")[0];
+// AdminObjectDConfigBean adminObjectDConfigBean = new AdminObjectDConfigBean(adminObjectDdBean, adminobjectType);
+// adminObjectsMap.put(new Key(adminObjectInterface, adminObjectClass), adminObjectDConfigBean);
+// }
+// } else {
+// //we are read in from xml. Check correct length
+// assert adminObjecDdBeans.length == adminobjectTypes.length;
+// for (int i = 0; i < adminObjecDdBeans.length; i++) {
+// DDBean adminObjectDdBean = adminObjecDdBeans[i];
+// GerAdminobjectType adminobjectType = adminobjectTypes[i];
+// String adminObjectInterface = adminObjectDdBean.getText("adminobject-interface")[0];
+// assert(adminObjectInterface.equals(adminobjectType.getAdminobjectInterface().getStringValue()));
+// String adminObjectClass = adminObjectDdBean.getText("adminobject-class")[0];
+// assert(adminObjectClass.equals(adminobjectType.getAdminobjectClass().getStringValue()));
+// AdminObjectDConfigBean adminObjectDConfigBean = new AdminObjectDConfigBean(adminObjectDdBean, adminobjectType);
+// adminObjectsMap.put(new Key(adminObjectInterface, adminObjectClass), adminObjectDConfigBean);
+//
+// }
+// }
+
+ }
+
+ GerResourceadapterType getResourceadapter() {
+ return (GerResourceadapterType) getXmlObject();
+ }
+
+ private GerResourceadapterInstanceType getResourceadapterInstance() {
+ return getResourceadapter().getResourceadapterInstance();
+ }
+
+ public String getResourceAdapterName() {
+ return getResourceadapterInstance().getResourceadapterName();
+ }
+
+ public void setResourceAdapterName(String resourceAdapterName) {
+ getResourceadapterInstance().setResourceadapterName(resourceAdapterName);
+ }
+
+ public String getWorkManager() {
+ if(getResourceadapterInstance() == null || getResourceadapterInstance().getWorkmanager() == null) {
+ return null;
+ }
+ return getResourceadapterInstance().getWorkmanager().getGbeanLink();
+ }
+
+ public void setWorkManager(String workManager) {
+ if(getResourceadapterInstance() == null) {
+ getResourceadapter().addNewResourceadapterInstance();
+ }
+ if(getResourceadapterInstance().getWorkmanager() == null) {
+ getResourceadapterInstance().addNewWorkmanager();
+ }
+ getResourceadapterInstance().getWorkmanager().setGbeanLink(workManager);
+ }
+
+ public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
+ String xpath = bean.getXpath();
+ String[] xpaths = getXpaths();
+ if (xpath.equals(xpaths[0])) {
+ //resource adapter config property
+ String configPropertyName = bean.getText("config-property-name")[0];
+ ConfigPropertySettingDConfigBean configPropertySetting = (ConfigPropertySettingDConfigBean) configPropertiesMap.get(configPropertyName);
+ assert configPropertySetting != null;
+ return configPropertySetting;
+ }
+ if (xpath.equals(xpaths[1])) {
+ //connection definition
+ String connectionFactoryInterface = bean.getText("connectionfactory-interface")[0];
+ ConnectionDefinitionDConfigBean connectionDefinition = (ConnectionDefinitionDConfigBean) connectionDefinitionsMap.get(connectionFactoryInterface);
+ assert connectionDefinition != null;
+ return connectionDefinition;
+ }
+ if (xpath.equals(xpaths[2])) {
+ //admin objects
+ String adminObjectInterface = bean.getText("adminobject-interface")[0];
+ String adminObjectClass = bean.getText("adminobject-class")[0];
+ AdminObjectDConfigBean adminObject = (AdminObjectDConfigBean) adminObjectsMap.get(new Key(adminObjectInterface, adminObjectClass));
+ assert adminObject != null;
+ return adminObject;
+ }
+ return null;
+ }
+
+
+ public String[] getXpaths() {
+ return getXPathsForJ2ee_1_4(RESOURCE_ADAPTER_XPATHS);
+ }
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return ResourceAdapterDConfigRoot.SCHEMA_TYPE_LOADER;
+ }
+
+
+ //from doubleKeyedHashMap, currently in transaction module
+ private final static class Key {
+ private final Object part1;
+ private final Object part2;
+
+ public Key(Object part1, Object part2) {
+ this.part1 = part1;
+ this.part2 = part2;
+ }
+
+ public int hashCode() {
+ return part1.hashCode() ^ part2.hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof Key) {
+ Key other = (Key) obj;
+ return this.part1.equals(other.part1) && this.part2.equals(other.part2);
+ } else {
+ return false;
+ }
+ }
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.connector.deployment.dconfigbean;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.enterprise.deploy.model.DDBean;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.spi.DConfigBean;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+
+import org.apache.geronimo.deployment.plugin.DConfigBeanRootSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
+import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ *
+ * */
+public class ResourceAdapterDConfigRoot extends DConfigBeanRootSupport {
+ static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[] {
+ XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.j2ee.String.class.getClassLoader()),
+ XmlBeans.typeLoaderForClassLoader(GerConnectorDocument.class.getClassLoader())
+ });
+
+ private static String[][] XPATHS = {
+ {"connector", "resourceadapter"}
+ };
+
+ private ResourceAdapterDConfigBean resourceAdapterDConfigBean;
+
+ public ResourceAdapterDConfigRoot(DDBeanRoot ddBean) {
+ super(ddBean, loadDefaultData(ddBean));
+ replaceResourceAdapterDConfigBean(getConnectorDocument().getConnector().getResourceadapterArray()[0]);
+ }
+
+ private static XmlObject loadDefaultData(DDBeanRoot root) {
+ InputStream in = root.getDeployableObject().getEntry("META-INF/geronimo-ra.xml");
+ if(in == null) {
+ GerConnectorDocument doc = GerConnectorDocument.Factory.newInstance();
+ doc.addNewConnector().addNewResourceadapter();
+ return doc;
+ } else {
+ try {
+ XmlObject result = GerConnectorDocument.Factory.parse(in);
+ in.close();
+ return result;
+ } catch (XmlException e) {
+ throw new RuntimeException("Unable to load default Geronimo RA data", e);
+ } catch (IOException e) {
+ throw new RuntimeException("Unable to load default Geronimo RA data", e);
+ }
+ }
+ }
+
+ private void replaceResourceAdapterDConfigBean(GerResourceadapterType resourceAdapter) {
+ DDBean ddBean = getDDBean();
+ String path = getXpaths()[0];
+ System.out.println("********** Searching XPath "+path+" -- "+ddBean.getChildBean(path));
+ DDBean childDDBean = ddBean.getChildBean(path)[0];
+ resourceAdapterDConfigBean = new ResourceAdapterDConfigBean(childDDBean, resourceAdapter);
+ }
+
+ GerConnectorDocument getConnectorDocument() {
+ return (GerConnectorDocument) getXmlObject();
+ }
+
+ public String[] getXpaths() {
+ return getXPathsForJ2ee_1_4(XPATHS);
+ }
+
+ public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
+ if (getXpaths()[0].equals(bean.getXpath())) {
+ return resourceAdapterDConfigBean;
+ }
+ return null;
+ }
+
+ public void fromXML(InputStream inputStream) throws XmlException, IOException {
+ super.fromXML(inputStream);
+ //TODO this is so totally wrong...
+ replaceResourceAdapterDConfigBean(getConnectorDocument().getConnector().getResourceadapterArray()[0]);
+ }
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapter_1_0DConfigRoot.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapter_1_0DConfigRoot.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapter_1_0DConfigRoot.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapter_1_0DConfigRoot.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.connector.deployment.dconfigbean;
+
+import java.io.IOException;
+import java.io.InputStream;
+import javax.enterprise.deploy.model.DDBean;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.spi.DConfigBean;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+
+import org.apache.geronimo.deployment.plugin.DConfigBeanRootSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
+import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlException;
+
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ *
+ * */
+public class ResourceAdapter_1_0DConfigRoot extends DConfigBeanRootSupport {
+
+ private static String[] XPATHS = {
+ "connector/resourceadapter"
+ };
+
+ private ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean;
+
+ public ResourceAdapter_1_0DConfigRoot(DDBeanRoot ddBean) {
+ super(ddBean, GerConnectorDocument.Factory.newInstance());
+ GerConnectionDefinitionType connectionDefinition = getConnectorDocument().addNewConnector().addNewResourceadapter().addNewOutboundResourceadapter().addNewConnectionDefinition();
+ replaceConnectionDefinitionDConfigBean(connectionDefinition);
+ }
+
+ private void replaceConnectionDefinitionDConfigBean(GerConnectionDefinitionType connectionDefinition) {
+ DDBean ddBean = getDDBean();
+ DDBean childDDBean = ddBean.getChildBean(getXpaths()[0])[0];
+ connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(childDDBean, connectionDefinition);
+ }
+
+ GerConnectorDocument getConnectorDocument() {
+ return (GerConnectorDocument) getXmlObject();
+ }
+
+ public String[] getXpaths() {
+ return XPATHS;
+ }
+
+ public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
+ if (getXpaths()[0].equals(bean.getXpath())) {
+ return connectionDefinitionDConfigBean;
+ }
+ return null;
+ }
+
+ public void fromXML(InputStream inputStream) throws XmlException, IOException {
+ super.fromXML(inputStream);
+ //TODO this is so totally wrong...
+ replaceConnectionDefinitionDConfigBean(getConnectorDocument().getConnector().getResourceadapterArray()[0].getOutboundResourceadapter().getConnectionDefinitionArray(0));
+ }
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return ResourceAdapterDConfigRoot.SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapter_1_0DConfigRoot.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapter_1_0DConfigRoot.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapter_1_0DConfigRoot.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,116 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerAdminobjectType;
+import org.apache.geronimo.xbeans.geronimo.GerAdminobjectInstanceType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+import javax.enterprise.deploy.model.DDBean;
+
+/**
+ * Represents /connector/adminobject in a Geronimo Connector deployment plan.
+ * Corresponds to /connector/resourceadapter/adminobject in the J2EE deployment plan.
+ * Note that in an arbitrary Geronimo connector plan, there can be multiple
+ * adminobject entries per adminobject from the J2EE plan. When we load such
+ * a plan, we combine all the adminobject-instances from those adminobjects
+ * into a single Geronimo adminobject per J2EE adminobject, so if we write it
+ * out again it'll be a little different, but that way this can be a DConfigBean
+ * instead of a POJO (the loading code is in ConnectorDCB).
+ *
+ * @version $Rev$ $Date$
+ */
+public class AdminObjectDCB extends DConfigBeanSupport {
+ private AdminObjectInstance[] adminObjectInstance = new AdminObjectInstance[0];
+
+ public AdminObjectDCB(DDBean adminobjectDDBean, final GerAdminobjectType adminobject) {
+ super(adminobjectDDBean, adminobject);
+ //todo: listen for property changes on the admin object
+ configure(adminobjectDDBean, adminobject);
+ }
+
+ private void configure(DDBean adminDDBean, GerAdminobjectType adminXml) {
+ adminXml.setAdminobjectClass(adminDDBean.getText("adminobject-class")[0]);
+ adminXml.setAdminobjectInterface(adminDDBean.getText("adminobject-interface")[0]);
+ GerAdminobjectInstanceType[] xmls = adminXml.getAdminobjectInstanceArray();
+ adminObjectInstance = new AdminObjectInstance[xmls.length];
+ for (int i = 0; i < xmls.length; i++) {
+ adminObjectInstance[i] = new AdminObjectInstance(adminDDBean, xmls[i]);
+ }
+ }
+
+ GerAdminobjectType getAdminObject() {
+ return (GerAdminobjectType) getXmlObject();
+ }
+
+ void addAdminObjectInstance(GerAdminobjectInstanceType xml) {
+ AdminObjectInstance instance = new AdminObjectInstance(getDDBean(), xml);
+ AdminObjectInstance[] result = new AdminObjectInstance[adminObjectInstance.length+1];
+ System.arraycopy(adminObjectInstance, 0, result, 0, adminObjectInstance.length);
+ result[adminObjectInstance.length] = instance;
+ setAdminObjectInstance(result);
+ }
+
+ // ----------------------- JavaBean Properties for /adminobject ----------------------
+
+ public String getAdminObjectInterface() {
+ return getAdminObject().getAdminobjectInterface();
+ }
+
+ public String getAdminObjectClass() {
+ return getAdminObject().getAdminobjectClass();
+ }
+
+ public AdminObjectInstance[] getAdminObjectInstance() {
+ return adminObjectInstance;
+ }
+
+ public void setAdminObjectInstance(AdminObjectInstance[] adminObjectInstance) {
+ AdminObjectInstance[] old = getAdminObjectInstance();
+ //todo: whack all the old ones
+ for (int i = 0; i < adminObjectInstance.length; i++) {
+ AdminObjectInstance instance = adminObjectInstance[i];
+ if(instance.getAdminInstance() == null) {
+ instance.configure(getDDBean(), getAdminObject().addNewAdminobjectInstance());
+ }
+ }
+ this.adminObjectInstance = adminObjectInstance;
+ pcs.firePropertyChange("adminObjectInstance", old, adminObjectInstance);
+ }
+
+ public AdminObjectInstance getAdminObjectInstance(int index) {
+ return adminObjectInstance[index];
+ }
+
+ public void setAdminObjectInstance(int index, AdminObjectInstance adminObjectInstance) {
+ AdminObjectInstance[] old = getAdminObjectInstance();
+ //todo: whack the old one
+ if(adminObjectInstance.getAdminInstance() == null) {
+ adminObjectInstance.configure(getDDBean(), getAdminObject().addNewAdminobjectInstance());
+ }
+ this.adminObjectInstance[index] = adminObjectInstance;
+ //todo: deep copy of array for "old"
+ pcs.firePropertyChange("adminObjectInstance", old, adminObjectInstance);
+ }
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import org.apache.geronimo.xbeans.geronimo.GerAdminobjectInstanceType;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import javax.enterprise.deploy.model.DDBean;
+
+/**
+ * Represents /connector/adminobject/adminobject-instance in the
+ * Geronimo Connector deployment plan.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AdminObjectInstance extends ConfigHolder {
+ private DDBean adminObject;
+
+ public AdminObjectInstance() {
+ }
+
+ public AdminObjectInstance(DDBean adminObject, GerAdminobjectInstanceType instance) {
+ configure(adminObject, instance);
+ }
+
+ protected GerAdminobjectInstanceType getAdminInstance() {
+ return (GerAdminobjectInstanceType) getXmlObject();
+ }
+
+ public void reconfigure() {
+ configure(adminObject, getAdminInstance());
+ }
+
+ void configure(DDBean adminObject, GerAdminobjectInstanceType definition) {
+ this.adminObject = adminObject;
+ super.configure(adminObject, definition);
+ }
+
+ protected GerConfigPropertySettingType createConfigProperty() {
+ return getAdminInstance().addNewConfigPropertySetting();
+ }
+
+ protected GerConfigPropertySettingType[] getConfigProperties() {
+ return getAdminInstance().getConfigPropertySettingArray();
+ }
+
+ protected void removeConfigProperty(int index) {
+ getAdminInstance().removeConfigPropertySetting(index);
+ }
+
+ // ----------------------- JavaBean Properties for /adminobject-instance ----------------------
+
+ public String getMessageDestinationName() {
+ return getAdminInstance().getMessageDestinationName();
+ }
+
+ public void setMessageDestinationName(String name) {
+ String old = getMessageDestinationName();
+ getAdminInstance().setMessageDestinationName(name);
+ pcs.firePropertyChange("messageDestinationName", old, name);
+ }
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,144 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.xmlbeans.XmlObject;
+
+import javax.enterprise.deploy.model.XpathListener;
+import javax.enterprise.deploy.model.XpathEvent;
+import javax.enterprise.deploy.model.DDBean;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * Base class for beans that hold an array of config property settings.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ConfigHolder extends XmlBeanSupport {
+ final XpathListener xpathListener = new XpathListener() {
+ public void fireXpathEvent(XpathEvent event) {
+ if(event.isAddEvent()) {
+ //todo: add new config-property-setting, fire change event
+ } else if(event.isRemoveEvent()) {
+ //todo: remove config-property-setting, fire change event
+ } else if(event.isChangeEvent()) {
+ if(event.getChangeEvent().getPropertyName().equals("config-property-name")) {
+ String old = (String) event.getChangeEvent().getOldValue();
+ for (int i = 0; i < settings.length; i++) {
+ ConfigPropertySetting setting = settings[i];
+ if(setting.getName().equals(old)) {
+ setting.setName((String) event.getChangeEvent().getNewValue());
+ break;
+ }
+ }
+ }
+ }
+ }
+ };
+ private DDBean ddBean;
+ private ConfigPropertySetting[] settings = new ConfigPropertySetting[0];
+
+ public ConfigHolder() {
+ super(null);
+ }
+
+ public void clearNullSettings() {
+ List list = new ArrayList();
+ Set saved = new HashSet();
+ for (int i = 0; i < settings.length; i++) {
+ ConfigPropertySetting setting = settings[i];
+ if(setting.getValue() != null && !setting.isSetToDefault()) {
+ list.add(setting);
+ saved.add(setting.getName());
+ }
+ }
+ settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
+ GerConfigPropertySettingType[] configs = getConfigProperties();
+ for (int i = configs.length-1; i>=0; --i) {
+ GerConfigPropertySettingType type = configs[i];
+ if(!saved.contains(type.getName())) {
+ removeConfigProperty(i);
+ }
+ }
+ }
+
+ protected void configure(DDBean ddBean, XmlObject xml) {
+ ConfigPropertySetting[] old = null;
+ if(this.ddBean != null) {
+ this.ddBean.removeXpathListener("config-property", xpathListener);
+ old = settings;
+ }
+ this.ddBean = ddBean;
+ setXmlObject(xml);
+
+ // Prepare the ConfigPropertySetting array
+ List list = new ArrayList();
+ DDBean[] all = ddBean == null ? new DDBean[0] : ddBean.getChildBean("config-property");
+ if(all == null) {
+ all = new DDBean[0];
+ }
+ Map byName = new HashMap();
+ for (int i = 0; i < all.length; i++) {
+ DDBean item = all[i];
+ byName.put(item.getText("config-property-name")[0], item);
+ }
+ GerConfigPropertySettingType[] previous = getConfigProperties();
+ for (int i = 0; i < previous.length; i++) {
+ GerConfigPropertySettingType setting = previous[i];
+ DDBean item = (DDBean) byName.remove(setting.getName());
+ if(item != null) {
+ list.add(new ConfigPropertySetting(item, setting, false));
+ } else {
+ System.out.println("Ignoring connectiondefinition-instance/config-setting "+setting.getName()+" (no matching config-property in J2EE DD)");
+ //todo: delete it from the XMLBeans tree
+ }
+ }
+ for (Iterator it = byName.keySet().iterator(); it.hasNext();) {
+ String name = (String) it.next();
+ DDBean bean = (DDBean) byName.get(name);
+ list.add(new ConfigPropertySetting(bean, createConfigProperty(), true));
+ }
+ settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
+ if(old != null) {
+ pcs.firePropertyChange("configPropertySetting", old, settings);
+ }
+ if(ddBean != null) {
+ ddBean.addXpathListener("config-property", xpathListener);
+ }
+ }
+
+ public ConfigPropertySetting[] getConfigPropertySetting() {
+ return settings;
+ }
+
+ public ConfigPropertySetting getConfigPropertySetting(int index) {
+ return settings[index];
+ }
+
+ protected abstract GerConfigPropertySettingType createConfigProperty();
+ protected abstract GerConfigPropertySettingType[] getConfigProperties();
+ protected abstract void removeConfigProperty(int index);
+ public abstract void reconfigure();
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import javax.enterprise.deploy.model.DDBean;
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * Represents /connector/resourceadapter/resourceadapter-instance/config-property-setting
+ * or /connector/resourceadapter/outbound-resourceadapter/connection-definition/connectiondefinition-instance/config-property-setting
+ * or /connector/adminobject/adminobject-instance/config-property-setting in the
+ * Geronimo Connector deployment plan.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConfigPropertySetting extends XmlBeanSupport {
+ private DDBean configProperty;
+ private String defaultValue;
+
+ public ConfigPropertySetting() {
+ super(null);
+ }
+
+ public ConfigPropertySetting(DDBean configProperty, GerConfigPropertySettingType property, boolean setDefault) {
+ super(null);
+ configure(configProperty, property, setDefault);
+ }
+
+ protected GerConfigPropertySettingType getPropertySetting() {
+ return (GerConfigPropertySettingType) getXmlObject();
+ }
+
+ DDBean getDDBean() {
+ return configProperty;
+ }
+
+ void configure(DDBean configProperty, GerConfigPropertySettingType property, boolean setDefault) {
+ this.configProperty = configProperty;
+ setXmlObject(property);
+ final String name = configProperty.getText("config-property-name")[0];
+ getPropertySetting().setName(name);
+ String[] test = configProperty.getText("config-property-value");
+ if(test != null && test.length == 1) {
+ defaultValue = test[0];
+ } else {
+ defaultValue = null;
+ }
+ if(setDefault) {
+ getPropertySetting().setStringValue(defaultValue);
+ }
+ }
+
+ boolean isSetToDefault() {
+ String value = getValue();
+ return (defaultValue == null && value == null) ||
+ (defaultValue != null && value != null && defaultValue.equals(value));
+ }
+
+ // ----------------------- JavaBean Properties for config-property-setting ----------------------
+
+ public String getName() {
+ return getPropertySetting().getName();
+ }
+
+ // Not public -- should always be kept in sync with matching config-property
+ void setName(String name) {
+ String old = getName();
+ getPropertySetting().setName(name);
+ pcs.firePropertyChange("name", old, name);
+ }
+
+ public String getValue() {
+ return getPropertySetting().isNil() ? null : getPropertySetting().getStringValue();
+ }
+
+ public void setValue(String value) {
+ String old = getValue();
+ getPropertySetting().setStringValue(value);
+ pcs.firePropertyChange("value", old, value);
+ }
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,160 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import javax.enterprise.deploy.model.DDBean;
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
+import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * Represents /connector/resourceadapter/outbound-resourceadapter/connection-definition
+ * in the Geronimo Connector deployment plan. A Geronimo connection definition
+ * corresponds to a ra.xml connection definition (though there may be several
+ * Geronimo CDs for each ra.xml CD so this cannot be a DConfigBean [which would
+ * require a 1:1 mapping]). Each Geronimo connection definition may have one
+ * or more instances with different config property settings, etc.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConnectionDefinition extends XmlBeanSupport {
+ private DDBean resourceAdapter;
+ private ConnectionDefinitionInstance[] instances = new ConnectionDefinitionInstance[0];
+
+ public ConnectionDefinition() {
+ super(null);
+ }
+
+ public ConnectionDefinition(DDBean resourceAdapter, GerConnectionDefinitionType definition) {
+ super(null);
+ configure(resourceAdapter, definition);
+ }
+
+ protected GerConnectionDefinitionType getConnectionDefinition() {
+ return (GerConnectionDefinitionType) getXmlObject();
+ }
+
+ void configure(DDBean resourceAdapter, GerConnectionDefinitionType definition) {
+ this.resourceAdapter = resourceAdapter;
+ setXmlObject(definition);
+ //todo: handle unmatched interfaces below
+ instances = new ConnectionDefinitionInstance[definition.getConnectiondefinitionInstanceArray().length];
+ DDBean[] beans = resourceAdapter.getChildBean("outbound-resourceadapter/connection-definition");
+ DDBean match = null;
+ for (int i = 0; i < beans.length; i++) {
+ DDBean bean = beans[i];
+ if(bean.getText("connectionfactory-interface")[0].equals(definition.getConnectionfactoryInterface())) {
+ match = bean;
+ break;
+ }
+ }
+ for (int i = 0; i < instances.length; i++) {
+ GerConnectiondefinitionInstanceType gerInstance = definition.getConnectiondefinitionInstanceArray()[i];
+ instances[i] = new ConnectionDefinitionInstance(match, gerInstance);
+ }
+ }
+
+ // ----------------------- JavaBean Properties for connection-definition ----------------------
+
+ //todo: instead of String, make this an Enum type aware of the interfaces available in the J2EE DD
+ public String getConnectionFactoryInterface() {
+ return getConnectionDefinition().getConnectionfactoryInterface();
+ }
+
+ public void setConnectionFactoryInterface(String iface) {
+ String old = getConnectionFactoryInterface();
+ getConnectionDefinition().setConnectionfactoryInterface(iface);
+ DDBean match = getConnectionDefinitionDDBean();
+ for (int i = 0; i < instances.length; i++) {
+ ConnectionDefinitionInstance instance = instances[i];
+ if(instance.getDDBean() != match) {
+ instance.configure(match, instance.getConnectionInstance());
+ }
+ }
+ pcs.firePropertyChange("connectionFactoryInterface", old, iface);
+ }
+
+ public ConnectionDefinitionInstance[] getConnectionInstances() {
+ return instances;
+ }
+
+ public void setConnectionInstance(ConnectionDefinitionInstance[] instances) {
+ ConnectionDefinitionInstance[] old = this.instances;
+ Set before = new HashSet();
+ for (int i = 0; i < old.length; i++) {
+ before.add(old[i]);
+ }
+ this.instances = instances;
+ // Handle current or new resource adapters
+ for (int i = 0; i < instances.length; i++) {
+ ConnectionDefinitionInstance instance = instances[i];
+ if(instance.getConnectionInstance() == null) {
+ instance.configure(getConnectionDefinitionDDBean(), getConnectionDefinition().addNewConnectiondefinitionInstance());
+ } else {
+ before.remove(instance);
+ }
+ }
+ // Handle removed resource adapters
+ for (Iterator it = before.iterator(); it.hasNext();) {
+ ConnectionDefinitionInstance instance = (ConnectionDefinitionInstance) it.next();
+ GerConnectiondefinitionInstanceType all[] = getConnectionDefinition().getConnectiondefinitionInstanceArray();
+ for (int i = 0; i < all.length; i++) {
+ if(all[i] == instance) {
+ getConnectionDefinition().removeConnectiondefinitionInstance(i);
+ break;
+ }
+ }
+ }
+ pcs.firePropertyChange("connectionInstance", old, instances);
+
+ }
+
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
+ /**
+ * Look up the J2EE connection definition corresponding to this one (based on connectionfactory-interface)
+ */
+ private DDBean getConnectionDefinitionDDBean() {
+ String iface = getConnectionFactoryInterface();
+ if(iface == null || iface.equals("")) {
+ return null;
+ }
+ DDBean list[] = resourceAdapter.getChildBean("outbound-resourceadapter/connection-definition");
+ for (int i = 0; i < list.length; i++) {
+ DDBean bean = list[i];
+ String[] test = bean.getText("connectionfactory-interface");
+ if(test.length > 0) {
+ String myface = test[0];
+ if(myface.equals(iface)) {
+ return bean;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,130 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import javax.enterprise.deploy.model.DDBean;
+import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.geronimo.naming.deployment.jsr88.GBeanLocator;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * Represents connection-definition/connectiondefinition-instance in the
+ * Geronimo Connector deployment plan.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConnectionDefinitionInstance extends ConfigHolder {
+ private DDBean connectionDefinition;
+ private ConnectionManager manager;
+
+ public ConnectionDefinitionInstance() {
+ }
+
+ public ConnectionDefinitionInstance(DDBean connectionDefinition, GerConnectiondefinitionInstanceType instance) {
+ configure(connectionDefinition, instance);
+ }
+
+ protected GerConnectiondefinitionInstanceType getConnectionInstance() {
+ return (GerConnectiondefinitionInstanceType) getXmlObject();
+ }
+
+ public void reconfigure() {
+ configure(connectionDefinition, getConnectionInstance());
+ }
+
+ void configure(DDBean connectionDefinition, GerConnectiondefinitionInstanceType definition) {
+ this.connectionDefinition = connectionDefinition;
+ super.configure(connectionDefinition, definition);
+ if(connectionDefinition != null) {
+ DDBean parent = connectionDefinition.getChildBean("..")[0];
+ ConnectionManager oldMgr = manager;
+ if(oldMgr == null) {
+ if(definition.getConnectionmanager() != null) {
+ manager = new ConnectionManager(parent, definition.getConnectionmanager());
+ } else {
+ manager = new ConnectionManager(parent, definition.addNewConnectionmanager());
+ }
+ } else {
+ if(definition.getConnectionmanager() != null) {
+ manager.configure(parent, definition.getConnectionmanager());
+ } else {
+ manager.configure(parent, definition.addNewConnectionmanager());
+ }
+ }
+ pcs.firePropertyChange("connectionManager", oldMgr, manager);
+ }
+ }
+
+ DDBean getDDBean() {
+ return connectionDefinition;
+ }
+
+ protected GerConfigPropertySettingType createConfigProperty() {
+ return getConnectionInstance().addNewConfigPropertySetting();
+ }
+
+ protected GerConfigPropertySettingType[] getConfigProperties() {
+ return getConnectionInstance().getConfigPropertySettingArray();
+ }
+
+ protected void removeConfigProperty(int index) {
+ getConnectionInstance().removeConfigPropertySetting(index);
+ }
+
+ // ----------------------- JavaBean Properties for /connectiondefinition-instance ----------------------
+
+ public String getName() {
+ return getConnectionInstance().getName();
+ }
+
+ public void setName(String name) {
+ String old = getName();
+ getConnectionInstance().setName(name);
+ pcs.firePropertyChange("name", old, name);
+ }
+
+ public String[] getImplementedInterface() {
+ return getConnectionInstance().getImplementedInterfaceArray();
+ }
+
+ public String getImplementedInterface(int index) {
+ return getConnectionInstance().getImplementedInterfaceArray(index);
+ }
+
+ public void setImplementedInterface(String[] list) {
+ String[] old = getImplementedInterface();
+ getConnectionInstance().setImplementedInterfaceArray(list);
+ pcs.firePropertyChange("implementedInterface", old, list);
+ }
+
+ public void setImplementedInterface(int index, String iface) {
+ String[] old = getImplementedInterface();
+ getConnectionInstance().setImplementedInterfaceArray(index, iface);
+ pcs.firePropertyChange("implementedInterface", old, getImplementedInterface());
+ }
+
+ public ConnectionManager getConnectionManager() {
+ return manager;
+ }
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,299 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import javax.enterprise.deploy.model.DDBean;
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConnectionmanagerType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * Represents connectiondefinition-instance/connectionmanager in the Geronimo
+ * Connector deployment plan.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConnectionManager extends XmlBeanSupport {
+ private DDBean outboundRA;
+ private SinglePool singlePool;
+ private PartitionedPool partitionedPool;
+
+ public ConnectionManager() {
+ super(null);
+ }
+
+ public ConnectionManager(DDBean outboundRA, GerConnectionmanagerType manager) {
+ super(null);
+ configure(outboundRA, manager);
+ }
+
+ void configure(DDBean outboundRA, GerConnectionmanagerType manager) {
+ this.outboundRA = outboundRA;
+ setXmlObject(manager);
+ if(!manager.isSetNoTransaction() && !manager.isSetLocalTransaction() &&
+ !manager.isSetXaTransaction()) {
+ String[] test = outboundRA.getText("transaction-support");
+ if(test.length > 0) {
+ String tx = test[0];
+ if(tx.equalsIgnoreCase("NoTransaction")) {
+ manager.addNewNoTransaction();
+ } else if(tx.equalsIgnoreCase("LocalTransaction")) {
+ manager.addNewLocalTransaction();
+ } else if(tx.equalsIgnoreCase("XATransaction")) {
+ manager.addNewXaTransaction();
+ manager.getXaTransaction().addNewTransactionCaching();
+ }
+ }
+ }
+ if(manager.isSetSinglePool()) {
+ singlePool = new SinglePool(manager.getSinglePool());
+ } else if(manager.isSetPartitionedPool()) {
+ partitionedPool = new PartitionedPool(manager.getPartitionedPool());
+ } else if(!manager.isSetNoPool()) {
+ singlePool = new SinglePool(manager.addNewSinglePool());
+ }
+ }
+
+ protected GerConnectionmanagerType getManager() {
+ return (GerConnectionmanagerType) getXmlObject();
+ }
+
+ // ----------------------- JavaBean Properties for connection-manager ----------------------
+
+ public boolean isContainerManagedSecurity() {
+ return getManager().isSetContainerManagedSecurity();
+ }
+
+ public void setContainerManagedSecurity(boolean set) {
+ if(set) {
+ if(!isContainerManagedSecurity()) {
+ getManager().addNewContainerManagedSecurity();
+ pcs.firePropertyChange("containerManagedSecurity", !set, set);
+ }
+ } else {
+ if(isContainerManagedSecurity()) {
+ getManager().unsetContainerManagedSecurity();
+ pcs.firePropertyChange("containerManagedSecurity", !set, set);
+ }
+ }
+ }
+
+ public boolean isTransactionNone() {
+ return getManager().isSetNoTransaction();
+ }
+
+ public void setTransactionNone(boolean set) {
+ if(set) {
+ if(!isTransactionNone()) {
+ getManager().addNewNoTransaction();
+ pcs.firePropertyChange("transactionNone", !set, set);
+ }
+ if(isTransactionLocal()) setTransactionLocal(false);
+ if(isTransactionXA()) setTransactionXA(false);
+ if(isTransactionLog()) setTransactionLog(false);
+ } else {
+ if(isTransactionNone()) {
+ getManager().unsetNoTransaction();
+ pcs.firePropertyChange("transactionNone", !set, set);
+ }
+ }
+ }
+
+ public boolean isTransactionLocal() {
+ return getManager().isSetLocalTransaction();
+ }
+
+ public void setTransactionLocal(boolean set) {
+ if(set) {
+ if(!isTransactionLocal()) {
+ getManager().addNewLocalTransaction();
+ pcs.firePropertyChange("transactionLocal", !set, set);
+ }
+ if(isTransactionNone()) setTransactionNone(false);
+ if(isTransactionXA()) setTransactionXA(false);
+ if(isTransactionLog()) setTransactionLog(false);
+ } else {
+ if(isTransactionLocal()) {
+ getManager().unsetLocalTransaction();
+ pcs.firePropertyChange("transactionLocal", !set, set);
+ }
+ }
+ }
+
+ public boolean isTransactionLog() {
+ return getManager().isSetTransactionLog();
+ }
+
+ public void setTransactionLog(boolean set) {
+ if(set) {
+ if(!isTransactionLog()) {
+ getManager().addNewTransactionLog();
+ pcs.firePropertyChange("transactionLog", !set, set);
+ }
+ if(isTransactionNone()) setTransactionNone(false);
+ if(isTransactionXA()) setTransactionXA(false);
+ if(isTransactionLocal()) setTransactionLocal(false);
+ } else {
+ if(isTransactionLog()) {
+ getManager().unsetTransactionLog();
+ pcs.firePropertyChange("transactionLog", !set, set);
+ }
+ }
+ }
+
+ public boolean isTransactionXA() {
+ return getManager().isSetXaTransaction();
+ }
+
+ public void setTransactionXA(boolean set) {
+ if(set) {
+ if(!isTransactionXA()) {
+ getManager().addNewXaTransaction();
+ pcs.firePropertyChange("transactionXA", !set, set);
+ }
+ if(isTransactionNone()) setTransactionNone(false);
+ if(isTransactionLog()) setTransactionLog(false);
+ if(isTransactionLocal()) setTransactionLocal(false);
+ } else {
+ if(isTransactionXA()) {
+ boolean oldTX = isTransactionXACachingTransaction();
+ boolean oldThread = isTransactionXACachingThread();
+ getManager().unsetXaTransaction();
+ pcs.firePropertyChange("transactionXA", !set, set);
+ if(oldTX) {
+ pcs.firePropertyChange("transactionXACachingTransaction", true, false);
+ }
+ if(oldThread) {
+ pcs.firePropertyChange("transactionXACachingThread", true, false);
+ }
+ }
+ }
+ }
+
+ public boolean isTransactionXACachingTransaction() {
+ return isTransactionXA() && getManager().getXaTransaction().isSetTransactionCaching();
+ }
+
+ public void setTransactionXACachingTransaction(boolean set) {
+ if(set) {
+ setTransactionXA(true);
+ if(!getManager().getXaTransaction().isSetTransactionCaching()) {
+ getManager().getXaTransaction().addNewTransactionCaching();
+ pcs.firePropertyChange("transactionXACachingTransaction", !set, set);
+ }
+ } else {
+ if(isTransactionXA() && getManager().getXaTransaction().isSetTransactionCaching()) {
+ getManager().getXaTransaction().unsetTransactionCaching();
+ pcs.firePropertyChange("transactionXACachingTransaction", !set, set);
+ }
+ }
+ }
+
+ public boolean isTransactionXACachingThread() {
+ return isTransactionXA() && getManager().getXaTransaction().isSetThreadCaching();
+ }
+
+ public void setTransactionXACachingThread(boolean set) {
+ if(set) {
+ setTransactionXA(true);
+ if(!getManager().getXaTransaction().isSetThreadCaching()) {
+ getManager().getXaTransaction().addNewThreadCaching();
+ pcs.firePropertyChange("transactionXACachingThread", !set, set);
+ }
+ } else {
+ if(isTransactionXA() && getManager().getXaTransaction().isSetThreadCaching()) {
+ getManager().getXaTransaction().unsetThreadCaching();
+ pcs.firePropertyChange("transactionXACachingThread", !set, set);
+ }
+ }
+ }
+
+ public boolean isPoolNone() {
+ return getManager().isSetNoPool();
+ }
+
+ public void setPoolNone(boolean set) {
+ if(set) {
+ if(!getManager().isSetNoPool()) {
+ getManager().addNewNoPool();
+ pcs.firePropertyChange("poolNone", !set, set);
+ }
+ if(getPoolSingle() != null) setPoolSingle(null);
+ if(getPoolPartitioned() != null) setPoolPartitioned(null);
+ } else {
+ if(getManager().isSetNoPool()) {
+ getManager().unsetNoPool();
+ pcs.firePropertyChange("poolNone", !set, set);
+ }
+ if(getPoolSingle() == null && getPoolPartitioned() == null) {
+ setPoolSingle(new SinglePool());
+ }
+ }
+ }
+
+ public SinglePool getPoolSingle() {
+ return singlePool;
+ }
+
+ public void setPoolSingle(SinglePool pool) {
+ SinglePool old = getPoolSingle();
+ if(pool != null) {
+ singlePool = pool;
+ if(!getManager().isSetSinglePool()) {
+ getManager().addNewSinglePool();
+ }
+ singlePool.configure(getManager().getSinglePool());
+ pcs.firePropertyChange("poolSingle", old, pool);
+ if(isPoolNone()) setPoolNone(false);
+ if(getPoolPartitioned() != null) setPoolPartitioned(null);
+ } else {
+ if(getManager().isSetSinglePool()) {
+ getManager().unsetSinglePool();
+ pcs.firePropertyChange("poolSingle", old, pool);
+ }
+ }
+ }
+
+ public PartitionedPool getPoolPartitioned() {
+ return partitionedPool;
+ }
+
+ public void setPoolPartitioned(PartitionedPool pool) {
+ PartitionedPool old = getPoolPartitioned();
+ if(pool != null) {
+ partitionedPool = pool;
+ if(!getManager().isSetPartitionedPool()) {
+ getManager().addNewPartitionedPool();
+ }
+ partitionedPool.configure(getManager().getPartitionedPool());
+ pcs.firePropertyChange("poolPartitioned", old, pool);
+ if(isPoolNone()) setPoolNone(false);
+ if(getPoolSingle() != null) setPoolSingle(null);
+ } else {
+ if(getManager().isSetPartitionedPool()) {
+ getManager().unsetPartitionedPool();
+ pcs.firePropertyChange("poolPartitioned", old, pool);
+ }
+ }
+ }
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java
------------------------------------------------------------------------------
svn:mime-type = text/plain