You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2005/11/06 17:58:24 UTC
svn commit: r331116 - in /geronimo/trunk/modules:
connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/
connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/
test-ddbean/src/java/org/apache/geronimo/deployment/...
Author: ammulder
Date: Sun Nov 6 08:58:15 2005
New Revision: 331116
URL: http://svn.apache.org/viewcvs?rev=331116&view=rev
Log:
Can now create a working database deployment plan with DConfigBeans
(GERONIMO-1137)
Added:
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java (with props)
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/PartitionedPool.java (with props)
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/SinglePool.java (with props)
Modified:
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java
geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java
geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanRootImpl.java
Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java (original)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java Sun Nov 6 08:58:15 2005
@@ -53,8 +53,11 @@
this.configProperty = configProperty;
setXmlObject(property);
final String name = configProperty.getText("config-property-name")[0];
-System.out.println("Initializing ConfigPropertySetting to "+name);
getPropertySetting().setName(name);
+ String[] test = configProperty.getText("config-property-value");
+ if(test != null && test.length == 1) {
+ getPropertySetting().setStringValue(test[0]);
+ }
}
// ----------------------- JavaBean Properties for config-property-setting ----------------------
Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java (original)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java Sun Nov 6 08:58:15 2005
@@ -23,6 +23,7 @@
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;
/**
* @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
@@ -50,6 +51,8 @@
//todo: initialize connectiondefinition-instance from definition
}
+ // ----------------------- JavaBean Properties for connection-definition ----------------------
+
public String getConnectionFactoryInterface() {
return getConnectionDefinition().getConnectionfactoryInterface();
}
@@ -102,6 +105,9 @@
}
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
/**
* Look up the J2EE connection definition corresponding to this one (based on connectionfactory-interface)
*/
@@ -122,5 +128,9 @@
}
}
return null;
+ }
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
}
}
Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java (original)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java Sun Nov 6 08:58:15 2005
@@ -16,8 +16,6 @@
*/
package org.apache.geronimo.connector.deployment.jsr88;
-import java.util.Set;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.List;
@@ -27,11 +25,14 @@
import javax.enterprise.deploy.model.XpathListener;
import javax.enterprise.deploy.model.XpathEvent;
import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
-import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.xmlbeans.SchemaTypeLoader;
/**
+ * Represents connection-definition/connectiondefinition-instance in the
+ * Geronimo Connector deployment plan.
+ *
* @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
*/
public class ConnectionDefinitionInstance extends XmlBeanSupport {
@@ -57,6 +58,7 @@
};
private DDBean connectionDefinition;
private ConfigPropertySetting[] settings = new ConfigPropertySetting[0];
+ private ConnectionManager manager;
public ConnectionDefinitionInstance() {
super(null);
@@ -100,23 +102,37 @@
for (Iterator it = byName.keySet().iterator(); it.hasNext();) {
String name = (String) it.next();
DDBean bean = (DDBean) byName.get(name);
-System.out.println("Creating DDBean "+name+" "+bean.getText("config-property-name")[0]);
list.add(new ConfigPropertySetting(bean, getConnectionInstance().addNewConfigPropertySetting()));
}
settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
if(connectionDefinition != null) {
connectionDefinition.addXpathListener("config-property", xpathListener);
}
- // todo: Prepare the ConnectionManager
-
+ if(connectionDefinition != null) {
+ DDBean parent = connectionDefinition.getChildBean("..")[0];
+ ConnectionManager old = manager;
+ if(old == 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", old, manager);
+ }
}
DDBean getDDBean() {
return connectionDefinition;
}
- //todo: the following properties
- // connection-manager
+ // ----------------------- JavaBean Properties for /connectiondefinition-instance ----------------------
public String getName() {
return getConnectionInstance().getName();
@@ -154,5 +170,16 @@
public ConfigPropertySetting getConfigPropertySetting(int index) {
return settings[index];
+ }
+
+ public ConnectionManager getConnectionManager() {
+ return manager;
+ }
+
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
}
}
Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java?rev=331116&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java Sun Nov 6 08:58:15 2005
@@ -0,0 +1,298 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+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("XATranasaction")) {
+ manager.addNewXaTransaction();
+ }
+ }
+ }
+ 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().isSetTransactionCaching();
+ }
+
+ 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/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java (original)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java Sun Nov 6 08:58:15 2005
@@ -77,6 +77,10 @@
}
}
+ GerConnectorDocument getConnectorDocument() {
+ return (GerConnectorDocument) getXmlObject();
+ }
+
public String[] getXpaths() {
return getXPathsForJ2ee_1_4(new String[][]{{"connector",},});
}
Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java (original)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java Sun Nov 6 08:58:15 2005
@@ -23,6 +23,7 @@
import javax.enterprise.deploy.model.XpathListener;
import javax.enterprise.deploy.model.XpathEvent;
import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
+import org.apache.geronimo.deployment.xbeans.DependencyType;
import org.apache.geronimo.xbeans.geronimo.GerConnectorType;
import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
import org.apache.xmlbeans.SchemaTypeLoader;
@@ -36,6 +37,7 @@
public class ConnectorDCB extends DConfigBeanSupport {
private DDBean resourceAdapterDDBean;
private ResourceAdapter[] resourceAdapter = new ResourceAdapter[0];
+ private Dependency[] dependency = new Dependency[0];
public ConnectorDCB(DDBean connectorDDBean, final GerConnectorType connector) {
super(connectorDDBean, connector);
@@ -65,7 +67,14 @@
//todo: Handle the import children
//todo: Handle the hidden-classes children
//todo: Handle the non-overridable-classes children
- //todo: Handle the dependency children
+ // Handle the dependency children
+ DependencyType[] deps = connector.getDependencyArray();
+ if(deps != null && deps.length > 0) {
+ dependency = new Dependency[deps.length];
+ for (int i = 0; i < deps.length; i++) {
+ dependency[i] = new Dependency(deps[i]);
+ }
+ }
// Handle the resource adapter children
GerResourceadapterType[] adapters = connector.getResourceadapterArray();
if(adapters == null || adapters.length == 0) {
@@ -96,7 +105,6 @@
// import*
// hidden-classes*
// non-overridable-classes*
- // dependency*
// adminobject*
// gbean*
@@ -197,6 +205,53 @@
ra.configure(resourceAdapterDDBean, getConnector().addNewResourceadapter());
}
pcs.firePropertyChange("resourceAdapter", old, resourceAdapter);
+ }
+
+ public Dependency[] getDependency() {
+ return dependency;
+ }
+
+ public void setDependency(Dependency[] dependency) {
+ Dependency[] old = this.dependency;
+ Set before = new HashSet();
+ for (int i = 0; i < old.length; i++) {
+ before.add(old[i]);
+ }
+ this.dependency = dependency;
+ // Handle current or new resource adapters
+ for (int i = 0; i < dependency.length; i++) {
+ Dependency dep = dependency[i];
+ if(dep.getDependency() == null) {
+ dep.configure(getConnector().addNewDependency());
+ } else {
+ before.remove(dep);
+ }
+ }
+ // Handle removed resource adapters
+ for (Iterator it = before.iterator(); it.hasNext();) {
+ Dependency dep = (Dependency) it.next();
+ DependencyType all[] = getConnector().getDependencyArray();
+ for (int i = 0; i < all.length; i++) {
+ if(all[i] == dep) {
+ getConnector().removeDependency(i);
+ break;
+ }
+ }
+ }
+ pcs.firePropertyChange("dependency", old, dependency);
+ }
+
+ public Dependency getDependency(int index) {
+ return dependency[index];
+ }
+
+ public void setDependency(int index, Dependency dep) {
+ Dependency[] old = this.dependency;
+ dependency[index] = dep;
+ if(dep.getDependency() == null) {
+ dep.configure(getConnector().addNewDependency());
+ }
+ pcs.firePropertyChange("dependency", old, dependency);
}
Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java (original)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java Sun Nov 6 08:58:15 2005
@@ -63,6 +63,9 @@
getDependency().setGroupId(groupId);
}
pcs.firePropertyChange("groupId", old, groupId);
+ if(groupId != null && getURI() != null) {
+ setURI(null);
+ }
}
public String getArtifactId() {
@@ -77,6 +80,9 @@
getDependency().setArtifactId(artifact);
}
pcs.firePropertyChange("artifactId", old, artifact);
+ if(artifact != null && getURI() != null) {
+ setURI(null);
+ }
}
public String getType() {
@@ -91,6 +97,9 @@
getDependency().setType(type);
}
pcs.firePropertyChange("type", old, type);
+ if(type != null && getURI() != null) {
+ setURI(null);
+ }
}
public String getVersion() {
@@ -105,6 +114,9 @@
getDependency().setVersion(version);
}
pcs.firePropertyChange("version", old, version);
+ if(version != null && getURI() != null) {
+ setURI(null);
+ }
}
public String getURI() {
@@ -119,6 +131,12 @@
getDependency().setUri(uri);
}
pcs.firePropertyChange("URI", old, uri);
+ if(uri != null) {
+ if(getArtifactId() != null) setArtifactId(null);
+ if(getGroupId() != null) setGroupId(null);
+ if(getType() != null) setType(null);
+ if(getVersion() != null) setVersion(null);
+ }
}
// ----------------------- End of JavaBean Properties ----------------------
Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/PartitionedPool.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/PartitionedPool.java?rev=331116&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/PartitionedPool.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/PartitionedPool.java Sun Nov 6 08:58:15 2005
@@ -0,0 +1,81 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.GerPartitionedpoolType;
+import org.apache.geronimo.xbeans.geronimo.GerSinglepoolType;
+
+/**
+ * Settings for connectionmanager/partitioned-pool
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class PartitionedPool extends SinglePool {
+ public PartitionedPool() {
+ }
+
+ public PartitionedPool(GerPartitionedpoolType pool) {
+ super(pool);
+ }
+
+ protected GerPartitionedpoolType getPool() {
+ return (GerPartitionedpoolType) getXmlObject();
+ }
+
+ protected void configure(GerSinglepoolType pool) {
+ super.configure(pool);
+ if(!isPartitionBySubject() && !isPartitionByRequest()) {
+ setPartitionBySubject(true);
+ }
+ }
+
+ public boolean isPartitionBySubject() {
+ return getPool().isSetPartitionBySubject();
+ }
+
+ public void setPartitionBySubject(boolean set) {
+ if(set) {
+ if(!isPartitionBySubject()) {
+ getPool().addNewPartitionBySubject();
+ pcs.firePropertyChange("partitionBySubject", !set, set);
+ }
+ } else {
+ if(isPartitionBySubject()) {
+ getPool().unsetPartitionBySubject();
+ pcs.firePropertyChange("partitionBySubject", !set, set);
+ }
+ }
+ }
+
+ public boolean isPartitionByRequest() {
+ return getPool().isSetPartitionByConnectionrequestinfo();
+ }
+
+ public void setPartitionByRequest(boolean set) {
+ if(set) {
+ if(!isPartitionBySubject()) {
+ getPool().addNewPartitionByConnectionrequestinfo();
+ pcs.firePropertyChange("partitionByRequest", !set, set);
+ }
+ } else {
+ if(isPartitionBySubject()) {
+ getPool().unsetPartitionByConnectionrequestinfo();
+ pcs.firePropertyChange("partitionByRequest", !set, set);
+ }
+ }
+ }
+}
Propchange: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/PartitionedPool.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/SinglePool.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/SinglePool.java?rev=331116&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/SinglePool.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/SinglePool.java Sun Nov 6 08:58:15 2005
@@ -0,0 +1,171 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed 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.GerSinglepoolType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * Settings for connectionmanager/single-pool
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class SinglePool extends XmlBeanSupport {
+ public SinglePool() {
+ super(null);
+ }
+ public SinglePool(GerSinglepoolType pool) {
+ super(null);
+ configure(pool);
+ }
+
+ protected GerSinglepoolType getSinglePool() {
+ return (GerSinglepoolType) getXmlObject();
+ }
+
+ protected void configure(GerSinglepoolType pool) {
+ setXmlObject(pool);
+ if(!isSelectOneAssumeMatch() && !isMatchOne() && !isMatchAll()) {
+ setMatchOne(true);
+ }
+ }
+
+ // ----------------------- JavaBean Properties for single-pool ----------------------
+
+ public Integer getMinSize() {
+ return getSinglePool().isSetMinSize() ? new Integer(getSinglePool().getMinSize()) : null;
+ }
+
+ public void setMinSize(Integer value) {
+ Integer old = getMinSize();
+ if(value == null) {
+ getSinglePool().unsetMinSize();
+ } else {
+ getSinglePool().setMinSize(value.intValue());
+ }
+ pcs.firePropertyChange("minSize", old, value);
+ }
+
+ public Integer getMaxSize() {
+ return getSinglePool().isSetMaxSize() ? new Integer(getSinglePool().getMaxSize()) : null;
+ }
+
+ public void setMaxSize(Integer value) {
+ Integer old = getMaxSize();
+ if(value == null) {
+ getSinglePool().unsetMaxSize();
+ } else {
+ getSinglePool().setMaxSize(value.intValue());
+ }
+ pcs.firePropertyChange("maxSize", old, value);
+ }
+
+ public Integer getBlockingTimeoutMillis() {
+ return getSinglePool().isSetBlockingTimeoutMilliseconds() ? new Integer(getSinglePool().getBlockingTimeoutMilliseconds()) : null;
+ }
+
+ public void setBlockingTimeoutMillis(Integer value) {
+ Integer old = getBlockingTimeoutMillis();
+ if(value == null) {
+ getSinglePool().unsetBlockingTimeoutMilliseconds();
+ } else {
+ getSinglePool().setBlockingTimeoutMilliseconds(value.intValue());
+ }
+ pcs.firePropertyChange("blockingTimeoutMillis", old, value);
+ }
+
+ public Integer getIdleTimeoutMinutes() {
+ return getSinglePool().isSetIdleTimeoutMinutes() ? new Integer(getSinglePool().getIdleTimeoutMinutes()) : null;
+ }
+
+ public void setIdleTimeoutMinutes(Integer value) {
+ Integer old = getIdleTimeoutMinutes();
+ if(value == null) {
+ getSinglePool().unsetIdleTimeoutMinutes();
+ } else {
+ getSinglePool().setIdleTimeoutMinutes(value.intValue());
+ }
+ pcs.firePropertyChange("idleTimeoutMinutes", old, value);
+ }
+
+ public boolean isMatchAll() {
+ return getSinglePool().isSetMatchAll();
+ }
+
+ public void setMatchAll(boolean set) {
+ if(set) {
+ if(!isMatchAll()) {
+ getSinglePool().addNewMatchAll();
+ pcs.firePropertyChange("matchAll", !set, set);
+ }
+ if(isMatchOne()) setMatchOne(false);
+ if(isSelectOneAssumeMatch()) setSelectOneAssumeMatch(false);
+ } else {
+ if(isMatchAll()) {
+ getSinglePool().unsetMatchAll();
+ pcs.firePropertyChange("matchAll", !set, set);
+ }
+ }
+ }
+
+ public boolean isMatchOne() {
+ return getSinglePool().isSetMatchOne();
+ }
+
+ public void setMatchOne(boolean set) {
+ if(set) {
+ if(!isMatchOne()) {
+ getSinglePool().addNewMatchOne();
+ pcs.firePropertyChange("matchOne", !set, set);
+ }
+ if(isMatchAll()) setMatchAll(false);
+ if(isSelectOneAssumeMatch()) setSelectOneAssumeMatch(false);
+ } else {
+ if(isMatchOne()) {
+ getSinglePool().unsetMatchOne();
+ pcs.firePropertyChange("matchOne", !set, set);
+ }
+ }
+ }
+
+ public boolean isSelectOneAssumeMatch() {
+ return getSinglePool().isSetSelectOneAssumeMatch();
+ }
+
+ public void setSelectOneAssumeMatch(boolean set) {
+ if(set) {
+ if(!isSelectOneAssumeMatch()) {
+ getSinglePool().addNewSelectOneAssumeMatch();
+ pcs.firePropertyChange("selectOneAssumeMatch", !set, set);
+ }
+ if(isMatchAll()) setMatchAll(false);
+ if(isMatchOne()) setMatchOne(false);
+ } else {
+ if(isSelectOneAssumeMatch()) {
+ getSinglePool().unsetSelectOneAssumeMatch();
+ pcs.firePropertyChange("selectOneAssumeMatch", !set, set);
+ }
+ }
+ }
+
+ // ----------------------- End of JavaBean Properties ----------------------
+
+ protected SchemaTypeLoader getSchemaTypeLoader() {
+ return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+ }
+}
Propchange: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/SinglePool.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java (original)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java Sun Nov 6 08:58:15 2005
@@ -63,27 +63,42 @@
assertNull(connector.getSuppressDefaultParentID());
connector.setConfigID("MyDatabase");
connector.setParentID("org/apache/geronimo/Server");
- //todo: Try the dependency element
+ // Try the dependency element
+ assertNotNull(connector.getDependency());
+ assertEquals(0, connector.getDependency().length);
+ Dependency dep = new Dependency();
+ connector.setDependency(new Dependency[]{dep});
+ assertEquals(1, connector.getDependency().length);
+ dep.setURI("postgresql/jars/postgresql-8.0-313.jdbc3.jar");
+ assertNull(dep.getArtifactId());
+ assertNull(dep.getGroupId());
+ assertNull(dep.getType());
+ assertNull(dep.getVersion());
+ dep.setGroupId("postgresql");
+ dep.setArtifactId("postgresql-8.0");
+ dep.setVersion("313.jdbc3");
+ assertNull(dep.getURI());
+ assertNull(dep.getType());
// Try the /connector/resourceadapter element
assertNotNull(connector.getResourceAdapter());
assertEquals(1, connector.getResourceAdapter().length);
ResourceAdapter adapter = connector.getResourceAdapter()[0];
assertNotNull(adapter);
- //todo: Try the /connector/resourceadapter/outbound-resourceadapter/connection-definition element
+ // Try the /connector/resourceadapter/outbound-resourceadapter/connection-definition element
assertNotNull(adapter.getConnectionDefinition());
assertEquals(0, adapter.getConnectionDefinition().length);
ConnectionDefinition definition = new ConnectionDefinition();
adapter.setConnectionDefinition(new ConnectionDefinition[]{definition});
assertEquals(1, adapter.getConnectionDefinition().length);
definition.setConnectionFactoryInterface("javax.sql.DataSource");
- //todo: Try the .../connection-definition/connectiondefinition-instance elements
+ // Try the .../connection-definition/connectiondefinition-instance elements
assertNotNull(definition.getConnectionInstances());
assertEquals(0, definition.getConnectionInstances().length);
ConnectionDefinitionInstance instance = new ConnectionDefinitionInstance();
definition.setConnectionInstance(new ConnectionDefinitionInstance[]{instance});
assertEquals(1, definition.getConnectionInstances().length);
assertNotNull(instance.getDDBean());
- //todo: Try the .../connection-definition/connectiondefinition-instance/config-property-setting elements
+ // Try the .../connection-definition/connectiondefinition-instance/config-property-setting elements
assertNotNull(instance.getConfigPropertySetting());
assertEquals(6, instance.getConfigPropertySetting().length);
int found = 0;
@@ -105,11 +120,37 @@
assertEquals("", setting.getValue());
setting.setValue("dbpass");
++found;
+ } else {
+ assertNotNull(setting.getValue());
}
}
assertEquals(4, found);
- //todo: Try the .../connection-definition/connectionmanager elements
+ // Try the .../connection-definition/connectionmanager elements
+ ConnectionManager manager = instance.getConnectionManager();
+ assertNotNull(manager);
+ assertFalse(manager.isContainerManagedSecurity());
+ assertFalse(manager.isPoolNone());
+ assertNotNull(manager.getPoolSingle());
+ assertNull(manager.getPoolPartitioned());
+ assertFalse(manager.isTransactionLog());
+ assertFalse(manager.isTransactionNone());
+ assertFalse(manager.isTransactionXA());
+ assertFalse(manager.isTransactionXACachingThread());
+ assertFalse(manager.isTransactionXACachingTransaction());
+ assertTrue(manager.isTransactionLocal());
+ SinglePool pool = manager.getPoolSingle();
+ assertNull(pool.getMinSize());
+ assertNull(pool.getMaxSize());
+ assertNull(pool.getIdleTimeoutMinutes());
+ assertNull(pool.getBlockingTimeoutMillis());
+ assertTrue(pool.isMatchOne());
+ assertFalse(pool.isMatchAll());
+ assertFalse(pool.isSelectOneAssumeMatch());
+ pool.setMinSize(new Integer(2));
+ pool.setMaxSize(new Integer(30));
+ pool.setBlockingTimeoutMillis(new Integer(5000));
//todo: Look at the XmlBeans tree and make sure the right stuff is in there
+ System.out.println(dcbRoot.getConnectorDocument());
}
protected void setUp() throws Exception {
Modified: geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java (original)
+++ geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanImpl.java Sun Nov 6 08:58:15 2005
@@ -26,7 +26,6 @@
import javax.enterprise.deploy.model.DDBean;
import javax.enterprise.deploy.model.DDBeanRoot;
import javax.enterprise.deploy.model.XpathListener;
-import javax.xml.namespace.QName;
import org.apache.xmlbeans.XmlCursor;
@@ -41,9 +40,11 @@
protected final Map children;
protected final String content;
protected final Map attributeMap;
+ protected final DDBean parent;
- public DDBeanImpl(DDBeanRoot root, String xpath, XmlCursor c) {
+ public DDBeanImpl(DDBeanRoot root, DDBean parent, String xpath, XmlCursor c) {
this.root = root;
+ this.parent = parent;
this.xpath = xpath;
this.children = new HashMap();
this.attributeMap = new HashMap();
@@ -64,7 +65,7 @@
nodes = new ArrayList();
children.put(name, nodes);
}
- nodes.add(new DDBeanImpl(root, xpath + "/" + name, c));
+ nodes.add(new DDBeanImpl(root, this, xpath + "/" + name, c));
} while (c.toNextSibling());
}
c.pop();
@@ -73,6 +74,7 @@
DDBeanImpl(DDBeanImpl source, String xpath) {
this.xpath = xpath;
this.root = source.root;
+ this.parent = source.parent;
this.children = source.children;
this.content = source.content;
this.attributeMap = source.attributeMap;
@@ -118,6 +120,16 @@
public DDBean[] getChildBean(String xpath) {
if (xpath.startsWith("/")) {
return getRoot().getChildBean(xpath.substring(1));
+ } else if(xpath.equals(".")) {
+ return new DDBean[]{this};
+ } else if(xpath.startsWith("./")) {
+ return getChildBean(xpath.substring(2));
+ } else if(xpath.startsWith("..")) {
+ if(xpath.length() == 2) {
+ return new DDBean[]{parent};
+ } else {
+ return parent.getChildBean(xpath.substring(3));
+ }
}
int index = xpath.indexOf('/');
if (index == -1) {
Modified: geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanRootImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanRootImpl.java?rev=331116&r1=331115&r2=331116&view=diff
==============================================================================
--- geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanRootImpl.java (original)
+++ geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/DDBeanRootImpl.java Sun Nov 6 08:58:15 2005
@@ -51,7 +51,7 @@
try {
c.toStartDoc();
c.toFirstChild();
- docBean = new DDBeanImpl(this, "/" + c.getName().getLocalPart(), c);
+ docBean = new DDBeanImpl(this, this, "/" + c.getName().getLocalPart(), c);
} finally {
c.dispose();
}