Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9921E97CE for ; Fri, 6 Apr 2012 16:21:43 +0000 (UTC) Received: (qmail 87123 invoked by uid 500); 6 Apr 2012 16:21:43 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 86978 invoked by uid 500); 6 Apr 2012 16:21:43 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 86959 invoked by uid 99); 6 Apr 2012 16:21:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2012 16:21:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2012 16:21:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 940292388BFF; Fri, 6 Apr 2012 16:21:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1310446 [3/4] - in /cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/wsdl/extensions/ rt/core/src/main/java/org/apache/cxf/bus/extension/ rt/core/src/main/java/org/apache/cxf/bus/osgi/ rt/core/src/main/java/org/apache/... Date: Fri, 06 Apr 2012 16:21:15 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120406162117.940292388BFF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java (original) +++ cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java Fri Apr 6 16:21:14 2012 @@ -1,222 +1,222 @@ -/** - * 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.clustering; - -import java.util.List; -import java.util.logging.Logger; -import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.endpoint.Endpoint; -import org.apache.cxf.message.Exchange; -import org.apache.cxf.message.Message; -import org.apache.cxf.transport.Conduit; - -/** - * - * @author jtalbut - * - * The LoadDistributorTargetSelector attempts to do the same job as the - * FailoverTargetSelector, but to choose an alternate target on every request - * rather than just when a fault occurs. - * The LoadDistributorTargetSelector uses the same FailoverStrategy interface as - * the FailoverTargetSelector, but has a few significant limitations: - * 1. Because the LoadDistributorTargetSelector needs to maintain a list of targets - * between calls it has to obtain that list without reference to a Message. - * Most FailoverStrategy classes can support this for addresses, but it cannot - * be supported for endpoints. - * If the list of targets cannot be obtained without reference to a Message then - * the list will still be obtained but it will be specific to the Message and thus - * discarded after this message has been processed. As a consequence, if the - * strategy chosen is a simple sequential one the first item in the list will - * be chosen every time. - * Conclusion: Be aware that if you are working with targets that are - * dependent on the Message the process will be less efficient and that the - * SequentialStrategy will not distribute the load at all. - * 2. The AbstractStaticFailoverStrategy base class excludes the 'default' endpoint - * from the list of alternate endpoints. - * If alternate endpoints (as opposed to alternate addresses) are to be used - * you should probably ensure that your FailoverStrategy overrides getAlternateEndpoints - * and calls getEndpoints with acceptCandidatesWithSameAddress = true. - */ -public class LoadDistributorTargetSelector extends FailoverTargetSelector { - private static final Logger LOG = LogUtils.getL7dLogger( - LoadDistributorTargetSelector.class); - private static final String IS_DISTRIBUTED = - "org.apache.cxf.clustering.LoadDistributorTargetSelector.IS_DISTRIBUTED"; - - private List addressList; - - private boolean failover = true; - - /** - * Normal constructor. - */ - public LoadDistributorTargetSelector() { - super(); - } - - /** - * Constructor, allowing a specific conduit to override normal selection. - * - * @param c specific conduit - */ - public LoadDistributorTargetSelector(Conduit c) { - super(c); - } - - public boolean isFailover() { - return failover; - } - - public void setFailover(boolean failover) { - this.failover = failover; - } - - @Override - protected java.util.logging.Logger getLogger() { - return LOG; - } - - /** - * Called when a Conduit is actually required. - * - * @param message - * @return the Conduit to use for mediation of the message - */ - public synchronized Conduit selectConduit(Message message) { - Conduit c = message.get(Conduit.class); - if (c != null) { - return c; - } - Exchange exchange = message.getExchange(); - InvocationKey key = new InvocationKey(exchange); - InvocationContext invocation = inProgress.get(key); - if ((invocation != null) && !invocation.getContext().containsKey(IS_DISTRIBUTED)) { - Endpoint target = getDistributionTarget(exchange, invocation); - if (target != null) { - setEndpoint(target); - message.put(Message.ENDPOINT_ADDRESS, target.getEndpointInfo().getAddress()); - message.put(CONDUIT_COMPARE_FULL_URL, Boolean.TRUE); - overrideAddressProperty(invocation.getContext()); - invocation.getContext().put(IS_DISTRIBUTED, null); - } - } - return getSelectedConduit(message); - } - - /** - * Get the failover target endpoint, if a suitable one is available. - * - * @param exchange the current Exchange - * @param invocation the current InvocationContext - * @return a failover endpoint if one is available - * - * Note: The only difference between this and the super implementation is - * that the current (failed) address is removed from the list set of alternates, - * it could be argued that that change should be in the super implementation - * but I'm not sure of the impact. - */ - protected Endpoint getFailoverTarget(Exchange exchange, - InvocationContext invocation) { - List alternateAddresses = null; - if (!invocation.hasAlternates()) { - // no previous failover attempt on this invocation - // - alternateAddresses = - getStrategy().getAlternateAddresses(exchange); - if (alternateAddresses != null) { - alternateAddresses.remove(exchange.getEndpoint().getEndpointInfo().getAddress()); - invocation.setAlternateAddresses(alternateAddresses); - } else { - invocation.setAlternateEndpoints( - getStrategy().getAlternateEndpoints(exchange)); - } - } else { - alternateAddresses = invocation.getAlternateAddresses(); - } - - Endpoint failoverTarget = null; - if (alternateAddresses != null) { - String alternateAddress = - getStrategy().selectAlternateAddress(alternateAddresses); - if (alternateAddress != null) { - // re-use current endpoint - // - failoverTarget = getEndpoint(); - - failoverTarget.getEndpointInfo().setAddress(alternateAddress); - } - } else { - failoverTarget = getStrategy().selectAlternateEndpoint( - invocation.getAlternateEndpoints()); - } - return failoverTarget; - } - - /** - * Get the distribution target endpoint, if a suitable one is available. - * - * @param exchange the current Exchange - * @param invocation the current InvocationContext - * @return a distribution endpoint if one is available - */ - private Endpoint getDistributionTarget(Exchange exchange, - InvocationContext invocation) { - List alternateAddresses = null; - if ((addressList == null) || (addressList.isEmpty())) { - try { - addressList = getStrategy().getAlternateAddresses(null); - } catch (NullPointerException ex) { - getLogger().fine("Strategy " + getStrategy().getClass() - + " cannot handle a null argument to getAlternateAddresses: " + ex.toString()); - } - } - alternateAddresses = addressList; - - if ((alternateAddresses == null) || (alternateAddresses.isEmpty())) { - alternateAddresses = getStrategy().getAlternateAddresses(exchange); - if (alternateAddresses != null) { - invocation.setAlternateAddresses(alternateAddresses); - } else { - invocation.setAlternateEndpoints( - getStrategy().getAlternateEndpoints(exchange)); - } - } - - Endpoint distributionTarget = null; - if ((alternateAddresses != null) && !alternateAddresses.isEmpty()) { - String alternateAddress = - getStrategy().selectAlternateAddress(alternateAddresses); - if (alternateAddress != null) { - // re-use current endpoint - distributionTarget = getEndpoint(); - distributionTarget.getEndpointInfo().setAddress(alternateAddress); - } - } else { - distributionTarget = getStrategy().selectAlternateEndpoint( - invocation.getAlternateEndpoints()); - } - return distributionTarget; - } - - @Override - protected boolean requiresFailover(Exchange exchange) { - return failover && super.requiresFailover(exchange); - } - -} +/** + * 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.clustering; + +import java.util.List; +import java.util.logging.Logger; +import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.message.Exchange; +import org.apache.cxf.message.Message; +import org.apache.cxf.transport.Conduit; + +/** + * + * @author jtalbut + * + * The LoadDistributorTargetSelector attempts to do the same job as the + * FailoverTargetSelector, but to choose an alternate target on every request + * rather than just when a fault occurs. + * The LoadDistributorTargetSelector uses the same FailoverStrategy interface as + * the FailoverTargetSelector, but has a few significant limitations: + * 1. Because the LoadDistributorTargetSelector needs to maintain a list of targets + * between calls it has to obtain that list without reference to a Message. + * Most FailoverStrategy classes can support this for addresses, but it cannot + * be supported for endpoints. + * If the list of targets cannot be obtained without reference to a Message then + * the list will still be obtained but it will be specific to the Message and thus + * discarded after this message has been processed. As a consequence, if the + * strategy chosen is a simple sequential one the first item in the list will + * be chosen every time. + * Conclusion: Be aware that if you are working with targets that are + * dependent on the Message the process will be less efficient and that the + * SequentialStrategy will not distribute the load at all. + * 2. The AbstractStaticFailoverStrategy base class excludes the 'default' endpoint + * from the list of alternate endpoints. + * If alternate endpoints (as opposed to alternate addresses) are to be used + * you should probably ensure that your FailoverStrategy overrides getAlternateEndpoints + * and calls getEndpoints with acceptCandidatesWithSameAddress = true. + */ +public class LoadDistributorTargetSelector extends FailoverTargetSelector { + private static final Logger LOG = LogUtils.getL7dLogger( + LoadDistributorTargetSelector.class); + private static final String IS_DISTRIBUTED = + "org.apache.cxf.clustering.LoadDistributorTargetSelector.IS_DISTRIBUTED"; + + private List addressList; + + private boolean failover = true; + + /** + * Normal constructor. + */ + public LoadDistributorTargetSelector() { + super(); + } + + /** + * Constructor, allowing a specific conduit to override normal selection. + * + * @param c specific conduit + */ + public LoadDistributorTargetSelector(Conduit c) { + super(c); + } + + public boolean isFailover() { + return failover; + } + + public void setFailover(boolean failover) { + this.failover = failover; + } + + @Override + protected java.util.logging.Logger getLogger() { + return LOG; + } + + /** + * Called when a Conduit is actually required. + * + * @param message + * @return the Conduit to use for mediation of the message + */ + public synchronized Conduit selectConduit(Message message) { + Conduit c = message.get(Conduit.class); + if (c != null) { + return c; + } + Exchange exchange = message.getExchange(); + InvocationKey key = new InvocationKey(exchange); + InvocationContext invocation = inProgress.get(key); + if ((invocation != null) && !invocation.getContext().containsKey(IS_DISTRIBUTED)) { + Endpoint target = getDistributionTarget(exchange, invocation); + if (target != null) { + setEndpoint(target); + message.put(Message.ENDPOINT_ADDRESS, target.getEndpointInfo().getAddress()); + message.put(CONDUIT_COMPARE_FULL_URL, Boolean.TRUE); + overrideAddressProperty(invocation.getContext()); + invocation.getContext().put(IS_DISTRIBUTED, null); + } + } + return getSelectedConduit(message); + } + + /** + * Get the failover target endpoint, if a suitable one is available. + * + * @param exchange the current Exchange + * @param invocation the current InvocationContext + * @return a failover endpoint if one is available + * + * Note: The only difference between this and the super implementation is + * that the current (failed) address is removed from the list set of alternates, + * it could be argued that that change should be in the super implementation + * but I'm not sure of the impact. + */ + protected Endpoint getFailoverTarget(Exchange exchange, + InvocationContext invocation) { + List alternateAddresses = null; + if (!invocation.hasAlternates()) { + // no previous failover attempt on this invocation + // + alternateAddresses = + getStrategy().getAlternateAddresses(exchange); + if (alternateAddresses != null) { + alternateAddresses.remove(exchange.getEndpoint().getEndpointInfo().getAddress()); + invocation.setAlternateAddresses(alternateAddresses); + } else { + invocation.setAlternateEndpoints( + getStrategy().getAlternateEndpoints(exchange)); + } + } else { + alternateAddresses = invocation.getAlternateAddresses(); + } + + Endpoint failoverTarget = null; + if (alternateAddresses != null) { + String alternateAddress = + getStrategy().selectAlternateAddress(alternateAddresses); + if (alternateAddress != null) { + // re-use current endpoint + // + failoverTarget = getEndpoint(); + + failoverTarget.getEndpointInfo().setAddress(alternateAddress); + } + } else { + failoverTarget = getStrategy().selectAlternateEndpoint( + invocation.getAlternateEndpoints()); + } + return failoverTarget; + } + + /** + * Get the distribution target endpoint, if a suitable one is available. + * + * @param exchange the current Exchange + * @param invocation the current InvocationContext + * @return a distribution endpoint if one is available + */ + private Endpoint getDistributionTarget(Exchange exchange, + InvocationContext invocation) { + List alternateAddresses = null; + if ((addressList == null) || (addressList.isEmpty())) { + try { + addressList = getStrategy().getAlternateAddresses(null); + } catch (NullPointerException ex) { + getLogger().fine("Strategy " + getStrategy().getClass() + + " cannot handle a null argument to getAlternateAddresses: " + ex.toString()); + } + } + alternateAddresses = addressList; + + if ((alternateAddresses == null) || (alternateAddresses.isEmpty())) { + alternateAddresses = getStrategy().getAlternateAddresses(exchange); + if (alternateAddresses != null) { + invocation.setAlternateAddresses(alternateAddresses); + } else { + invocation.setAlternateEndpoints( + getStrategy().getAlternateEndpoints(exchange)); + } + } + + Endpoint distributionTarget = null; + if ((alternateAddresses != null) && !alternateAddresses.isEmpty()) { + String alternateAddress = + getStrategy().selectAlternateAddress(alternateAddresses); + if (alternateAddress != null) { + // re-use current endpoint + distributionTarget = getEndpoint(); + distributionTarget.getEndpointInfo().setAddress(alternateAddress); + } + } else { + distributionTarget = getStrategy().selectAlternateEndpoint( + invocation.getAlternateEndpoints()); + } + return distributionTarget; + } + + @Override + protected boolean requiresFailover(Exchange exchange) { + return failover && super.requiresFailover(exchange); + } + +} Modified: cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RandomStrategy.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RandomStrategy.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RandomStrategy.java (original) +++ cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RandomStrategy.java Fri Apr 6 16:21:14 2012 @@ -1,50 +1,50 @@ -/** - * 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.clustering; - -import java.util.List; -import java.util.Random; - -/** - * Failover strategy based on a randomized walk through the - * static cluster represented by multiple endpoints associated - * with the same service instance. - */ -public class RandomStrategy extends AbstractStaticFailoverStrategy { - - private Random random; - - /** - * Constructor. - */ - public RandomStrategy() { - random = new Random(); - } - - /** - * Get next alternate endpoint. - * - * @param alternates non-empty List of alternate endpoints - * @return - */ - protected T getNextAlternate(List alternates) { - return alternates.remove(random.nextInt(alternates.size())); - } +/** + * 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.clustering; + +import java.util.List; +import java.util.Random; + +/** + * Failover strategy based on a randomized walk through the + * static cluster represented by multiple endpoints associated + * with the same service instance. + */ +public class RandomStrategy extends AbstractStaticFailoverStrategy { + + private Random random; + + /** + * Constructor. + */ + public RandomStrategy() { + random = new Random(); + } + + /** + * Get next alternate endpoint. + * + * @param alternates non-empty List of alternate endpoints + * @return + */ + protected T getNextAlternate(List alternates) { + return alternates.remove(random.nextInt(alternates.size())); + } } \ No newline at end of file Modified: cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java (original) +++ cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java Fri Apr 6 16:21:14 2012 @@ -1,78 +1,78 @@ -/** - * 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.clustering; - -import java.util.List; - -import org.apache.cxf.endpoint.Endpoint; -import org.apache.cxf.message.Exchange; - -/** - * This strategy simply retries the invocation using the same Endpoint (CXF-2036). - * - * @author Dennis Kieselhorst - * - */ -public class RetryStrategy extends SequentialStrategy { - - private int maxNumberOfRetries; - private int counter; - - /* (non-Javadoc) - * @see org.apache.cxf.clustering.AbstractStaticFailoverStrategy#getAlternateEndpoints( - * org.apache.cxf.message.Exchange) - */ - @Override - public List getAlternateEndpoints(Exchange exchange) { - return getEndpoints(exchange, stillTheSameAddress()); - } - - protected T getNextAlternate(List alternates) { - return stillTheSameAddress() ? alternates.get(0) : alternates.remove(0); - } - - protected boolean stillTheSameAddress() { - if (maxNumberOfRetries == 0) { - return true; - } - // let the target selector move to the next address - // and then stay on the same address for maxNumberOfRetries - if (++counter <= maxNumberOfRetries) { - return true; - } else { - counter = 0; - return false; - } - } - - - public void setMaxNumberOfRetries(int maxNumberOfRetries) { - if (maxNumberOfRetries < 0) { - throw new IllegalArgumentException(); - } - this.maxNumberOfRetries = maxNumberOfRetries; - } - - - public int getMaxNumberOfRetries() { - return maxNumberOfRetries; - } - +/** + * 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.clustering; + +import java.util.List; + +import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.message.Exchange; + +/** + * This strategy simply retries the invocation using the same Endpoint (CXF-2036). + * + * @author Dennis Kieselhorst + * + */ +public class RetryStrategy extends SequentialStrategy { + + private int maxNumberOfRetries; + private int counter; + + /* (non-Javadoc) + * @see org.apache.cxf.clustering.AbstractStaticFailoverStrategy#getAlternateEndpoints( + * org.apache.cxf.message.Exchange) + */ + @Override + public List getAlternateEndpoints(Exchange exchange) { + return getEndpoints(exchange, stillTheSameAddress()); + } + + protected T getNextAlternate(List alternates) { + return stillTheSameAddress() ? alternates.get(0) : alternates.remove(0); + } + + protected boolean stillTheSameAddress() { + if (maxNumberOfRetries == 0) { + return true; + } + // let the target selector move to the next address + // and then stay on the same address for maxNumberOfRetries + if (++counter <= maxNumberOfRetries) { + return true; + } else { + counter = 0; + return false; + } + } + + + public void setMaxNumberOfRetries(int maxNumberOfRetries) { + if (maxNumberOfRetries < 0) { + throw new IllegalArgumentException(); + } + this.maxNumberOfRetries = maxNumberOfRetries; + } + + + public int getMaxNumberOfRetries() { + return maxNumberOfRetries; + } + } \ No newline at end of file Modified: cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/SequentialStrategy.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/SequentialStrategy.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/SequentialStrategy.java (original) +++ cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/SequentialStrategy.java Fri Apr 6 16:21:14 2012 @@ -1,40 +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.clustering; - -import java.util.List; - -/** - * Failover strategy based on a sequential walk through the - * static cluster represented by multiple endpoints associated - * with the same service instance. - */ -public class SequentialStrategy extends AbstractStaticFailoverStrategy { - - /** - * Get next alternate endpoint. - * - * @param alternates non-empty List of alternate endpoints - * @return - */ - protected T getNextAlternate(List alternates) { - return alternates.remove(0); - } -} +/** + * 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.clustering; + +import java.util.List; + +/** + * Failover strategy based on a sequential walk through the + * static cluster represented by multiple endpoints associated + * with the same service instance. + */ +public class SequentialStrategy extends AbstractStaticFailoverStrategy { + + /** + * Get next alternate endpoint. + * + * @param alternates non-empty List of alternate endpoints + * @return + */ + protected T getNextAlternate(List alternates) { + return alternates.remove(0); + } +} Modified: cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java (original) +++ cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/FailoverBeanDefinitionParser.java Fri Apr 6 16:21:14 2012 @@ -1,39 +1,39 @@ -/** - * 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.clustering.spring; - -import org.w3c.dom.Element; - -import org.apache.cxf.clustering.FailoverFeature; -import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.ParserContext; - -public class FailoverBeanDefinitionParser extends AbstractBeanDefinitionParser { - - @Override - protected Class getBeanClass(Element element) { - return FailoverFeature.class; - } - - @Override - protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element e, String name) { - setFirstChildAsProperty(e, ctx, bean, name); - } -} +/** + * 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.clustering.spring; + +import org.w3c.dom.Element; + +import org.apache.cxf.clustering.FailoverFeature; +import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.ParserContext; + +public class FailoverBeanDefinitionParser extends AbstractBeanDefinitionParser { + + @Override + protected Class getBeanClass(Element element) { + return FailoverFeature.class; + } + + @Override + protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element e, String name) { + setFirstChildAsProperty(e, ctx, bean, name); + } +} Modified: cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java (original) +++ cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java Fri Apr 6 16:21:14 2012 @@ -1,39 +1,39 @@ -/** - * 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.clustering.spring; - -import org.w3c.dom.Element; - -import org.apache.cxf.clustering.LoadDistributorFeature; -import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.ParserContext; - -public class LoadDistributorBeanDefinitionParser extends AbstractBeanDefinitionParser { - - @Override - protected Class getBeanClass(Element element) { - return LoadDistributorFeature.class; - } - - @Override - protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element e, String name) { - setFirstChildAsProperty(e, ctx, bean, name); - } -} +/** + * 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.clustering.spring; + +import org.w3c.dom.Element; + +import org.apache.cxf.clustering.LoadDistributorFeature; +import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.ParserContext; + +public class LoadDistributorBeanDefinitionParser extends AbstractBeanDefinitionParser { + + @Override + protected Class getBeanClass(Element element) { + return LoadDistributorFeature.class; + } + + @Override + protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element e, String name) { + setFirstChildAsProperty(e, ctx, bean, name); + } +} Modified: cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java (original) +++ cxf/trunk/rt/features/clustering/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java Fri Apr 6 16:21:14 2012 @@ -1,30 +1,30 @@ -/** - * 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.clustering.spring; - -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; - -public class NamespaceHandler extends NamespaceHandlerSupport { - public void init() { - registerBeanDefinitionParser("failover", - new FailoverBeanDefinitionParser()); - registerBeanDefinitionParser("loadDistributor", - new LoadDistributorBeanDefinitionParser()); - } -} +/** + * 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.clustering.spring; + +import org.springframework.beans.factory.xml.NamespaceHandlerSupport; + +public class NamespaceHandler extends NamespaceHandlerSupport { + public void init() { + registerBeanDefinitionParser("failover", + new FailoverBeanDefinitionParser()); + registerBeanDefinitionParser("loadDistributor", + new LoadDistributorBeanDefinitionParser()); + } +} Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProtocolVariationTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProtocolVariationTest.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProtocolVariationTest.java (original) +++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProtocolVariationTest.java Fri Apr 6 16:21:14 2012 @@ -1,48 +1,48 @@ -/** - * 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; - -import junit.framework.Assert; - -import org.apache.cxf.ws.addressing.Names; -import org.apache.cxf.ws.addressing.VersionTransformer.Names200408; - -import org.junit.Test; - -/** - * - */ -public class ProtocolVariationTest extends Assert { - - @Test - public void testFindVariant() { - // valid combinations - assertNotNull(ProtocolVariation.findVariant( - RM10Constants.NAMESPACE_URI, Names200408.WSA_NAMESPACE_NAME)); - assertNotNull(ProtocolVariation.findVariant( - RM10Constants.NAMESPACE_URI, Names.WSA_NAMESPACE_NAME)); - assertNotNull(ProtocolVariation.findVariant( - RM11Constants.NAMESPACE_URI, Names.WSA_NAMESPACE_NAME)); - - // invalid combinations - assertNull(ProtocolVariation.findVariant( - RM11Constants.NAMESPACE_URI, Names200408.WSA_NAMESPACE_NAME)); - } -} +/** + * 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; + +import junit.framework.Assert; + +import org.apache.cxf.ws.addressing.Names; +import org.apache.cxf.ws.addressing.VersionTransformer.Names200408; + +import org.junit.Test; + +/** + * + */ +public class ProtocolVariationTest extends Assert { + + @Test + public void testFindVariant() { + // valid combinations + assertNotNull(ProtocolVariation.findVariant( + RM10Constants.NAMESPACE_URI, Names200408.WSA_NAMESPACE_NAME)); + assertNotNull(ProtocolVariation.findVariant( + RM10Constants.NAMESPACE_URI, Names.WSA_NAMESPACE_NAME)); + assertNotNull(ProtocolVariation.findVariant( + RM11Constants.NAMESPACE_URI, Names.WSA_NAMESPACE_NAME)); + + // invalid combinations + assertNull(ProtocolVariation.findVariant( + RM11Constants.NAMESPACE_URI, Names200408.WSA_NAMESPACE_NAME)); + } +} Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreUpgradeTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreUpgradeTest.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreUpgradeTest.java (original) +++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreUpgradeTest.java Fri Apr 6 16:21:14 2012 @@ -1,178 +1,178 @@ -/** - * 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.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.MessageFormat; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests the automatic table updating of RMTxStore that allows compatible changes - * in the database tables. - */ -public class RMTxStoreUpgradeTest extends Assert { - private static final String CREATE_OLD_SRC_SEQ_TABLE_STMT = - "CREATE TABLE CXF_RM_SRC_SEQUENCES " - + "(SEQ_ID VARCHAR(256) NOT NULL, " - + "CUR_MSG_NO DECIMAL(19, 0) DEFAULT 1 NOT NULL, " - + "LAST_MSG CHAR(1), " - + "EXPIRY DECIMAL(19, 0), " - + "OFFERING_SEQ_ID VARCHAR(256), " - + "ENDPOINT_ID VARCHAR(1024), " - + "PRIMARY KEY (SEQ_ID))"; - - private static final String CREATE_OLD_DEST_SEQ_TABLE_STMT = - "CREATE TABLE CXF_RM_DEST_SEQUENCES " - + "(SEQ_ID VARCHAR(256) NOT NULL, " - + "ACKS_TO VARCHAR(1024) NOT NULL, " - + "LAST_MSG_NO DECIMAL(19, 0), " - + "ENDPOINT_ID VARCHAR(1024), " - + "ACKNOWLEDGED BLOB, " - + "PRIMARY KEY (SEQ_ID))"; - - private static final String CREATE_OLD_MSGS_TABLE_STMT = - "CREATE TABLE {0} " - + "(SEQ_ID VARCHAR(256) NOT NULL, " - + "MSG_NO DECIMAL(19, 0) NOT NULL, " - + "SEND_TO VARCHAR(256), " - + "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 TEST_DB_NAME = "rmdb2"; - - @BeforeClass - public static void setUpOnce() { - RMTxStore.deleteDatabaseFiles(TEST_DB_NAME, true); - } - - @AfterClass - public static void tearDownOnce() { - RMTxStore.deleteDatabaseFiles(TEST_DB_NAME, false); - } - - @Test - public void testUpgradeTables() throws Exception { - TestRMTxStore store = new TestRMTxStore(); - store.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver"); - - // workaround for the db file deletion problem during the tests - store.setUrl(MessageFormat.format("jdbc:derby:{0};create=true", TEST_DB_NAME)); - - // use the old db definitions to create the tables - store.init(); - - // verify the absence of the new columns in the tables - verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true); - verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true); - verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, true); - verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, true); - - // upgrade the tables and add new columns to the old tables - store.upgrade(); - store.init(); - - // verify the presence of the new columns in the upgraded tables - verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false); - verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false); - verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, false); - verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, false); - } - - private static void verifyColumns(RMTxStore store, String tableName, - String[] cols, boolean absent) throws Exception { - // verify the presence of the new fields - DatabaseMetaData metadata = store.getConnection().getMetaData(); - ResultSet rs = metadata.getColumns(null, null, tableName, "%"); - Set colNames = new HashSet(); - Collections.addAll(colNames, cols); - while (rs.next()) { - colNames.remove(rs.getString(4)); - } - - if (absent) { - assertEquals("Some new columns are already present", cols.length, colNames.size()); - } else { - assertEquals("Some new columns are still absent", 0, colNames.size()); - } - } - - - static class TestRMTxStore extends RMTxStore { - private boolean upgraded; - - public void upgrade() { - upgraded = true; - } - - @Override - protected void createTables() throws SQLException { - if (upgraded) { - super.createTables(); - return; - } - // creating the old tables - Statement stmt = null; - stmt = getConnection().createStatement(); - try { - stmt.executeUpdate(CREATE_OLD_SRC_SEQ_TABLE_STMT); - } catch (SQLException ex) { - if (!isTableExistsError(ex)) { - throw ex; - } - } - stmt.close(); - - stmt = getConnection().createStatement(); - try { - stmt.executeUpdate(CREATE_OLD_DEST_SEQ_TABLE_STMT); - } catch (SQLException ex) { - if (!isTableExistsError(ex)) { - throw ex; - } - } - stmt.close(); - - for (String tableName : new String[] {INBOUND_MSGS_TABLE_NAME, OUTBOUND_MSGS_TABLE_NAME}) { - stmt = getConnection().createStatement(); - try { - stmt.executeUpdate(MessageFormat.format(CREATE_OLD_MSGS_TABLE_STMT, tableName)); - } catch (SQLException ex) { - if (!isTableExistsError(ex)) { - throw ex; - } - } - stmt.close(); - } - } - } -} +/** + * 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.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.MessageFormat; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Tests the automatic table updating of RMTxStore that allows compatible changes + * in the database tables. + */ +public class RMTxStoreUpgradeTest extends Assert { + private static final String CREATE_OLD_SRC_SEQ_TABLE_STMT = + "CREATE TABLE CXF_RM_SRC_SEQUENCES " + + "(SEQ_ID VARCHAR(256) NOT NULL, " + + "CUR_MSG_NO DECIMAL(19, 0) DEFAULT 1 NOT NULL, " + + "LAST_MSG CHAR(1), " + + "EXPIRY DECIMAL(19, 0), " + + "OFFERING_SEQ_ID VARCHAR(256), " + + "ENDPOINT_ID VARCHAR(1024), " + + "PRIMARY KEY (SEQ_ID))"; + + private static final String CREATE_OLD_DEST_SEQ_TABLE_STMT = + "CREATE TABLE CXF_RM_DEST_SEQUENCES " + + "(SEQ_ID VARCHAR(256) NOT NULL, " + + "ACKS_TO VARCHAR(1024) NOT NULL, " + + "LAST_MSG_NO DECIMAL(19, 0), " + + "ENDPOINT_ID VARCHAR(1024), " + + "ACKNOWLEDGED BLOB, " + + "PRIMARY KEY (SEQ_ID))"; + + private static final String CREATE_OLD_MSGS_TABLE_STMT = + "CREATE TABLE {0} " + + "(SEQ_ID VARCHAR(256) NOT NULL, " + + "MSG_NO DECIMAL(19, 0) NOT NULL, " + + "SEND_TO VARCHAR(256), " + + "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 TEST_DB_NAME = "rmdb2"; + + @BeforeClass + public static void setUpOnce() { + RMTxStore.deleteDatabaseFiles(TEST_DB_NAME, true); + } + + @AfterClass + public static void tearDownOnce() { + RMTxStore.deleteDatabaseFiles(TEST_DB_NAME, false); + } + + @Test + public void testUpgradeTables() throws Exception { + TestRMTxStore store = new TestRMTxStore(); + store.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver"); + + // workaround for the db file deletion problem during the tests + store.setUrl(MessageFormat.format("jdbc:derby:{0};create=true", TEST_DB_NAME)); + + // use the old db definitions to create the tables + store.init(); + + // verify the absence of the new columns in the tables + verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true); + verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, true); + verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, true); + verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, true); + + // upgrade the tables and add new columns to the old tables + store.upgrade(); + store.init(); + + // verify the presence of the new columns in the upgraded tables + verifyColumns(store, "CXF_RM_SRC_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false); + verifyColumns(store, "CXF_RM_DEST_SEQUENCES", new String[]{"PROTOCOL_VERSION"}, false); + verifyColumns(store, INBOUND_MSGS_TABLE_NAME, new String[]{}, false); + verifyColumns(store, OUTBOUND_MSGS_TABLE_NAME, new String[]{}, false); + } + + private static void verifyColumns(RMTxStore store, String tableName, + String[] cols, boolean absent) throws Exception { + // verify the presence of the new fields + DatabaseMetaData metadata = store.getConnection().getMetaData(); + ResultSet rs = metadata.getColumns(null, null, tableName, "%"); + Set colNames = new HashSet(); + Collections.addAll(colNames, cols); + while (rs.next()) { + colNames.remove(rs.getString(4)); + } + + if (absent) { + assertEquals("Some new columns are already present", cols.length, colNames.size()); + } else { + assertEquals("Some new columns are still absent", 0, colNames.size()); + } + } + + + static class TestRMTxStore extends RMTxStore { + private boolean upgraded; + + public void upgrade() { + upgraded = true; + } + + @Override + protected void createTables() throws SQLException { + if (upgraded) { + super.createTables(); + return; + } + // creating the old tables + Statement stmt = null; + stmt = getConnection().createStatement(); + try { + stmt.executeUpdate(CREATE_OLD_SRC_SEQ_TABLE_STMT); + } catch (SQLException ex) { + if (!isTableExistsError(ex)) { + throw ex; + } + } + stmt.close(); + + stmt = getConnection().createStatement(); + try { + stmt.executeUpdate(CREATE_OLD_DEST_SEQ_TABLE_STMT); + } catch (SQLException ex) { + if (!isTableExistsError(ex)) { + throw ex; + } + } + stmt.close(); + + for (String tableName : new String[] {INBOUND_MSGS_TABLE_NAME, OUTBOUND_MSGS_TABLE_NAME}) { + stmt = getConnection().createStatement(); + try { + stmt.executeUpdate(MessageFormat.format(CREATE_OLD_MSGS_TABLE_STMT, tableName)); + } catch (SQLException ex) { + if (!isTableExistsError(ex)) { + throw ex; + } + } + stmt.close(); + } + } + } +} Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParser.java URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParser.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParser.java (original) +++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/ClaimsParser.java Fri Apr 6 16:21:14 2012 @@ -1,39 +1,39 @@ -/** - * 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.sts.claims; - -import org.w3c.dom.Element; - -public interface ClaimsParser { - - /** - * @param claim Element to parse claim request from - * @return RequestClaim parsed from claim - */ - RequestClaim parse(Element claim); - - /** - * This method indicates the claims dialect this Parser can handle. - * - * @return Name of supported Dialect - */ - String getSupportedDialect(); - -} +/** + * 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.sts.claims; + +import org.w3c.dom.Element; + +public interface ClaimsParser { + + /** + * @param claim Element to parse claim request from + * @return RequestClaim parsed from claim + */ + RequestClaim parse(Element claim); + + /** + * This method indicates the claims dialect this Parser can handle. + * + * @return Name of supported Dialect + */ + String getSupportedDialect(); + +} Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/IdentityClaimsParser.java URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/IdentityClaimsParser.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/IdentityClaimsParser.java (original) +++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/IdentityClaimsParser.java Fri Apr 6 16:21:14 2012 @@ -1,105 +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.sts.claims; - -import java.net.URI; -import java.net.URISyntaxException; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import org.apache.cxf.common.logging.LogUtils; - -public class IdentityClaimsParser implements ClaimsParser { - - public static final String IDENTITY_CLAIMS_DIALECT = - "http://schemas.xmlsoap.org/ws/2005/05/identity"; - - private static final Logger LOG = LogUtils.getL7dLogger(IdentityClaimsParser.class); - - public RequestClaim parse(Element claim) { - return parseClaimType(claim); - } - - public static RequestClaim parseClaimType(Element claimType) { - String claimLocalName = claimType.getLocalName(); - String claimNS = claimType.getNamespaceURI(); - if ("ClaimType".equals(claimLocalName)) { - String claimTypeUri = claimType.getAttribute("Uri"); - String claimTypeOptional = claimType.getAttribute("Optional"); - RequestClaim requestClaim = new RequestClaim(); - try { - requestClaim.setClaimType(new URI(claimTypeUri)); - } catch (URISyntaxException e) { - LOG.log( - Level.WARNING, - "Cannot create URI from the given ClaimType attribute value " + claimTypeUri, - e - ); - } - requestClaim.setOptional(Boolean.parseBoolean(claimTypeOptional)); - return requestClaim; - } else if ("ClaimValue".equals(claimLocalName)) { - String claimTypeUri = claimType.getAttribute("Uri"); - String claimTypeOptional = claimType.getAttribute("Optional"); - RequestClaim requestClaim = new RequestClaim(); - try { - requestClaim.setClaimType(new URI(claimTypeUri)); - } catch (URISyntaxException e) { - LOG.log( - Level.WARNING, - "Cannot create URI from the given ClaimTye attribute value " + claimTypeUri, - e - ); - } - - Node valueNode = claimType.getFirstChild(); - if (valueNode != null) { - if ("Value".equals(valueNode.getLocalName())) { - requestClaim.setClaimValue(valueNode.getTextContent()); - } else { - LOG.warning("Unsupported child element of ClaimValue element " - + valueNode.getLocalName()); - return null; - } - } else { - LOG.warning("No child element of ClaimValue element available"); - return null; - } - - requestClaim.setOptional(Boolean.parseBoolean(claimTypeOptional)); - - return requestClaim; - } - - LOG.fine("Found unknown element: " + claimLocalName + " " + claimNS); - return null; - } - - /** - * Return the supported dialect of this class - */ - public String getSupportedDialect() { - return IDENTITY_CLAIMS_DIALECT; - } -} +/** + * 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.sts.claims; + +import java.net.URI; +import java.net.URISyntaxException; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import org.apache.cxf.common.logging.LogUtils; + +public class IdentityClaimsParser implements ClaimsParser { + + public static final String IDENTITY_CLAIMS_DIALECT = + "http://schemas.xmlsoap.org/ws/2005/05/identity"; + + private static final Logger LOG = LogUtils.getL7dLogger(IdentityClaimsParser.class); + + public RequestClaim parse(Element claim) { + return parseClaimType(claim); + } + + public static RequestClaim parseClaimType(Element claimType) { + String claimLocalName = claimType.getLocalName(); + String claimNS = claimType.getNamespaceURI(); + if ("ClaimType".equals(claimLocalName)) { + String claimTypeUri = claimType.getAttribute("Uri"); + String claimTypeOptional = claimType.getAttribute("Optional"); + RequestClaim requestClaim = new RequestClaim(); + try { + requestClaim.setClaimType(new URI(claimTypeUri)); + } catch (URISyntaxException e) { + LOG.log( + Level.WARNING, + "Cannot create URI from the given ClaimType attribute value " + claimTypeUri, + e + ); + } + requestClaim.setOptional(Boolean.parseBoolean(claimTypeOptional)); + return requestClaim; + } else if ("ClaimValue".equals(claimLocalName)) { + String claimTypeUri = claimType.getAttribute("Uri"); + String claimTypeOptional = claimType.getAttribute("Optional"); + RequestClaim requestClaim = new RequestClaim(); + try { + requestClaim.setClaimType(new URI(claimTypeUri)); + } catch (URISyntaxException e) { + LOG.log( + Level.WARNING, + "Cannot create URI from the given ClaimTye attribute value " + claimTypeUri, + e + ); + } + + Node valueNode = claimType.getFirstChild(); + if (valueNode != null) { + if ("Value".equals(valueNode.getLocalName())) { + requestClaim.setClaimValue(valueNode.getTextContent()); + } else { + LOG.warning("Unsupported child element of ClaimValue element " + + valueNode.getLocalName()); + return null; + } + } else { + LOG.warning("No child element of ClaimValue element available"); + return null; + } + + requestClaim.setOptional(Boolean.parseBoolean(claimTypeOptional)); + + return requestClaim; + } + + LOG.fine("Found unknown element: " + claimLocalName + " " + claimNS); + return null; + } + + /** + * Return the supported dialect of this class + */ + public String getSupportedDialect() { + return IDENTITY_CLAIMS_DIALECT; + } +} Modified: cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimParser.java URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimParser.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimParser.java (original) +++ cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomClaimParser.java Fri Apr 6 16:21:14 2012 @@ -1,68 +1,68 @@ -/** - * 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.sts.common; - -import java.net.URI; - -import org.w3c.dom.Element; - -import org.apache.cxf.sts.claims.ClaimsParser; -import org.apache.cxf.sts.claims.RequestClaim; - -public class CustomClaimParser implements ClaimsParser { - - public static final String CLAIMS_DIALECT = "http://my.custom.org/my/custom/namespace"; - - public RequestClaim parse(Element claim) { - - String claimLocalName = claim.getLocalName(); - String claimNS = claim.getNamespaceURI(); - if (CLAIMS_DIALECT.equals(claimNS) && "MyElement".equals(claimLocalName)) { - String claimTypeUri = claim.getAttribute("Uri"); - CustomRequestClaim response = new CustomRequestClaim(); - response.setClaimType(URI.create(claimTypeUri)); - String claimValue = claim.getAttribute("value"); - response.setClaimValue(claimValue); - String scope = claim.getAttribute("scope"); - response.setScope(scope); - return response; - } - return null; - } - - public String getSupportedDialect() { - return CLAIMS_DIALECT; - } - - /** - * Extends RequestClaim class to add additional attributes - */ - public class CustomRequestClaim extends RequestClaim { - private String scope; - - public String getScope() { - return scope; - } - - public void setScope(String scope) { - this.scope = scope; - } - } - -} +/** + * 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.sts.common; + +import java.net.URI; + +import org.w3c.dom.Element; + +import org.apache.cxf.sts.claims.ClaimsParser; +import org.apache.cxf.sts.claims.RequestClaim; + +public class CustomClaimParser implements ClaimsParser { + + public static final String CLAIMS_DIALECT = "http://my.custom.org/my/custom/namespace"; + + public RequestClaim parse(Element claim) { + + String claimLocalName = claim.getLocalName(); + String claimNS = claim.getNamespaceURI(); + if (CLAIMS_DIALECT.equals(claimNS) && "MyElement".equals(claimLocalName)) { + String claimTypeUri = claim.getAttribute("Uri"); + CustomRequestClaim response = new CustomRequestClaim(); + response.setClaimType(URI.create(claimTypeUri)); + String claimValue = claim.getAttribute("value"); + response.setClaimValue(claimValue); + String scope = claim.getAttribute("scope"); + response.setScope(scope); + return response; + } + return null; + } + + public String getSupportedDialect() { + return CLAIMS_DIALECT; + } + + /** + * Extends RequestClaim class to add additional attributes + */ + public class CustomRequestClaim extends RequestClaim { + private String scope; + + public String getScope() { + return scope; + } + + public void setScope(String scope) { + this.scope = scope; + } + } + +} Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/DummyPlatformTransactionManager.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/DummyPlatformTransactionManager.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/DummyPlatformTransactionManager.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/DummyPlatformTransactionManager.java Fri Apr 6 16:21:14 2012 @@ -1,43 +1,43 @@ -/** - * 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.systest.beanincreationexception; - -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.TransactionException; -import org.springframework.transaction.TransactionStatus; - -public class DummyPlatformTransactionManager implements PlatformTransactionManager { - - public void commit(TransactionStatus arg0) throws TransactionException { - // TODO Auto-generated method stub - - } - - public TransactionStatus getTransaction(TransactionDefinition arg0) throws TransactionException { - // TODO Auto-generated method stub - return null; - } - - public void rollback(TransactionStatus arg0) throws TransactionException { - // TODO Auto-generated method stub - - } - -} +/** + * 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.systest.beanincreationexception; + +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionException; +import org.springframework.transaction.TransactionStatus; + +public class DummyPlatformTransactionManager implements PlatformTransactionManager { + + public void commit(TransactionStatus arg0) throws TransactionException { + // TODO Auto-generated method stub + + } + + public TransactionStatus getTransaction(TransactionDefinition arg0) throws TransactionException { + // TODO Auto-generated method stub + return null; + } + + public void rollback(TransactionStatus arg0) throws TransactionException { + // TODO Auto-generated method stub + + } + +} Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/TestBeanABO.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/TestBeanABO.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/TestBeanABO.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/TestBeanABO.java Fri Apr 6 16:21:14 2012 @@ -1,23 +1,23 @@ -/** - * 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.systest.beanincreationexception; - -public interface TestBeanABO { - -} +/** + * 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.systest.beanincreationexception; + +public interface TestBeanABO { + +} Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/TestBeanABOImpl.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/TestBeanABOImpl.java?rev=1310446&r1=1310445&r2=1310446&view=diff ============================================================================== --- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/TestBeanABOImpl.java (original) +++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/beanincreationexception/TestBeanABOImpl.java Fri Apr 6 16:21:14 2012 @@ -1,37 +1,37 @@ -/** - * 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.systest.beanincreationexception; - -public class TestBeanABOImpl implements TestBeanABO { - private TestBeanABO bean; - private AddNumbersPortType client; - - public void setBean(TestBeanABO bean) { - this.bean = bean; - } - - public void setClient(AddNumbersPortType client) { - this.client = client; - } - - public String nothing() { - return "" + bean + client; - } - -} +/** + * 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.systest.beanincreationexception; + +public class TestBeanABOImpl implements TestBeanABO { + private TestBeanABO bean; + private AddNumbersPortType client; + + public void setBean(TestBeanABO bean) { + this.bean = bean; + } + + public void setClient(AddNumbersPortType client) { + this.client = client; + } + + public String nothing() { + return "" + bean + client; + } + +}