Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 8958 invoked from network); 29 Jul 2010 19:29:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Jul 2010 19:29:21 -0000 Received: (qmail 94431 invoked by uid 500); 29 Jul 2010 19:29:21 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 94382 invoked by uid 500); 29 Jul 2010 19:29:21 -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 94375 invoked by uid 99); 29 Jul 2010 19:29:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Jul 2010 19:29:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Thu, 29 Jul 2010 19:29:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D378E23889B6; Thu, 29 Jul 2010 19:28:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r980545 - /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java Date: Thu, 29 Jul 2010 19:28:03 -0000 To: commits@cxf.apache.org From: dvaleri@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100729192803.D378E23889B6@eris.apache.org> Author: dvaleri Date: Thu Jul 29 19:28:03 2010 New Revision: 980545 URL: http://svn.apache.org/viewvc?rev=980545&view=rev Log: [CXF-2664] Removing deprecated methods to support configuration with Spring. Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=980545&r1=980544&r2=980545&view=diff ============================================================================== --- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java (original) +++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java Thu Jul 29 19:28:03 2010 @@ -172,25 +172,27 @@ public class STSClient implements Config this.location = location; } - public void setPolicy(Policy policy) { - this.policy = policy; - if (algorithmSuite == null) { - Iterator i = policy.getAlternatives(); - while (i.hasNext() && algorithmSuite == null) { - List p = CastUtils.cast((List)i.next()); - for (PolicyComponent p2 : p) { - if (p2 instanceof Binding) { - algorithmSuite = ((Binding)p2).getAlgorithmSuite(); - } - } - } + /** + * Sets the WS-P policy that is applied to communications between this client and the remote server + * if no value is supplied for {@link #setWsdlLocation(String)}. + *

+ * Accepts {@link Policy} or {@link Element} as input. + * + * @param newPolicy the policy object + * + * @throws IllegalArgumentException if {@code newPolicy} is not one of the supported types. + */ + public void setPolicy(Object newPolicy) { + if (newPolicy instanceof Policy) { + this.setPolicyInternal((Policy) newPolicy); + } else if (newPolicy instanceof Element) { + this.setPolicyInternal((Element) newPolicy); + } else { + throw new IllegalArgumentException("Unsupported policy object. Type must be " + + "org.apache.neethi.Policy or org.w3c.dom.Element."); } } - public void setPolicy(Element policy) { - setPolicy(bus.getExtension(PolicyBuilder.class).getPolicy(policy)); - } - public void setSoap12() { soapVersion = SoapBindingConstants.SOAP12_BINDING_ID; } @@ -287,6 +289,25 @@ public class STSClient implements Config public int getKeySize() { return keySize; } + + protected void setPolicyInternal(Policy newPolicy) { + this.policy = newPolicy; + if (algorithmSuite == null) { + Iterator i = policy.getAlternatives(); + while (i.hasNext() && algorithmSuite == null) { + List p = CastUtils.cast((List)i.next()); + for (PolicyComponent p2 : p) { + if (p2 instanceof Binding) { + algorithmSuite = ((Binding)p2).getAlgorithmSuite(); + } + } + } + } + } + + protected void setPolicyInternal(Element newPolicy) { + this.setPolicyInternal(bus.getExtension(PolicyBuilder.class).getPolicy(newPolicy)); + } private void createClient() throws BusException, EndpointException { @@ -335,7 +356,7 @@ public class STSClient implements Config Conduit conduit = client.getConduit(); EffectivePolicy effectivePolicy = pe.getEffectiveClientRequestPolicy(client.getEndpoint() .getEndpointInfo(), boi, conduit); - setPolicy(effectivePolicy.getPolicy()); + setPolicyInternal(effectivePolicy.getPolicy()); return boi; } }