Author: maeste
Date: 2007-05-16 07:58:54 -0400 (Wed, 16 May 2007)
New Revision: 3104
Added:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/AssertionDeployer.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/WSSecurityAssertionDeployer.java
Removed:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java
Log:
Policy deployer adapted fpr tools
Deleted:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java
===================================================================
---
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java 2007-05-16
09:00:55 UTC (rev 3103)
+++
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.extensions.policy.deployer;
-
-import org.apache.ws.policy.PrimitiveAssertion;
-import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
-import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
-
-/**
- * Interface each policy domain should implement for policy deployment.
- *
- * @author Stefano Maestri <mailto:stefano.maestri@javalinux.it>
- * @author Alessio Soldano <mailto:alessio.soldano@javalinux.it>
- *
- */
-public interface AssertionDeployer
-{
- /**
- * Server side deployment method; ExtensibleMetaData provided so
- * that the implementor to let it plugs its own handlers.
- *
- * @param assertion
- * @param extMetaData
- * @throws UnsupportedAssertion
- */
- public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData) throws UnsupportedAssertion;
-
- /**
- * Client side deployment method; ExtensibleMetaData provided so
- * that the implementor to let it plugs its own handlers.
- *
- * @param assertion
- * @param extMetaData
- * @throws UnsupportedAssertion
- */
- public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData) throws UnsupportedAssertion;
-}
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java
===================================================================
---
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java 2007-05-16
09:00:55 UTC (rev 3103)
+++
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
@@ -32,6 +32,8 @@
import org.apache.ws.policy.PrimitiveAssertion;
import org.apache.ws.policy.XorCompositeAssertion;
import org.jboss.logging.Logger;
+import org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer;
+import
org.jboss.ws.extensions.policy.deployer.domainAssertion.WSSecurityAssertionDeployer;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAlternative;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
@@ -75,6 +77,15 @@
}
+// for tools
+ public static PolicyDeployer newInstanceForTools()
+ {
+ PolicyDeployer instance = new PolicyDeployer();
+
instance.domainDeployerMap.put("http://www.jboss.com/ws-security/sch...;
+ return instance;
+
+ }
+
@SuppressWarnings("unchecked")
public Policy deployServerside(Policy policy, ExtensibleMetaData extMetaData) throws
UnsupportedPolicy
{
Deleted:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java
===================================================================
---
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java 2007-05-16
09:00:55 UTC (rev 3103)
+++
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
@@ -1,87 +0,0 @@
-package org.jboss.ws.extensions.policy.deployer;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.StringReader;
-
-import org.apache.ws.policy.PrimitiveAssertion;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
-import org.jboss.ws.extensions.policy.deployer.util.PrimitiveAssertionWriter;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.metadata.wsse.WSSecurityOMFactory;
-
-public class WSSecurityAssertionDeployer implements AssertionDeployer
-{
- private final static Logger log = Logger.getLogger(PolicyDeployer.class);
-
- public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData) throws UnsupportedAssertion
- {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- if (extMetaData instanceof EndpointMetaData)
- {
- EndpointMetaData ep = (EndpointMetaData) extMetaData;
-
- WSSecurityConfiguration securityConfiguration;
- try
- {
- //GET XML of security assertion
- PrimitiveAssertionWriter.newInstance().writePrimitiveAssertion(assertion,
stream);
- StringReader reader = new StringReader(stream.toString());
-
- //Set security configuration
- securityConfiguration = WSSecurityOMFactory.newInstance().parse(reader);
- WSSecurityConfigFactory.newInstance().initKeystorePath(ep.getRootFile(),
securityConfiguration);
- ep.getServiceMetaData().setSecurityConfiguration(securityConfiguration);
-
- //set up handler chain as defined in standard file
- ep.setConfigName("Standard WSSecurity Endpoint");
- ep.initEndpointConfig();
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw new UnsupportedAssertion();
- }
- }
- }
-
- public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData) throws UnsupportedAssertion
- {
- if (extMetaData instanceof EndpointMetaData)
- {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- EndpointMetaData epMetaData = (EndpointMetaData) extMetaData;
- ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
- if (serviceMetaData.getSecurityConfiguration() == null)
- {
- try
- {
- PrimitiveAssertionWriter.newInstance().writePrimitiveAssertion(assertion,
stream);
- StringReader reader = new StringReader(stream.toString());
-
- WSSecurityConfiguration securityConfiguration =
WSSecurityOMFactory.newInstance().parse(reader);
- serviceMetaData.setSecurityConfiguration(securityConfiguration);
-
- epMetaData.setConfigName("Standard WSSecurity Client");
- epMetaData.initEndpointConfig();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw new UnsupportedAssertion();
- }
- }
- }
-
- }
-
-}
Copied:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/AssertionDeployer.java
(from rev 3103,
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/AssertionDeployer.java)
===================================================================
---
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/AssertionDeployer.java
(rev 0)
+++
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/AssertionDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.policy.deployer.domainAssertion;
+
+import org.apache.ws.policy.PrimitiveAssertion;
+import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
+import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
+
+/**
+ * Interface each policy domain should implement for policy deployment.
+ *
+ * @author Stefano Maestri <mailto:stefano.maestri@javalinux.it>
+ * @author Alessio Soldano <mailto:alessio.soldano@javalinux.it>
+ *
+ */
+public interface AssertionDeployer
+{
+ /**
+ * Server side deployment method; ExtensibleMetaData provided so
+ * that the implementor to let it plugs its own handlers.
+ *
+ * @param assertion
+ * @param extMetaData
+ * @throws UnsupportedAssertion
+ */
+ public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData) throws UnsupportedAssertion;
+
+ /**
+ * Client side deployment method; ExtensibleMetaData provided so
+ * that the implementor to let it plugs its own handlers.
+ *
+ * @param assertion
+ * @param extMetaData
+ * @throws UnsupportedAssertion
+ */
+ public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData) throws UnsupportedAssertion;
+}
Copied:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/WSSecurityAssertionDeployer.java
(from rev 3103,
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/WSSecurityAssertionDeployer.java)
===================================================================
---
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/WSSecurityAssertionDeployer.java
(rev 0)
+++
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/WSSecurityAssertionDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
@@ -0,0 +1,88 @@
+package org.jboss.ws.extensions.policy.deployer.domainAssertion;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.apache.ws.policy.PrimitiveAssertion;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.StubExt;
+import org.jboss.ws.extensions.policy.deployer.PolicyDeployer;
+import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
+import org.jboss.ws.extensions.policy.deployer.util.PrimitiveAssertionWriter;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
+import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.metadata.wsse.WSSecurityOMFactory;
+
+public class WSSecurityAssertionDeployer implements AssertionDeployer
+{
+ private final static Logger log = Logger.getLogger(PolicyDeployer.class);
+
+ public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData) throws UnsupportedAssertion
+ {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ if (extMetaData instanceof EndpointMetaData)
+ {
+ EndpointMetaData ep = (EndpointMetaData) extMetaData;
+
+ WSSecurityConfiguration securityConfiguration;
+ try
+ {
+ //GET XML of security assertion
+ PrimitiveAssertionWriter.newInstance().writePrimitiveAssertion(assertion,
stream);
+ StringReader reader = new StringReader(stream.toString());
+
+ //Set security configuration
+ securityConfiguration = WSSecurityOMFactory.newInstance().parse(reader);
+ WSSecurityConfigFactory.newInstance().initKeystorePath(ep.getRootFile(),
securityConfiguration);
+ ep.getServiceMetaData().setSecurityConfiguration(securityConfiguration);
+
+ //set up handler chain as defined in standard file
+ ep.setConfigName("Standard WSSecurity Endpoint");
+ ep.initEndpointConfig();
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new UnsupportedAssertion();
+ }
+ }
+ }
+
+ public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData
extMetaData) throws UnsupportedAssertion
+ {
+ if (extMetaData instanceof EndpointMetaData)
+ {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ EndpointMetaData epMetaData = (EndpointMetaData) extMetaData;
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+ if (serviceMetaData.getSecurityConfiguration() == null)
+ {
+ try
+ {
+ PrimitiveAssertionWriter.newInstance().writePrimitiveAssertion(assertion,
stream);
+ StringReader reader = new StringReader(stream.toString());
+
+ WSSecurityConfiguration securityConfiguration =
WSSecurityOMFactory.newInstance().parse(reader);
+ serviceMetaData.setSecurityConfiguration(securityConfiguration);
+
+ epMetaData.setConfigName("Standard WSSecurity Client");
+ epMetaData.initEndpointConfig();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new UnsupportedAssertion();
+ }
+ }
+ }
+
+ }
+
+}