You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by an...@apache.org on 2007/05/17 11:38:21 UTC
svn commit: r538850 [1/2] - in /incubator/cxf/trunk:
common/common/src/main/java/org/apache/cxf/configuration/spring/
common/common/src/main/resources/META-INF/
common/common/src/main/resources/schemas/configuration/ parent/
rt/core/src/main/java/org/a...
Author: andreasmyth
Date: Thu May 17 02:38:18 2007
New Revision: 538850
URL: http://svn.apache.org/viewvc?view=rev&rev=538850
Log:
[JIRA CXF-139] Persistence for RM. Recovery not included yet.
Enabled Spring xml schema validation in general, but explicitly disabled for modules rt-frontend-jaxws, rt-transports/jms, rt-ws-policy and systests.
Added:
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/BeanConstants.java (with props)
incubator/cxf/trunk/common/common/src/main/resources/META-INF/spring.schemas
incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/cxf-beans.xsd (with props)
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java (with props)
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStoreException.java (with props)
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/Messages.properties (with props)
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java (with props)
incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager-types.xsd (with props)
incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager.xsd
- copied, changed from r537806, incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-manager.xsd
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java (with props)
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/custom-rmmanager.xml (with props)
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/PersistenceUtilsTest.java (with props)
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/PersistenceTest.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/oneway-client-crash.xml (with props)
Removed:
incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/metadata.xsd
incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/wsrm-manager.xsd
Modified:
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
incubator/cxf/trunk/parent/pom.xml
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml
incubator/cxf/trunk/rt/frontend/jaxws/pom.xml
incubator/cxf/trunk/rt/transports/jms/pom.xml
incubator/cxf/trunk/rt/ws/policy/pom.xml
incubator/cxf/trunk/rt/ws/rm/pom.xml
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStore.java
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMManagerBeanDefinitionParser.java
incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/spring.schemas
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractEndpointTest.java
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/SourceSequenceTest.java
incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/rmmanager.xml
incubator/cxf/trunk/systests/pom.xml
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java Thu May 17 02:38:18 2007
@@ -18,13 +18,18 @@
*/
package org.apache.cxf.configuration.spring;
+import java.util.StringTokenizer;
+
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
+
+import org.w3c.dom.Attr;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -39,19 +44,38 @@
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.util.StringUtils;
-public abstract class AbstractBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
+public abstract class AbstractBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
+
@Override
- protected String resolveId(Element el, AbstractBeanDefinition arg1,
- ParserContext arg2) throws BeanDefinitionStoreException {
- String id = el.getAttribute("id");
- String createdFromAPI = el.getAttribute("createdFromAPI");
+ protected String resolveId(Element elem, AbstractBeanDefinition definition,
+ ParserContext ctx) throws BeanDefinitionStoreException {
+
+ // REVISIT: use getAttributeNS instead
+
+ String id = elem.getAttribute(BeanDefinitionParserDelegate.ID_ATTRIBUTE);
+ String createdFromAPI = elem.getAttribute(BeanConstants.CREATED_FROM_API_ATTR);
+
+ if (null == id || "".equals(id)) {
+ String names = elem.getAttribute(BeanConstants.NAME_ATTR);
+ if (null != names) {
+ StringTokenizer st =
+ new StringTokenizer(BeanDefinitionParserDelegate.BEAN_NAME_DELIMITERS, names);
+ if (st.countTokens() > 0) {
+ id = st.nextToken();
+ }
+ }
+ }
+
+ if (null == id || "".equals(id)) {
+ return super.resolveId(elem, definition, ctx);
+ }
if (createdFromAPI != null && "true".equals(createdFromAPI.toLowerCase())) {
return id + getSuffix();
}
- return super.resolveId(el, arg1, arg2);
+ return id;
}
protected String getSuffix() {
@@ -116,13 +140,28 @@
return first;
}
- protected void mapElementToJaxbProperty(Element parent, BeanDefinitionBuilder bean, QName name,
- String string) {
- mapElementToJaxbProperty(parent, bean, name, string, null);
+ protected void mapElementToJaxbProperty(Element parent,
+ BeanDefinitionBuilder bean,
+ QName name,
+ String propertyName) {
+ mapElementToJaxbProperty(parent, bean, name, propertyName, null);
+ }
+
+ protected void mapElementToJaxbProperty(Element parent,
+ BeanDefinitionBuilder bean,
+ QName name,
+ String propertyName,
+ Class<?> c) {
+ mapElementToJaxbProperty(parent, bean, name, propertyName, c, getJaxbPackage());
}
+
- protected void mapElementToJaxbProperty(Element parent, BeanDefinitionBuilder bean, QName name,
- String string, Class<?> c) {
+ protected void mapElementToJaxbProperty(Element parent,
+ BeanDefinitionBuilder bean,
+ QName name,
+ String propertyName,
+ Class<?> c,
+ String packageName) {
Node data = null;
NodeList nl = parent.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
@@ -141,7 +180,7 @@
JAXBContext context = null;
Object obj = null;
try {
- context = JAXBContext.newInstance(getJaxbPackage(), getClass().getClassLoader());
+ context = JAXBContext.newInstance(packageName, getClass().getClassLoader());
Unmarshaller u = context.createUnmarshaller();
if (c != null) {
obj = u.unmarshal(data, c);
@@ -159,7 +198,7 @@
}
if (obj != null) {
- bean.addPropertyValue(string, obj);
+ bean.addPropertyValue(propertyName, obj);
}
}
@@ -222,5 +261,25 @@
return new QName(ns, local, pre);
}
+
+ protected final void doParseCommon(Element elem, ParserContext ctx, BeanDefinitionBuilder builder) {
+ System.out.println("Using AbstractBeanDefinitionParser to parse element "
+ + new QName(elem.getNamespaceURI(), elem.getLocalName()));
+ NamedNodeMap atts = elem.getAttributes();
+
+ for (int i = 0; i < atts.getLength(); i++) {
+ Attr node = (Attr) atts.item(i);
+ String uri = node.getNamespaceURI();
+ String name = node.getLocalName();
+
+ if (BeanConstants.NAMESPACE_URI.equals(uri)) {
+ if (BeanConstants.CREATED_FROM_API_ATTR.equals(name)) {
+ builder.setAbstract(true);
+ } else if (BeanConstants.ABSTRACT_ATTR.equals(name)) {
+ builder.setAbstract(true);
+ }
+ }
+ }
+ }
}
Added: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/BeanConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/BeanConstants.java?view=auto&rev=538850
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/BeanConstants.java (added)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/BeanConstants.java Thu May 17 02:38:18 2007
@@ -0,0 +1,40 @@
+/**
+ * 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.cxf.configuration.spring;
+
+/**
+ *
+ */
+public final class BeanConstants {
+
+ public static final String NAMESPACE_URI = "http://cxf.apache.org/schemas/configuration/cxf-beans";
+
+ public static final String NAME_ATTR = "name";
+
+ public static final String ABSTRACT_ATTR = "abstract";
+
+ public static final String CREATED_FROM_API_ATTR = "createdFromAPI";
+
+ /**
+ * Prevents instantiation.
+ */
+ private BeanConstants() {
+ }
+}
Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/BeanConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/BeanConstants.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/common/common/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/resources/META-INF/spring.schemas?view=auto&rev=538850
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/resources/META-INF/spring.schemas (added)
+++ incubator/cxf/trunk/common/common/src/main/resources/META-INF/spring.schemas Thu May 17 02:38:18 2007
@@ -0,0 +1 @@
+http\://cxf.apache.org/schemas/configuration/cxf-beans.xsd=schemas/configuration/cxf-beans.xsd
\ No newline at end of file
Added: incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/cxf-beans.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/cxf-beans.xsd?view=auto&rev=538850
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/cxf-beans.xsd (added)
+++ incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/cxf-beans.xsd Thu May 17 02:38:18 2007
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+
+<xsd:schema
+ targetNamespace="http://cxf.apache.org/configuration/beans"
+ xmlns:tns="http://cxf.apache.org/configuration/beans"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+
+ <xsd:attributeGroup name="beanAttributes">
+ <xsd:attribute name="name" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ See documentation for attribute name in attribute group beanAttributes
+ in http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="abstract" type="xsd:boolean">
+ <xsd:annotation>
+ <xsd:documentation>
+ See documentation for attribute abstract in attribute group beanAttributes
+ in http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="createdFromAPI" type="xsd:boolean">
+ <xsd:annotation>
+ <xsd:documentation>
+ See documentation for attribute abstract in attribute group beanAttributes
+ in http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:attributeGroup>
+
+</xsd:schema>
Propchange: incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/cxf-beans.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/cxf-beans.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/common/common/src/main/resources/schemas/configuration/cxf-beans.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/parent/pom.xml?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/parent/pom.xml (original)
+++ incubator/cxf/trunk/parent/pom.xml Thu May 17 02:38:18 2007
@@ -52,12 +52,13 @@
<saaj.impl.version>1.3</saaj.impl.version>
<spring.version>2.0.4</spring.version>
<wsdl4j.version>1.6.1</wsdl4j.version>
- <derby.version>10.1.1.0</derby.version>
+ <derby.version>10.2.2.0</derby.version>
<activemq.version>4.1.0-incubator</activemq.version>
<geronimo.version>1.1</geronimo.version>
<rhino.version>1.6R5</rhino.version>
<xmlbeans.version>2.2.0</xmlbeans.version>
+ <spring.validation.mode>VALIDATION_AUTO</spring.validation.mode>
<downloadSources>true</downloadSources>
</properties>
@@ -216,6 +217,10 @@
<property>
<name>derby.system.home</name>
<value>${basedir}/target/derby</value>
+ </property>
+ <property>
+ <name>spring.validation.mode</name>
+ <value>${spring.validation.mode}</value>
</property>
</systemProperties>
</configuration>
Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java Thu May 17 02:38:18 2007
@@ -165,9 +165,10 @@
}
reader.setNamespaceHandlerResolver(nsHandlerResolver);
- // TODO: check why VALIDATION_XSD complains about mixed content in
- // value elements - this should be legal according to the xsd
- reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
+ String mode = System.getProperty("spring.validation.mode");
+ if (null != mode) {
+ reader.setValidationModeName(mode);
+ }
reader.setNamespaceAware(true);
}
}
Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml (original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/configuration/spring/test-beans.xml Thu May 17 02:38:18 2007
@@ -22,17 +22,17 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="*2" abstract="true" class="SimpleBean">
+ <bean name="*2" abstract="true" class="SimpleBean">
<property name="stringAttr" value="StarHallo"/>
</bean>
<!-- additional wildcards for class SimpleBean will be ignored with a warning -->
- <bean id="*duplicateWildcardForClassWillBeIgnored" abstract="true" class="SimpleBean">
+ <bean name="*duplicateWildcardForClassWillBeIgnored" abstract="true" class="SimpleBean">
<property name="stringAttr" value="duplicateWildcardForClassWillBeIgnored"/>
</bean>
<!-- wildcards bean with no class will be ignored with a warning -->
- <bean id="*willBeIgnoredBecausOfNoClass" abstract="true" >
+ <bean name="*willBeIgnoredBecausOfNoClass" abstract="true" >
<property name="stringAttr" value="willBeIgnoredBecausOfNoClass"/>
</bean>
Modified: incubator/cxf/trunk/rt/frontend/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/pom.xml?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/pom.xml (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/pom.xml Thu May 17 02:38:18 2007
@@ -32,6 +32,10 @@
<relativePath>../../../parent/pom.xml</relativePath>
</parent>
+ <properties>
+ <spring.validation.mode>VALIDATION_NONE</spring.validation.mode>
+ </properties>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
Modified: incubator/cxf/trunk/rt/transports/jms/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/pom.xml?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/pom.xml (original)
+++ incubator/cxf/trunk/rt/transports/jms/pom.xml Thu May 17 02:38:18 2007
@@ -32,6 +32,10 @@
<relativePath>../../../parent/pom.xml</relativePath>
</parent>
+ <properties>
+ <spring.validation.mode>VALIDATION_NONE</spring.validation.mode>
+ </properties>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
Modified: incubator/cxf/trunk/rt/ws/policy/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/pom.xml?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/policy/pom.xml Thu May 17 02:38:18 2007
@@ -30,6 +30,10 @@
<relativePath>../../../parent/pom.xml</relativePath>
</parent>
+ <properties>
+ <spring.validation.mode>VALIDATION_NONE</spring.validation.mode>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.apache.ws.commons.neethi</groupId>
Modified: incubator/cxf/trunk/rt/ws/rm/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/pom.xml?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/rm/pom.xml Thu May 17 02:38:18 2007
@@ -78,6 +78,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
@@ -139,7 +145,7 @@
</deleteDirs>
</xsdOption>
<xsdOption>
- <xsd>${basedir}/src/main/resources/schemas/configuration/wsrm-manager.xsd</xsd>
+ <xsd>${basedir}/src/main/resources/schemas/configuration/manager-types.xsd</xsd>
<bindingFile>${basedir}/src/main/resources/schemas/configuration/wsrm-policy.xjb</bindingFile>
<extension>true</extension>
<extensionArgs>
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/AbstractEndpoint.java Thu May 17 02:38:18 2007
@@ -19,8 +19,6 @@
package org.apache.cxf.ws.rm;
-import javax.xml.namespace.QName;
-
import org.apache.cxf.endpoint.Endpoint;
public class AbstractEndpoint {
@@ -31,7 +29,7 @@
reliableEndpoint = rme;
}
- public QName getName() {
+ public String getName() {
return reliableEndpoint.getName();
}
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java Thu May 17 02:38:18 2007
@@ -19,7 +19,6 @@
package org.apache.cxf.ws.rm;
-import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
@@ -93,18 +92,10 @@
}
/**
- * @return the sequence acknowledgement presenting the sequences thus far received by a destination
- * as an input stream
- */
- InputStream getAcknowledgmentAsStream() {
- return null;
- }
-
- /**
* @return the identifier of the rm destination
*/
public String getEndpointIdentifier() {
- return destination.getName().toString();
+ return destination.getName();
}
public void acknowledge(Message message) throws SequenceFault {
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Thu May 17 02:38:18 2007
@@ -19,6 +19,7 @@
package org.apache.cxf.ws.rm;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
@@ -96,8 +97,11 @@
servant = new Servant(this);
}
- public QName getName() {
- return applicationEndpoint.getEndpointInfo().getName();
+ public String getName() {
+ return MessageFormat.format("{0}.{1}", new Object[] {
+ applicationEndpoint.getEndpointInfo().getService().getName(),
+ applicationEndpoint.getEndpointInfo().getName()
+ });
}
/**
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Thu May 17 02:38:18 2007
@@ -45,7 +45,6 @@
import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType;
import org.apache.cxf.ws.rm.manager.DeliveryAssuranceType;
import org.apache.cxf.ws.rm.manager.DestinationPolicyType;
-import org.apache.cxf.ws.rm.manager.RMManagerConfigBean;
import org.apache.cxf.ws.rm.manager.SourcePolicyType;
import org.apache.cxf.ws.rm.persistence.RMStore;
import org.apache.cxf.ws.rm.policy.RMAssertion;
@@ -56,7 +55,7 @@
/**
*
*/
-public class RMManager extends RMManagerConfigBean {
+public class RMManager {
private static final Logger LOG = LogUtils.getL7dLogger(RMManager.class);
@@ -67,6 +66,11 @@
private Map<Endpoint, RMEndpoint> reliableEndpoints = new HashMap<Endpoint, RMEndpoint>();
private Timer timer = new Timer(true);
private final ServerLifeCycleListener serverLifeCycleListener;
+ private RMAssertion rmAssertion;
+ private DeliveryAssuranceType deliveryAssurance;
+ private SourcePolicyType sourcePolicy;
+ private DestinationPolicyType destinationPolicy;
+
public RMManager() {
serverLifeCycleListener = new ServerLifeCycleListener() {
@@ -260,23 +264,26 @@
RMEndpoint createReliableEndpoint(RMManager manager, Endpoint endpoint) {
return new RMEndpoint(manager, endpoint);
}
-
+
+ // configuration
+
+
@PostConstruct
void initialise() {
- if (!isSetRMAssertion()) {
+ if (null == rmAssertion) {
setRMAssertion(null);
}
org.apache.cxf.ws.rm.manager.ObjectFactory factory = new org.apache.cxf.ws.rm.manager.ObjectFactory();
- if (!isSetDeliveryAssurance()) {
+ if (null == deliveryAssurance) {
DeliveryAssuranceType da = factory.createDeliveryAssuranceType();
da.setAtLeastOnce(factory.createDeliveryAssuranceTypeAtLeastOnce());
setDeliveryAssurance(da);
}
- if (!isSetSourcePolicy()) {
+ if (null == sourcePolicy) {
setSourcePolicy(null);
}
- if (!isSetDestinationPolicy()) {
+ if (null == destinationPolicy) {
DestinationPolicyType dp = factory.createDestinationPolicyType();
dp.setAcksPolicy(factory.createAcksPolicyType());
setDestinationPolicy(dp);
@@ -289,9 +296,64 @@
}
}
- @Override
- public void setRMAssertion(RMAssertion rma) {
+
+ Map<Endpoint, RMEndpoint> getReliableEndpointsMap() {
+ return reliableEndpoints;
+ }
+
+ void setReliableEndpointsMap(Map<Endpoint, RMEndpoint> map) {
+ reliableEndpoints = map;
+ }
+
+ class DefaultSequenceIdentifierGenerator implements SequenceIdentifierGenerator {
+
+ public Identifier generateSequenceIdentifier() {
+ String sequenceID = RMContextUtils.generateUUID();
+ Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
+ sid.setValue(sequenceID);
+ return sid;
+ }
+ }
+
+ /**
+ * @return Returns the deliveryAssurance.
+ */
+ public DeliveryAssuranceType getDeliveryAssurance() {
+ return deliveryAssurance;
+ }
+
+ /**
+ * @param deliveryAssurance The deliveryAssurance to set.
+ */
+ public void setDeliveryAssurance(DeliveryAssuranceType deliveryAssurance) {
+ this.deliveryAssurance = deliveryAssurance;
+ }
+ /**
+ * @return Returns the destinationPolicy.
+ */
+ public DestinationPolicyType getDestinationPolicy() {
+ return destinationPolicy;
+ }
+
+ /**
+ * @param destinationPolicy The destinationPolicy to set.
+ */
+ public void setDestinationPolicy(DestinationPolicyType destinationPolicy) {
+ this.destinationPolicy = destinationPolicy;
+ }
+
+ /**
+ * @return Returns the rmAssertion.
+ */
+ public RMAssertion getRMAssertion() {
+ return rmAssertion;
+ }
+
+ /**
+ * @param rma The rmAssertion to set.
+ */
+ public void setRMAssertion(RMAssertion rma) {
org.apache.cxf.ws.rm.policy.ObjectFactory factory = new org.apache.cxf.ws.rm.policy.ObjectFactory();
if (null == rma) {
rma = factory.createRMAssertion();
@@ -306,11 +368,19 @@
bri.setMilliseconds(new BigInteger(RetransmissionQueue.DEFAULT_BASE_RETRANSMISSION_INTERVAL));
}
- super.setRMAssertion(rma);
+ rmAssertion = rma;
}
+ /**
+ * @return Returns the sourcePolicy.
+ */
+ public SourcePolicyType getSourcePolicy() {
+ return sourcePolicy;
+ }
- @Override
+ /**
+ * @param sp The sourcePolicy to set.
+ */
public void setSourcePolicy(SourcePolicyType sp) {
org.apache.cxf.ws.rm.manager.ObjectFactory factory = new org.apache.cxf.ws.rm.manager.ObjectFactory();
if (null == sp) {
@@ -319,25 +389,7 @@
if (!sp.isSetSequenceTerminationPolicy()) {
sp.setSequenceTerminationPolicy(factory.createSequenceTerminationPolicyType());
}
- super.setSourcePolicy(sp);
- }
-
- Map<Endpoint, RMEndpoint> getReliableEndpointsMap() {
- return reliableEndpoints;
- }
-
- void setReliableEndpointsMap(Map<Endpoint, RMEndpoint> map) {
- reliableEndpoints = map;
- }
-
- class DefaultSequenceIdentifierGenerator implements SequenceIdentifierGenerator {
-
- public Identifier generateSequenceIdentifier() {
- String sequenceID = RMContextUtils.generateUUID();
- Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
- sid.setValue(sequenceID);
- return sid;
- }
+ sourcePolicy = sp;
}
}
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java Thu May 17 02:38:18 2007
@@ -25,6 +25,8 @@
import org.apache.cxf.io.AbstractCachedOutputStream;
import org.apache.cxf.io.CachedOutputStreamCallback;
import org.apache.cxf.message.Message;
+import org.apache.cxf.ws.rm.persistence.RMMessage;
+import org.apache.cxf.ws.rm.persistence.RMStore;
/**
*
@@ -48,6 +50,18 @@
ByteArrayOutputStream bos = (ByteArrayOutputStream)os;
message.put(RMMessageConstants.SAVED_OUTPUT_STREAM, bos);
manager.getRetransmissionQueue().addUnacknowledged(message);
+
+ RMStore store = manager.getStore();
+ if (null != store) {
+ Source s = manager.getSource(message);
+ RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
+ Identifier sid = rmps.getSequence().getIdentifier();
+ SourceSequence ss = s.getSequence(sid);
+ RMMessage msg = new RMMessage();
+ msg.setMessageNumber(rmps.getSequence().getMessageNumber());
+ msg.setContent(bos.toByteArray());
+ store.persistOutgoing(ss, msg);
+ }
}
}
}
Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java?view=auto&rev=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java Thu May 17 02:38:18 2007
@@ -0,0 +1,105 @@
+/**
+ * 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.cxf.ws.rm.persistence;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.cxf.common.util.PackageUtils;
+import org.apache.cxf.ws.rm.SequenceAcknowledgement;
+
+/**
+ *
+ */
+public final class PersistenceUtils {
+
+ private static PersistenceUtils instance;
+ private JAXBContext context;
+ private Unmarshaller unmarshaller;
+ private Marshaller marshaller;
+
+
+ /**
+ * Prevents instantiation.
+ */
+ private PersistenceUtils() {
+ }
+
+ public static PersistenceUtils getInstance() {
+ if (null == instance) {
+ instance = new PersistenceUtils();
+ }
+ return instance;
+ }
+
+ public SequenceAcknowledgement deserialiseAcknowledgment(InputStream is) {
+ Object obj = null;
+ try {
+ obj = getUnmarshaller().unmarshal(is);
+ if (obj instanceof JAXBElement<?>) {
+ JAXBElement<?> el = (JAXBElement<?>)obj;
+ obj = el.getValue();
+ }
+ } catch (JAXBException ex) {
+ throw new RMStoreException(ex);
+ }
+ return (SequenceAcknowledgement)obj;
+ }
+
+ public InputStream serialiseAcknowledgment(SequenceAcknowledgement ack) {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ getMarshaller().marshal(ack, bos);
+ } catch (JAXBException ex) {
+ throw new RMStoreException(ex);
+ }
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ private JAXBContext getContext() throws JAXBException {
+ if (null == context) {
+ context = JAXBContext.newInstance(PackageUtils
+ .getPackageName(SequenceAcknowledgement.class),
+ getClass().getClassLoader());
+ }
+ return context;
+ }
+
+ private Unmarshaller getUnmarshaller() throws JAXBException {
+ if (null == unmarshaller) {
+ unmarshaller = getContext().createUnmarshaller();
+ }
+ return unmarshaller;
+ }
+
+ private Marshaller getMarshaller() throws JAXBException {
+ if (null == marshaller) {
+ marshaller = getContext().createMarshaller();
+ }
+ return marshaller;
+ }
+}
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java Thu May 17 02:38:18 2007
@@ -18,27 +18,53 @@
*/
package org.apache.cxf.ws.rm.persistence;
-import java.io.InputStream;
import java.math.BigInteger;
-import javax.xml.ws.handler.MessageContext;
-
-public interface RMMessage {
+public class RMMessage {
+
+ private byte[] content;
+ private BigInteger messageNumber;
/**
- * @return the message number of the message within its sequence.
+ * Returns the message number of the message within its sequence.
+ * @return the message number
*/
- BigInteger getMessageNr();
+ public BigInteger getMessageNumber() {
+ return messageNumber;
+ }
/**
- * @return the message context of this message.
+ * Sets the message number of the message within its sequence.
+ * @param messageNumber the message number
*/
- MessageContext getContext();
+ public void setMessageNumber(BigInteger mn) {
+ messageNumber = mn;
+ }
+
+
+ /**
+ * Returns the content of the message as an input stream.
+ * @return the content
+ */
+ public byte[] getContent() {
+ return content;
+ }
+
/**
- * @return the message context of this message as an input stream.
+ * Sets the message content as an input stream.
+ * @param content the message content
*/
- InputStream getContextAsStream();
+ public void setContent(byte[] c) {
+ content = c;
+ }
+
+
+
+
+
+
+
}
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStore.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStore.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStore.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStore.java Thu May 17 02:38:18 2007
@@ -21,19 +21,13 @@
import java.math.BigInteger;
import java.util.Collection;
-import java.util.Map;
import org.apache.cxf.ws.rm.DestinationSequence;
import org.apache.cxf.ws.rm.Identifier;
import org.apache.cxf.ws.rm.SourceSequence;
public interface RMStore {
-
- /**
- * Initialises the store.
- * @param params the store initialisation parameters
- */
- void init(Map<String, String> params);
+
/**
* Create a source sequence in the persistent store, with the sequence attributes as specified in the
Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStoreException.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStoreException.java?view=auto&rev=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStoreException.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStoreException.java Thu May 17 02:38:18 2007
@@ -0,0 +1,42 @@
+/**
+ * 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.cxf.ws.rm.persistence;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.i18n.UncheckedException;
+
+/**
+ * RMStoreException is the type of RuntimeException thrown by the RMStore
+ * when encountering problems.
+ */
+public class RMStoreException extends UncheckedException {
+
+ public RMStoreException(Message msg, Throwable t) {
+ super(msg, t);
+ }
+
+ public RMStoreException(Message msg) {
+ super(msg);
+ }
+
+ public RMStoreException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStoreException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMStoreException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/Messages.properties?view=auto&rev=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/Messages.properties (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/Messages.properties Thu May 17 02:38:18 2007
@@ -0,0 +1,4 @@
+CONNECT_EXC = Failed to connect to store.
+ABORT_FAILED_MSG = Failed to abort transaction.
+SELECT_DEST_SEQ_FAILED_MSG = Failed to retrieve destination sequences from persistent store.
+SELECT_SRC_SEQ_FAILED_MSG = Failed to retrieve source sequences from persistent store.
\ No newline at end of file
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/Messages.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/Messages.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/Messages.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?view=auto&rev=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java Thu May 17 02:38:18 2007
@@ -0,0 +1,621 @@
+/**
+ * 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.cxf.ws.rm.persistence.jdbc;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Blob;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType;
+import org.apache.cxf.ws.rm.DestinationSequence;
+import org.apache.cxf.ws.rm.Identifier;
+import org.apache.cxf.ws.rm.RMUtils;
+import org.apache.cxf.ws.rm.SequenceAcknowledgement;
+import org.apache.cxf.ws.rm.SourceSequence;
+import org.apache.cxf.ws.rm.persistence.PersistenceUtils;
+import org.apache.cxf.ws.rm.persistence.RMMessage;
+import org.apache.cxf.ws.rm.persistence.RMStore;
+import org.apache.cxf.ws.rm.persistence.RMStoreException;
+
+
+public class RMTxStore implements RMStore {
+
+ public static final String DEFAULT_DATABASE_DIR = "rmdb";
+
+ private static final String CREATE_DEST_SEQUENCES_TABLE_STMT =
+ "CREATE TABLE CXF_RM_DEST_SEQUENCES "
+ + "(SEQ_ID VARCHAR(256) NOT NULL, "
+ + "ACKS_TO VARCHAR(1024) NOT NULL, "
+ + "LAST_MSG_NO DECIMAL(31, 0), "
+ + "ENDPOINT_ID VARCHAR(1024), "
+ + "ACKNOWLEDGED BLOB, "
+ + "PRIMARY KEY (SEQ_ID))";
+ private static final String CREATE_SRC_SEQUENCES_TABLE_STMT =
+ "CREATE TABLE CXF_RM_SRC_SEQUENCES "
+ + "(SEQ_ID VARCHAR(256) NOT NULL, "
+ + "CUR_MSG_NO DECIMAL(31, 0) NOT NULL DEFAULT 1, "
+ + "LAST_MSG CHAR(1), "
+ + "EXPIRY BIGINT, "
+ + "OFFERING_SEQ_ID VARCHAR(256), "
+ + "ENDPOINT_ID VARCHAR(1024), "
+ + "PRIMARY KEY (SEQ_ID))";
+ private static final String CREATE_MESSAGES_TABLE_STMT =
+ "CREATE TABLE {0} "
+ + "(SEQ_ID VARCHAR(256) NOT NULL, "
+ + "MSG_NO DECIMAL(31, 0) NOT NULL, "
+ + "CONTENT BLOB, "
+ + "PRIMARY KEY (SEQ_ID, MSG_NO))";
+ private static final String INBOUND_MSGS_TABLE_NAME = "CXF_RM_INBOUND_MESSAGES";
+ private static final String OUTBOUND_MSGS_TABLE_NAME = "CXF_RM_OUTBOUND_MESSAGES";
+
+
+ private static final String CREATE_DEST_SEQUENCE_STMT_STR
+ = "INSERT INTO CXF_RM_DEST_SEQUENCES (SEQ_ID, ACKS_TO, ENDPOINT_ID) VALUES(?, ?, ?)";
+ private static final String CREATE_SRC_SEQUENCE_STMT_STR
+ = "INSERT INTO CXF_RM_SRC_SEQUENCES VALUES(?, 1, '0', ?, ?, ?)";
+ private static final String DELETE_DEST_SEQUENCE_STMT_STR =
+ "DELETE FROM CXF_RM_DEST_SEQUENCES WHERE SEQ_ID = ?";
+ private static final String DELETE_SRC_SEQUENCE_STMT_STR =
+ "DELETE FROM CXF_RM_SRC_SEQUENCES WHERE SEQ_ID = ?";
+ private static final String UPDATE_DEST_SEQUENCE_STMT_STR =
+ "UPDATE CXF_RM_DEST_SEQUENCES SET LAST_MSG_NO = ?, ACKNOWLEDGED = ? WHERE SEQ_ID = ?";
+ private static final String UPDATE_SRC_SEQUENCE_STMT_STR =
+ "UPDATE CXF_RM_SRC_SEQUENCES SET CUR_MSG_NO = ?, LAST_MSG = ? WHERE SEQ_ID = ?";
+ private static final String CREATE_MESSAGE_STMT_STR
+ = "INSERT INTO {0} VALUES(?, ?, ?)";
+ private static final String DELETE_MESSAGE_STMT_STR =
+ "DELETE FROM {0} WHERE SEQ_ID = ? AND MSG_NO = ?";
+ private static final String SELECT_DEST_SEQUENCES_STMT_STR =
+ "SELECT SEQ_ID, ACKS_TO, LAST_MSG_NO, ACKNOWLEDGED FROM CXF_RM_DEST_SEQUENCES "
+ + "WHERE ENDPOINT_ID = ?";
+ private static final String SELECT_SRC_SEQUENCES_STMT_STR =
+ "SELECT SEQ_ID, CUR_MSG_NO, LAST_MSG, EXPIRY, OFFERING_SEQ_ID FROM CXF_RM_SRC_SEQUENCES "
+ + "WHERE ENDPOINT_ID = ?";
+ private static final String SELECT_MESSAGES_STMT_STR =
+ "SELECT MSG_NO, CONTENT FROM {0} WHERE SEQ_ID = ?";
+
+ private static final Logger LOG = LogUtils.getL7dLogger(RMTxStore.class);
+
+ private Connection connection;
+
+ private PreparedStatement createDestSequenceStmt;
+ private PreparedStatement createSrcSequenceStmt;
+ private PreparedStatement deleteDestSequenceStmt;
+ private PreparedStatement deleteSrcSequenceStmt;
+ private PreparedStatement updateDestSequenceStmt;
+ private PreparedStatement updateSrcSequenceStmt;
+ private PreparedStatement selectDestSequencesStmt;
+ private PreparedStatement selectSrcSequencesStmt;
+ private PreparedStatement createInboundMessageStmt;
+ private PreparedStatement createOutboundMessageStmt;
+ private PreparedStatement deleteInboundMessageStmt;
+ private PreparedStatement deleteOutboundMessageStmt;
+ private PreparedStatement selectInboundMessagesStmt;
+ private PreparedStatement selectOutboundMessagesStmt;
+
+ private String driverClassName = "org.apache.derby.jdbc.EmbeddedDriver";
+ private String url = MessageFormat.format("jdbc:derby:{0};create=true", DEFAULT_DATABASE_DIR);
+ private String userName;
+ private String password;
+
+ // configuration
+
+ public void setDriverClassName(String dcn) {
+ driverClassName = dcn;
+ }
+
+ public void setPassword(String p) {
+ password = p;
+ }
+
+ public void setUrl(String u) {
+ url = u;
+ }
+
+ public void setUserName(String un) {
+ userName = un;
+ }
+
+ public void setConnection(Connection c) {
+ connection = c;
+ }
+
+ // RMStore interface
+
+ public void createDestinationSequence(DestinationSequence seq) {
+ String sequenceIdentifier = seq.getIdentifier().getValue();
+ String endpointIdentifier = seq.getEndpointIdentifier();
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.info("Creating destination sequence: " + sequenceIdentifier + ", (endpoint: "
+ + endpointIdentifier + ")");
+ }
+ try {
+ beginTransaction();
+
+ if (null == createDestSequenceStmt) {
+ createDestSequenceStmt = connection.prepareStatement(CREATE_DEST_SEQUENCE_STMT_STR);
+ }
+ createDestSequenceStmt.setString(1, sequenceIdentifier);
+ String addr = seq.getAcksTo().getAddress().getValue();
+ createDestSequenceStmt.setString(2, addr);
+ createDestSequenceStmt.setString(3, endpointIdentifier);
+
+ createDestSequenceStmt.execute();
+
+ commit();
+
+ } catch (SQLException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ }
+ }
+
+ public void createSourceSequence(SourceSequence seq) {
+ String sequenceIdentifier = seq.getIdentifier().getValue();
+ String endpointIdentifier = seq.getEndpointIdentifier();
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Creating source sequence: " + sequenceIdentifier + ", (endpoint: "
+ + endpointIdentifier + ")");
+ }
+
+ try {
+ beginTransaction();
+
+ if (null == createSrcSequenceStmt) {
+ createSrcSequenceStmt = connection.prepareStatement(CREATE_SRC_SEQUENCE_STMT_STR);
+ }
+ assert null != createSrcSequenceStmt;
+ createSrcSequenceStmt.setString(1, sequenceIdentifier);
+ Date expiry = seq.getExpires();
+ createSrcSequenceStmt.setLong(2, expiry == null ? 0 : expiry.getTime());
+ Identifier osid = seq.getOfferingSequenceIdentifier();
+ createSrcSequenceStmt.setString(3, osid == null ? null : osid.getValue());
+ createSrcSequenceStmt.setString(4, endpointIdentifier);
+ createSrcSequenceStmt.execute();
+
+ commit();
+
+ } catch (SQLException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ }
+ }
+
+ public void removeDestinationSequence(Identifier sid) {
+ try {
+ beginTransaction();
+
+ if (null == deleteDestSequenceStmt) {
+ deleteDestSequenceStmt = connection.prepareStatement(DELETE_DEST_SEQUENCE_STMT_STR);
+ }
+ deleteDestSequenceStmt.setString(1, sid.getValue());
+ deleteDestSequenceStmt.execute();
+
+ commit();
+
+ } catch (SQLException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ }
+ }
+
+
+ public void removeSourceSequence(Identifier sid) {
+ try {
+ beginTransaction();
+
+ if (null == deleteSrcSequenceStmt) {
+ deleteSrcSequenceStmt = connection.prepareStatement(DELETE_SRC_SEQUENCE_STMT_STR);
+ }
+ deleteSrcSequenceStmt.setString(1, sid.getValue());
+ deleteSrcSequenceStmt.execute();
+
+ commit();
+
+ } catch (SQLException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ }
+ }
+
+ public Collection<DestinationSequence> getDestinationSequences(String endpointIdentifier) {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.info("Getting destination sequences for endpoint: " + endpointIdentifier);
+ }
+ Collection<DestinationSequence> seqs = new ArrayList<DestinationSequence>();
+ try {
+ if (null == selectDestSequencesStmt) {
+ selectDestSequencesStmt =
+ connection.prepareStatement(SELECT_DEST_SEQUENCES_STMT_STR);
+ }
+ selectDestSequencesStmt.setString(1, endpointIdentifier);
+
+ ResultSet res = selectDestSequencesStmt.executeQuery();
+ while (res.next()) {
+ Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
+ sid.setValue(res.getString(1));
+ EndpointReferenceType acksTo = RMUtils.createReference2004(res.getString(2));
+ BigDecimal lm = res.getBigDecimal(3);
+ InputStream is = res.getBinaryStream(4);
+ SequenceAcknowledgement ack = null;
+ if (null != is) {
+ ack = PersistenceUtils.getInstance()
+ .deserialiseAcknowledgment(is);
+ }
+ DestinationSequence seq = new DestinationSequence(sid, acksTo,
+ lm == null ? null : lm.toBigInteger(), ack);
+ seqs.add(seq);
+ }
+ } catch (SQLException ex) {
+ LOG.log(Level.WARNING, new Message("SELECT_DEST_SEQ_FAILED_MSG", LOG).toString(), ex);
+ }
+ return seqs;
+ }
+
+ public Collection<SourceSequence> getSourceSequences(String endpointIdentifier) {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.info("Getting source sequences for endpoint: " + endpointIdentifier);
+ }
+ Collection<SourceSequence> seqs = new ArrayList<SourceSequence>();
+ try {
+ if (null == selectSrcSequencesStmt) {
+ selectSrcSequencesStmt =
+ connection.prepareStatement(SELECT_SRC_SEQUENCES_STMT_STR);
+ }
+ selectSrcSequencesStmt.setString(1, endpointIdentifier);
+ ResultSet res = selectSrcSequencesStmt.executeQuery();
+
+ while (res.next()) {
+ Identifier sid = RMUtils.getWSRMFactory().createIdentifier();
+ sid.setValue(res.getString(1));
+ BigInteger cmn = res.getBigDecimal(2).toBigInteger();
+ boolean lm = res.getBoolean(3);
+ long lval = res.getLong(4);
+ Date expiry = 0 == lval ? null : new Date(lval);
+ String oidValue = res.getString(5);
+ Identifier oi = null;
+ if (null != oidValue) {
+ oi = RMUtils.getWSRMFactory().createIdentifier();
+ oi.setValue(oidValue);
+ }
+ SourceSequence seq = new SourceSequence(sid, expiry, oi, cmn, lm);
+ seqs.add(seq);
+ }
+ } catch (SQLException ex) {
+ // ignore
+ LOG.log(Level.WARNING, new Message("SELECT_SRC_SEQ_FAILED_MSG", LOG).toString(), ex);
+ }
+ return seqs;
+ }
+
+ public Collection<RMMessage> getMessages(Identifier sid, boolean outbound) {
+ Collection<RMMessage> msgs = new ArrayList<RMMessage>();
+ try {
+ PreparedStatement stmt = outbound ? selectOutboundMessagesStmt : selectInboundMessagesStmt;
+ if (null == stmt) {
+ stmt = connection.prepareStatement(MessageFormat.format(SELECT_MESSAGES_STMT_STR,
+ outbound ? OUTBOUND_MSGS_TABLE_NAME : INBOUND_MSGS_TABLE_NAME));
+ if (outbound) {
+ selectOutboundMessagesStmt = stmt;
+ } else {
+ selectInboundMessagesStmt = stmt;
+ }
+ }
+ stmt.setString(1, sid.getValue());
+ ResultSet res = stmt.executeQuery();
+ while (res.next()) {
+ BigInteger mn = res.getBigDecimal(1).toBigInteger();
+ Blob blob = res.getBlob(2);
+ byte[] bytes = blob.getBytes(1, (int)blob.length());
+ RMMessage msg = new RMMessage();
+ msg.setMessageNumber(mn);
+ msg.setContent(bytes);
+ msgs.add(msg);
+ }
+ } catch (SQLException ex) {
+ LOG.log(Level.WARNING, new Message(outbound ? "SELECT_OUTBOUND_MSGS_FAILED_MSG"
+ : "SELECT_INBOUND_MSGS_FAILED_MSG", LOG).toString(), ex);
+ }
+ return msgs;
+ }
+
+ public void persistIncoming(DestinationSequence seq, RMMessage msg) {
+ try {
+ beginTransaction();
+
+ updateDestinationSequence(seq);
+
+ storeMessage(seq.getIdentifier(), msg, false);
+
+ commit();
+
+ } catch (SQLException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ } catch (IOException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ }
+ }
+ public void persistOutgoing(SourceSequence seq, RMMessage msg) {
+ try {
+ beginTransaction();
+
+ updateSourceSequence(seq);
+
+ storeMessage(seq.getIdentifier(), msg, true);
+
+ commit();
+
+ } catch (SQLException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ } catch (IOException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ }
+ }
+
+ public void removeMessages(Identifier sid, Collection<BigInteger> messageNrs, boolean outbound) {
+ try {
+ beginTransaction();
+ PreparedStatement stmt = outbound ? deleteOutboundMessageStmt : deleteInboundMessageStmt;
+ if (null == stmt) {
+ stmt = connection.prepareStatement(MessageFormat.format(DELETE_MESSAGE_STMT_STR,
+ outbound ? OUTBOUND_MSGS_TABLE_NAME : INBOUND_MSGS_TABLE_NAME));
+ if (outbound) {
+ deleteOutboundMessageStmt = stmt;
+ } else {
+ deleteInboundMessageStmt = stmt;
+ }
+ }
+
+ stmt.setString(1, sid.getValue());
+
+ for (BigInteger messageNr : messageNrs) {
+ stmt.setBigDecimal(2, new BigDecimal(messageNr));
+ stmt.execute();
+ }
+
+ commit();
+
+ } catch (SQLException ex) {
+ abort();
+ throw new RMStoreException(ex);
+ }
+ }
+
+ // transaction demarcation
+
+ protected void beginTransaction() {
+ // no-op
+ }
+
+ protected void commit() throws SQLException {
+ connection.commit();
+ }
+
+ protected void abort() {
+ try {
+ connection.rollback();
+ } catch (SQLException ex) {
+ LogUtils.log(LOG, Level.SEVERE, "ABORT_FAILED_MSG", ex);
+ }
+ }
+
+ // helpers
+
+ protected void storeMessage(Identifier sid, RMMessage msg, boolean outbound)
+ throws IOException, SQLException {
+ String id = sid.getValue();
+ BigInteger nr = msg.getMessageNumber();
+ LOG.log(Level.FINE, "Storing {0} message number {1} for sequence {2}",
+ new Object[] {outbound ? "outbound" : "inbound", nr, id});
+ PreparedStatement stmt = outbound ? createOutboundMessageStmt : createInboundMessageStmt;
+ if (null == stmt) {
+ stmt = connection.prepareStatement(MessageFormat.format(CREATE_MESSAGE_STMT_STR,
+ outbound ? OUTBOUND_MSGS_TABLE_NAME : INBOUND_MSGS_TABLE_NAME));
+ if (outbound) {
+ createOutboundMessageStmt = stmt;
+ } else {
+ createInboundMessageStmt = stmt;
+ }
+ }
+
+ int i = 1;
+ stmt.setString(i++, id);
+ stmt.setBigDecimal(i++, new BigDecimal(nr));
+ byte[] bytes = msg.getContent();
+ stmt.setBinaryStream(i++, new ByteArrayInputStream(bytes), bytes.length);
+
+ stmt.execute();
+ }
+
+ protected void updateSourceSequence(SourceSequence seq)
+ throws SQLException {
+ if (null == updateSrcSequenceStmt) {
+ updateSrcSequenceStmt = connection.prepareStatement(UPDATE_SRC_SEQUENCE_STMT_STR);
+ }
+ updateSrcSequenceStmt.setBigDecimal(1, new BigDecimal(seq.getCurrentMessageNr()));
+ updateSrcSequenceStmt.setBoolean(2, seq.isLastMessage());
+ updateSrcSequenceStmt.setString(3, seq.getIdentifier().getValue());
+ updateSrcSequenceStmt.execute();
+ }
+
+ protected void updateDestinationSequence(DestinationSequence seq)
+ throws SQLException, IOException {
+ if (null == updateDestSequenceStmt) {
+ updateDestSequenceStmt = connection.prepareStatement(UPDATE_DEST_SEQUENCE_STMT_STR);
+ }
+ BigInteger lastMessageNr = seq.getLastMessageNumber();
+ updateDestSequenceStmt.setBigDecimal(1, lastMessageNr == null ? null
+ : new BigDecimal(lastMessageNr));
+ InputStream is = PersistenceUtils.getInstance()
+ .serialiseAcknowledgment(seq.getAcknowledgment());
+ updateDestSequenceStmt.setBinaryStream(2, is, is.available());
+ updateDestSequenceStmt.setString(3, seq.getIdentifier() .getValue());
+ updateDestSequenceStmt.execute();
+ }
+
+ protected void createTables() throws SQLException {
+
+ Statement stmt = null;
+ stmt = connection.createStatement();
+ try {
+ stmt.executeUpdate(CREATE_SRC_SEQUENCES_TABLE_STMT);
+ } catch (SQLException ex) {
+ if (!"X0Y32".equals(ex.getSQLState())) {
+ throw ex;
+ } else {
+ LOG.fine("Table CXF_RM_SRC_SEQUENCES already exists.");
+ }
+ }
+ stmt.close();
+
+ stmt = connection.createStatement();
+ try {
+ stmt.executeUpdate(CREATE_DEST_SEQUENCES_TABLE_STMT);
+ } catch (SQLException ex) {
+ if (!"X0Y32".equals(ex.getSQLState())) {
+ throw ex;
+ } else {
+ LOG.fine("Table CXF_RM_DEST_SEQUENCES already exists.");
+ }
+ }
+ stmt.close();
+
+ for (String tableName : new String[] {OUTBOUND_MSGS_TABLE_NAME, INBOUND_MSGS_TABLE_NAME}) {
+ stmt = connection.createStatement();
+ try {
+ stmt.executeUpdate(MessageFormat.format(CREATE_MESSAGES_TABLE_STMT, tableName));
+ } catch (SQLException ex) {
+ if (!"X0Y32".equals(ex.getSQLState())) {
+ throw ex;
+ } else {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Table " + tableName + " already exists.");
+ }
+ }
+ }
+ stmt.close();
+ }
+ }
+
+ @PostConstruct
+ synchronized void init() {
+
+ if (null == connection) {
+
+ assert null != url;
+ assert null != driverClassName;
+ try {
+ Class.forName(driverClassName);
+ } catch (ClassNotFoundException ex) {
+ LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", ex);
+ }
+
+ try {
+ connection = DriverManager.getConnection(url, userName, password);
+
+ } catch (SQLException ex) {
+ LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", ex);
+ }
+ }
+
+ try {
+ connection.setAutoCommit(false);
+ createTables();
+ } catch (SQLException ex) {
+ LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", ex);
+ }
+ }
+
+ Connection getConnection() {
+ return connection;
+ }
+
+ public static void deleteDatabaseFiles() {
+ deleteDatabaseFiles(DEFAULT_DATABASE_DIR, true);
+ }
+
+ public static void deleteDatabaseFiles(String path, boolean now) {
+ File root = null;
+ String dsh = System.getProperty("derby.system.home");
+ if (null == dsh) {
+ File log = new File("derby.log");
+ if (log.exists()) {
+ if (now) {
+ log.delete();
+ } else {
+ log.deleteOnExit();
+ }
+ }
+ root = new File(path);
+ } else {
+ root = new File(dsh);
+ }
+ if (root.exists()) {
+ recursiveDelete(root, now);
+ }
+
+ }
+
+ private static void recursiveDelete(File dir, boolean now) {
+ for (File f : dir.listFiles()) {
+ if (f.isDirectory()) {
+ recursiveDelete(f, now);
+ } else {
+ if (now) {
+ f.delete();
+ } else {
+ f.deleteOnExit();
+ }
+ }
+ }
+ if (now) {
+ dir.delete();
+ } else {
+ dir.deleteOnExit();
+ }
+ }
+
+
+
+}
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMManagerBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMManagerBeanDefinitionParser.java?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMManagerBeanDefinitionParser.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/spring/RMManagerBeanDefinitionParser.java Thu May 17 02:38:18 2007
@@ -24,6 +24,7 @@
import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
import org.apache.cxf.ws.rm.RMManager;
+import org.apache.cxf.ws.rm.policy.RMAssertion;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
@@ -41,7 +42,12 @@
mapElementToJaxbProperty(element, bean,
new QName(RM_NS, "destinationPolicy"), "destinationPolicy");
mapElementToJaxbProperty(element, bean,
- new QName("http://schemas.xmlsoap.org/ws/2005/02/rm/policy", "RMAssertion"), "RMAssertion");
+ new QName("http://schemas.xmlsoap.org/ws/2005/02/rm/policy", "RMAssertion"),
+ "RMAssertion",
+ null,
+ RMAssertion.class.getPackage().getName());
+
+ ctx.getDelegate().parsePropertyElements(element, bean.getBeanDefinition());
String bus = element.getAttribute("bus");
if (bus == null || "".equals(bus) && ctx.getRegistry().containsBeanDefinition("cxf")) {
Modified: incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/spring.schemas?view=diff&rev=538850&r1=538849&r2=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/spring.schemas (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/spring.schemas Thu May 17 02:38:18 2007
@@ -1 +1,3 @@
-http\://cxf.apache.org/ws/rm/manager.xsd=schemas/configuration/wsrm-manager.xsd
\ No newline at end of file
+http\://cxf.apache.org/ws/rm/manager-types.xsd=schemas/configuration/manager-types.xsd
+http\://cxf.apache.org/ws/rm/manager.xsd=schemas/configuration/manager.xsd
+http\://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd=schemas/configuration/wsrm-policy.xsd
\ No newline at end of file
Added: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager-types.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager-types.xsd?view=auto&rev=538850
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager-types.xsd (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager-types.xsd Thu May 17 02:38:18 2007
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<xs:schema targetNamespace="http://cxf.apache.org/ws/rm/manager"
+ xmlns:tns="http://cxf.apache.org/ws/rm/manager"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ jaxb:version="2.0">
+
+ <xs:import namespace="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" schemaLocation="wsrm-policy.xsd"/>
+
+ <xs:complexType name="SourcePolicyType">
+ <xs:annotation>
+ <xs:documentation>RM source configuration properties.
+ Used for configuring an RM source.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:sequence>
+ <xs:element name="sequenceTerminationPolicy" type="tns:SequenceTerminationPolicyType" minOccurs="0"/>
+ </xs:sequence>
+
+ <xs:attribute name="sequenceExpiration" type="xs:duration" use="optional" default="PT0S">
+ <xs:annotation>
+ <xs:documentation>
+ Preferred lifetime of a sequence - included in createSequence
+ requests issued by an RM source.
+ A default of PT0S means that the sequence should never expire.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="acksTo" type="xs:string" use="optional">
+ <xs:annotation>
+ <xs:documentation>
+ Address to which sequence acknowledgements should be sent.
+ If this attribute is not set, defaults to the anonymous address.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="includeOffer" type="xs:boolean" use="optional" default="true">
+ <xs:annotation>
+ <xs:documentation>
+ Indicates if an RM source should include an offer for an inbound sequence
+ when issuing a createSequence request.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="offeredSequenceExpiration" type="xs:duration" use="optional" default="PT0S">
+ <xs:annotation>
+ <xs:documentation>
+ The lifetime of an offered inbound sequence.
+ A default of PT0S means that the sequence never expires.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:complexType name="DestinationPolicyType">
+ <xs:annotation>
+ <xs:documentation>RM destination configuration properties.
+ Used for configuring an RM destination.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:sequence>
+ <xs:element name="acksPolicy" type="tns:AcksPolicyType" minOccurs="0"/>
+ </xs:sequence>
+
+ <xs:attribute name="sequenceExpiration" type="xs:duration" use="optional" default="PT0S">
+ <xs:annotation>
+ <xs:documentation>
+ Preferred lifetime of a sequence - can be lower than the duration
+ requested by the RM source in a CreateSequence request.
+ A default of PT0S means that the sequence should never expire.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="acceptOffers" type="xs:boolean" use="optional" default="true">
+ <xs:annotation>
+ <xs:documentation>
+ Indicates if an RM destination should accept inbound sequence offers.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ </xs:complexType>
+
+ <xs:complexType name="SequenceTerminationPolicyType">
+ <xs:attribute name="maxLength" type="xs:unsignedLong" use="optional" default="0">
+ <xs:annotation>
+ <xs:documentation>
+ The maximum length of a sequence.
+ A value of 0 means the sequence length is unbound.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxRanges" type="xs:int" use="optional" default="0">
+ <xs:annotation>
+ <xs:documentation>
+ The maximum number of acknowledgment ranges tolerated in sequence
+ acknowledgment. When this value is exceeded the sequence
+ will be terminated.
+ A value of 0 means sequence termination does not depend on
+ the number of acknowledgment ranges.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxUnacknowledged" type="xs:int" use="optional" default="0">
+ <xs:annotation>
+ <xs:documentation>
+ The maximum number of unacknowledged messages that can accrue within per
+ sequence before the sequence is terminated.
+ A value of 0 means sequence termination does not depend on
+ the number of unacknowledgment messages.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="terminateOnShutdown" type="xs:boolean" use ="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Specifies if sequences should be terminated when the bus is shutdown.
+ If set to true, and no last message had been sent for a sequence,
+ an out of band LastMessage will be issued (in response to which
+ a sequence acknowledgment will be sent). If a last message had already been
+ sent, an acknowledgment is requested instead.
+ If, after processing these acknowledgement, all messages have been acknowledged,
+ an attempt is then made to terminates these sequences.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:complexType name="AcksPolicyType">
+ <xs:attribute name="intraMessageThreshold" type="xs:int" use="optional" default="10">
+ <xs:annotation>
+ <xs:documentation>
+ Restricts the deferred sending of acknowledgments to the case where the stream of incoming
+ messages is steady, i.e. the number of messages for one destination per minute stays above the
+ specified threshold (only effective if the AcknowledgmentInterval specified in the
+ RMAssertion is greater 0).
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:complexType name="DeliveryAssuranceType">
+ <xs:sequence>
+ <xs:element name="AtMostOnce" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="AtLeastOnce" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="InOrder" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+
+ <xs:element name="deliveryAssurance" type="tns:DeliveryAssuranceType"/>
+ <xs:element name="sourcePolicy" type="tns:SourcePolicyType"/>
+ <xs:element name="destinationPolicy" type="tns:DestinationPolicyType"/>
+
+ <!--
+ <xs:complexType name="RMManagerConfigBean">
+ <xs:sequence>
+ <xs:element ref="wsrmp:RMAssertion" minOccurs="0"/>
+ <xs:element ref="tns:deliveryAssurance" minOccurs="0"/>
+ <xs:element ref="tns:sourcePolicy" minOccurs="0"/>
+ <xs:element ref="tns:destinationPolicy" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="rmManager" type="tns:RMManagerConfigBean"/>
+ -->
+ </xs:schema>
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager-types.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager-types.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/resources/schemas/configuration/manager-types.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml