libjboss-web-services-java-0.0+svn5660.orig/0000755000175000017500000000000010755000250016653 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/0000755000175000017500000000000010755000222021632 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/0000755000175000017500000000000010755000222022421 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/0000755000175000017500000000000010755000222023541 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/0000755000175000017500000000000010755000224024342 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/0000755000175000017500000000000010755000224025321 5ustar godgod././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/TestDeployerJBoss.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/TestDeployerJBoss.java0000644000175000017500000000750510652566276031603 0ustar godgod/* * 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.wsf.test; import java.io.IOException; import java.io.Serializable; import java.net.URL; import java.security.Principal; import javax.management.InstanceNotFoundException; import javax.management.MBeanException; import javax.management.MBeanServerConnection; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.ReflectionException; import org.jboss.wsf.spi.invocation.SecurityAdaptor; import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; /** * A JBossWS test helper that deals with test deployment/undeployment, etc. * * @author Thomas.Diesler@jboss.org * @since 14-Oct-2004 */ public class TestDeployerJBoss implements TestDeployer { private static final String MAIN_DEPLOYER = "jboss.system:service=MainDeployer"; private MBeanServerConnection server; private String username; private String password; public TestDeployerJBoss(MBeanServerConnection server) { this.server = server; username = System.getProperty("jmx.authentication.username"); if ("${jmx.authentication.username}".equals(username)) username = null; password = System.getProperty("jmx.authentication.password"); if ("${jmx.authentication.password}".equals(password)) password = null; } public void deploy(URL url) throws Exception { invokeMainDeployer("deploy", url); } public void undeploy(URL url) throws Exception { invokeMainDeployer("undeploy", url); } private void invokeMainDeployer(String methodName, URL url) throws Exception { Principal prevUsername = null; Object prevPassword = null; SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter(); if (username != null || password != null) { prevUsername = securityAdaptor.getPrincipal(); prevPassword = securityAdaptor.getCredential(); securityAdaptor.setPrincipal(new SimplePrincipal(username)); securityAdaptor.setCredential(password); } try { server.invoke(new ObjectName(MAIN_DEPLOYER), methodName, new Object[] { url }, new String[] { "java.net.URL" }); } finally { if (username != null || password != null) { securityAdaptor.setPrincipal(prevUsername); securityAdaptor.setCredential(prevPassword); } } } public static class SimplePrincipal implements Principal, Serializable { private String name; public SimplePrincipal(String name) { this.name = name; } public String getName() { return name; } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/XOPTestSupport.java0000644000175000017500000000557010650145103031076 0ustar godgod/* * 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.wsf.test; // $Id: XOPTestSupport.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.awt.Image; import java.awt.Toolkit; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import javax.activation.DataHandler; import javax.xml.transform.stream.StreamSource; /** * @author Heiko Braun * @since 22-Sep-2006 */ public class XOPTestSupport { public static byte[] getBytesFromFile(File file) throws IOException { InputStream is = new FileInputStream(file); long length = file.length(); byte[] bytes = new byte[(int)length]; int offset = 0; int numRead = 0; while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) { offset += numRead; } is.close(); return bytes; } public static Image createTestImage(File imgFile) { Image image = null; try { URL url = imgFile.toURL(); image = null; try { image = Toolkit.getDefaultToolkit().createImage(url); } catch (Throwable th) { //log.warn("Cannot create Image: " + th); } } catch (MalformedURLException e) { throw new RuntimeException(e); } return image; } public static StreamSource createTestSource() { return new StreamSource(new ByteArrayInputStream("".getBytes())); } public static DataHandler createDataHandler(File imgFile) { try { URL url = imgFile.toURL(); return new DataHandler(url); } catch (MalformedURLException e) { throw new RuntimeException(e); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/TestDeployer.java0000644000175000017500000000252310650145103030611 0ustar godgod/* * 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.wsf.test; import java.net.URL; /** * WS test deployer * * @author Thomas.Diesler@jboss.org * @since 16-May-2006 */ public interface TestDeployer { /** Deploy the given archive */ void deploy(URL archive) throws Exception; /** Undeploy the given archive */ void undeploy(URL archive) throws Exception; }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/GenericLogicalHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/GenericLogicalHandler.0000644000175000017500000000252410650145103031472 0ustar godgod/* * 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.wsf.test; import javax.xml.ws.handler.LogicalMessageContext; import javax.xml.ws.handler.LogicalHandler; /** * A generic jaxws logical handler * * @author Thomas.Diesler@jboss.org * @since 13-Aug-2006 */ public class GenericLogicalHandler extends GenericHandler implements LogicalHandler { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/GenericHandler.java0000644000175000017500000000442210650145103031040 0ustar godgod/* * 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.wsf.test; import javax.xml.ws.handler.Handler; import javax.xml.ws.handler.MessageContext; /** * A generic jaxws handler * * @author Thomas.Diesler@jboss.org * @since 13-Aug-2006 */ public abstract class GenericHandler implements Handler { private String handlerName; public String getHandlerName() { return handlerName; } public void setHandlerName(String handlerName) { this.handlerName = handlerName; } public boolean handleMessage(MessageContext msgContext) { Boolean outbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outbound == null) throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY); return outbound ? handleOutbound(msgContext) : handleInbound(msgContext); } protected boolean handleOutbound(MessageContext msgContext) { return true; } protected boolean handleInbound(MessageContext msgContext) { return true; } public boolean handleFault(MessageContext messagecontext) { return true; } public void close(MessageContext messageContext) { } public String toString() { return (handlerName != null ? handlerName : super.toString()); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/TCK14ToJunitReportConverter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/TCK14ToJunitReportConv0000644000175000017500000001420110746130572031401 0ustar godgod/* * 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.wsf.test; import java.io.BufferedReader; import java.io.File; import java.io.FileFilter; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; /** * TCK Report to JUnit Report Converter Utility * * @author richard.opalka@jboss.com * * @since Jan 23, 2008 */ public final class TCK14ToJunitReportConverter { private static final FileFilter filter = new TCKReportFileFilter(); private static File junitReportDir = null; private static final class TCKReportFileFilter implements FileFilter { public boolean accept(File f) { return f.isDirectory() ? true : f.getName().endsWith(".jtr"); } } public static void main(String[] args) throws IOException { if (args.length != 2) { throw new IllegalArgumentException(); } File tckReportDir = new File(args[0]); junitReportDir = new File(args[1]); if (!tckReportDir.exists() && !tckReportDir.isDirectory()) { throw new IllegalArgumentException("TCK report directory '" + tckReportDir.getAbsolutePath() + "' doesn't exist or is not directory"); } if (!junitReportDir.mkdir() || (!junitReportDir.exists() && !junitReportDir.isDirectory())) { throw new IllegalArgumentException("JUnit report Directory '" + junitReportDir.getAbsolutePath() + "' doesn't exist or is not directory"); } File[] files = tckReportDir.listFiles(filter); for (File f : files) { if (f.isDirectory()) { convertDirectory("", f); } else { convertFile("", f); } } } private static void convertDirectory(String pckg, File dir) throws IOException { File[] files = dir.listFiles(filter); for (File f : files) { if (f.isDirectory()) { convertDirectory((pckg.length() == 0 ? "" : (pckg + "/")) + f.getName(), f); } else { convertFile(pckg, f); } } } /** * Converts TCK log to Junit report file * @param pckg package of the test * @param f TCK report file * @throws IOException if some I/O problem occurs */ private static void convertFile(String pckg, File f) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(f)); StringBuilder sb = new StringBuilder(); boolean testPassed = false; try { String line = reader.readLine(); while (line != null) { if ((line.trim().length() > 0) && testPassed) { // TCK test passed if and only if the last line in log is 'test result: Passed' testPassed = false; } sb.append(line); sb.append("\n"); if (line.indexOf("test result: Passed") != -1) { testPassed = true; } line = reader.readLine(); } } finally { reader.close(); } createJunitReport(sb.toString(), testPassed, pckg, f); } /** * Flushes Junit report to the file system * @param consoleOutput TCK log * @param passed indicates whether TCK test passed * @param pckg test package * @param file TCK log file * @throws IOException if some I/O problem occurs */ private static void createJunitReport(String consoleOutput, boolean passed, String pckg, File file) throws IOException { String fileName = file.getName().substring(0, file.getName().length() - 4); StringBuilder sb = new StringBuilder(); String nl = "\n"; sb.append("" + nl); sb.append("" + nl); sb.append(" " + nl); sb.append(" " + nl); sb.append(" ", "] ]>", consoleOutput) + "]]>" + nl); sb.append(" " + nl); sb.append("" + nl); File junitReportFile = new File(junitReportDir, "TEST-" + pckg.replace('/', '.') + "." + fileName + ".xml"); System.out.println("Creating JUnit report file: " + junitReportFile.getAbsolutePath()); FileOutputStream os = null; try { os = new FileOutputStream(junitReportFile); os.write(sb.toString().getBytes()); } finally { if (os != null) os.close(); } } private static String replace(String oldString, String newString, String data) { int fromIndex = 0; int index = 0; StringBuilder result = new StringBuilder(); while ((index = data.indexOf(oldString, fromIndex)) >= 0) { result.append(data.substring(fromIndex, index)); result.append(newString); fromIndex = index + oldString.length(); } result.append(data.substring(fromIndex)); return result.toString(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/JBossWSTest.java0000644000175000017500000002044110725264275030336 0ustar godgod/* * 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.wsf.test; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; import java.util.Iterator; import javax.management.MBeanServerConnection; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import junit.framework.TestCase; import org.jboss.logging.Logger; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Base class for JBossWS test cases * * @author Thomas.Diesler@jboss.org * @since 14-Oct-2004 */ public abstract class JBossWSTest extends TestCase { // provide logging protected Logger log = Logger.getLogger(getClass().getName()); private JBossWSTestHelper delegate = new JBossWSTestHelper(); public JBossWSTest() { } public JBossWSTest(String name) { super(name); } public MBeanServerConnection getServer() throws NamingException { return delegate.getServer(); } public boolean isTargetJBoss50() { return delegate.isTargetJBoss50(); } public boolean isTargetJBoss42() { return delegate.isTargetJBoss42(); } public boolean isTargetJBoss40() { return delegate.isTargetJBoss40(); } public boolean isIntegrationNative() { return delegate.isIntegrationNative(); } public boolean isIntegrationSunRI() { return delegate.isIntegrationSunRI(); } public boolean isIntegrationCXF() { return delegate.isIntegrationCXF(); } /** Deploy the given archive */ public void deploy(String archive) throws Exception { delegate.deploy(archive); } /** Undeploy the given archive */ public void undeploy(String archive) throws Exception { delegate.undeploy(archive); } public String getServerHost() { return delegate.getServerHost(); } /** Get the client's env context for a given name. */ protected InitialContext getInitialContext(String clientName) throws NamingException { InitialContext iniCtx = new InitialContext(); Hashtable env = iniCtx.getEnvironment(); env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client"); env.put("j2ee.clientName", clientName); return new InitialContext(env); } /** Get the client's env context */ protected InitialContext getInitialContext() throws NamingException { return getInitialContext("jbossws-client"); } public boolean hasJDK15() { try { Class.forName("java.lang.Enum"); return true; } catch (ClassNotFoundException ex) { return false; } } public static void assertEquals(Element expElement, Element wasElement, boolean ignoreWhitespace) { normalizeWhitspace(expElement, ignoreWhitespace); normalizeWhitspace(wasElement, ignoreWhitespace); String expStr = DOMWriter.printNode(expElement, false); String wasStr = DOMWriter.printNode(wasElement, false); if (expStr.equals(wasStr) == false) { System.out.println("\nExp: " + expStr + "\nWas: " + wasStr); Logger.getLogger(JBossWSTest.class).error("\nExp: " + expStr + "\nWas: " + wasStr); } assertEquals(expStr, wasStr); } public static void assertEquals(Element expElement, Element wasElement) { assertEquals(expElement, wasElement, false); } public static void assertEquals(Object exp, Object was) { if (exp instanceof Object[] && was instanceof Object[]) assertEqualsArray((Object[])exp, (Object[])was); else if (exp instanceof byte[] && was instanceof byte[]) assertEqualsArray((byte[])exp, (byte[])was); else if (exp instanceof boolean[] && was instanceof boolean[]) assertEqualsArray((boolean[])exp, (boolean[])was); else if (exp instanceof short[] && was instanceof short[]) assertEqualsArray((short[])exp, (short[])was); else if (exp instanceof int[] && was instanceof int[]) assertEqualsArray((int[])exp, (int[])was); else if (exp instanceof long[] && was instanceof long[]) assertEqualsArray((long[])exp, (long[])was); else if (exp instanceof float[] && was instanceof float[]) assertEqualsArray((float[])exp, (float[])was); else if (exp instanceof double[] && was instanceof double[]) assertEqualsArray((double[])exp, (double[])was); else TestCase.assertEquals(exp, was); } private static void assertEqualsArray(Object[] exp, Object[] was) { if (exp == null && was == null) return; if (exp != null && was != null) { if (exp.length != was.length) { fail("Expected <" + exp.length + "> array items, but was <" + was.length + ">"); } else { for (int i = 0; i < exp.length; i++) { Object compExp = exp[i]; Object compWas = was[i]; assertEquals(compExp, compWas); } } } else if (exp == null) { fail("Expected a null array, but was: " + Arrays.asList(was)); } else if (was == null) { fail("Expected " + Arrays.asList(exp) + ", but was: null"); } } private static void assertEqualsArray(byte[] exp, byte[] was) { assertTrue("Arrays don't match", Arrays.equals(exp, was)); } private static void assertEqualsArray(boolean[] exp, boolean[] was) { assertTrue("Arrays don't match", Arrays.equals(exp, was)); } private static void assertEqualsArray(short[] exp, short[] was) { assertTrue("Arrays don't match", Arrays.equals(exp, was)); } private static void assertEqualsArray(int[] exp, int[] was) { assertTrue("Arrays don't match", Arrays.equals(exp, was)); } private static void assertEqualsArray(long[] exp, long[] was) { assertTrue("Arrays don't match", Arrays.equals(exp, was)); } private static void assertEqualsArray(float[] exp, float[] was) { assertTrue("Arrays don't match", Arrays.equals(exp, was)); } private static void assertEqualsArray(double[] exp, double[] was) { assertTrue("Arrays don't match", Arrays.equals(exp, was)); } /** Removes whitespace text nodes if they have an element sibling. */ private static void normalizeWhitspace(Element element, boolean ignoreWhitespace) { boolean hasChildElement = false; ArrayList toDetach = new ArrayList(); String nodeName = element.getNodeName(); NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (node.getNodeType() == Node.TEXT_NODE) { String nodeValue = node.getNodeValue(); if (nodeValue.trim().length() == 0) toDetach.add(node); } if (node.getNodeType() == Node.ELEMENT_NODE) { normalizeWhitspace((Element)node, ignoreWhitespace); hasChildElement = true; } } // remove whitespace nodes if (hasChildElement || ignoreWhitespace) { Iterator it = toDetach.iterator(); while (it.hasNext()) { Node node = (Node)it.next(); element.removeChild(node); } } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/JBossWSTestHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/JBossWSTestHelper.java0000644000175000017500000001603210725264275031477 0ustar godgod/* * 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.wsf.test; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.Hashtable; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.ws.Service; import javax.xml.ws.Service.Mode; import javax.xml.ws.soap.SOAPBinding; import org.jboss.logging.Logger; import org.jboss.wsf.common.ObjectNameFactory; /** * A JBossWS test helper that deals with test deployment/undeployment, etc. * * @author Thomas.Diesler@jboss.org * @since 14-Oct-2004 */ public class JBossWSTestHelper { // provide logging private static Logger log = Logger.getLogger(JBossWSTestHelper.class); private static MBeanServerConnection server; private static String integrationTarget; private static String implVendor; private static String implTitle; private static String implVersion; /** Deploy the given archive */ public void deploy(String archive) throws Exception { URL url = getArchiveURL(archive); getDeployer().deploy(url); } /** Undeploy the given archive */ public void undeploy(String archive) throws Exception { URL url = getArchiveURL(archive); getDeployer().undeploy(url); } /** True, if -Djbossws.integration.target=jboss50x */ public boolean isTargetJBoss50() { String target = getIntegrationTarget(); return target.startsWith("jboss50"); } /** True, if -Djbossws.integration.target=jboss42x */ public boolean isTargetJBoss42() { String target = getIntegrationTarget(); return target.startsWith("jboss42"); } /** True, if -Djbossws.integration.target=jboss40x */ public boolean isTargetJBoss40() { String target = getIntegrationTarget(); return target.startsWith("jboss40"); } public boolean isIntegrationNative() { String vendor = getImplementationVendor(); return vendor.indexOf("JBoss") != -1; } public boolean isIntegrationSunRI() { String vendor = getImplementationVendor(); return vendor.indexOf("Sun") != -1; } public boolean isIntegrationCXF() { String vendor = getImplementationVendor(); return vendor.indexOf("Apache") != -1; } private String getImplementationVendor() { if (implVendor == null) { Service service = Service.create(new QName("dummyService")); Object obj = service.getHandlerResolver(); if (obj == null) { service.addPort(new QName("dummyPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://dummy-address"); obj = service.createDispatch(new QName("dummyPort"), Source.class, Mode.PAYLOAD); } implVendor = obj.getClass().getPackage().getImplementationVendor(); implTitle = obj.getClass().getPackage().getImplementationTitle(); implVersion = obj.getClass().getPackage().getImplementationVersion(); System.out.println(implVendor + ", " + implTitle + ", " + implVersion); } return implVendor; } /** * Get the JBoss server host from system property "jboss.bind.address" * This defaults to "localhost" */ public static String getServerHost() { String hostName = System.getProperty("jboss.bind.address", "localhost"); return hostName; } public static MBeanServerConnection getServer() { if (server == null) { Hashtable jndiEnv = null; try { InitialContext iniCtx = new InitialContext(); jndiEnv = iniCtx.getEnvironment(); server = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor"); } catch (NamingException ex) { throw new RuntimeException("Cannot obtain MBeanServerConnection using jndi props: " + jndiEnv, ex); } } return server; } private TestDeployer getDeployer() { return new TestDeployerJBoss(getServer()); } public String getIntegrationTarget() { if (integrationTarget == null) { integrationTarget = System.getProperty("jbossws.integration.target"); if (integrationTarget == null) throw new IllegalStateException("Cannot obtain jbossws.integration.target"); // Read the JBoss SpecificationVersion String jbossVersion = null; try { ObjectName oname = ObjectNameFactory.create("jboss.system:type=ServerConfig"); jbossVersion = (String)getServer().getAttribute(oname, "SpecificationVersion"); if (jbossVersion.startsWith("5.0")) jbossVersion = "jboss50"; else if (jbossVersion.startsWith("4.2")) jbossVersion = "jboss42"; else if (jbossVersion.startsWith("4.0")) jbossVersion = "jboss40"; else throw new RuntimeException("Unsupported jboss version: " + jbossVersion); } catch (Throwable th) { // ignore, we are not running on jboss-4.2 or greater } if (jbossVersion != null && integrationTarget.startsWith(jbossVersion) == false) throw new IllegalStateException("Integration target mismatch, using: " + jbossVersion); } return integrationTarget; } /** Try to discover the URL for the deployment archive */ public URL getArchiveURL(String archive) throws MalformedURLException { URL url = null; try { url = new URL(archive); } catch (MalformedURLException ignore) { // ignore } if (url == null) { File file = new File(archive); if (file.exists()) url = file.toURL(); } if (url == null) { File file = new File("libs/" + archive); if (file.exists()) url = file.toURL(); } if (url == null) throw new IllegalArgumentException("Cannot obtain URL for: " + archive); return url; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/JBossWSTestSetup.java0000644000175000017500000000762210650145103031346 0ustar godgod/* * 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.wsf.test; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import javax.management.MBeanServerConnection; import javax.naming.NamingException; import org.jboss.logging.Logger; import junit.extensions.TestSetup; import junit.framework.Test; import junit.framework.TestSuite; /** * A test setup that deploys/undeploys archives * * @author Thomas.Diesler@jboss.org * @since 14-Oct-2004 */ public class JBossWSTestSetup extends TestSetup { // provide logging private static Logger log = Logger.getLogger(JBossWSTestSetup.class); private JBossWSTestHelper delegate = new JBossWSTestHelper(); private String[] archives = new String[0]; public JBossWSTestSetup(Class testClass, String archiveList) { super(new TestSuite(testClass)); getArchiveArray(archiveList); } public JBossWSTestSetup(Test test, String archiveList) { super(test); getArchiveArray(archiveList); } public JBossWSTestSetup(Test test) { super(test); } private void getArchiveArray(String archiveList) { if (archiveList != null) { StringTokenizer st = new StringTokenizer(archiveList, ", "); archives = new String[st.countTokens()]; for (int i = 0; i < archives.length; i++) archives[i] = st.nextToken(); } } protected void setUp() throws Exception { // verify integration target String integrationTarget = delegate.getIntegrationTarget(); log.debug("Integration target: " + integrationTarget); List clientJars = new ArrayList(); for (int i = 0; i < archives.length; i++) { String archive = archives[i]; try { delegate.deploy(archive); } catch (Exception ex) { ex.printStackTrace(); delegate.undeploy(archive); } if (archive.endsWith("-client.jar")) { URL archiveURL = delegate.getArchiveURL(archive); clientJars.add(archiveURL); } } // add the client jars to the classloader if (!clientJars.isEmpty()) { ClassLoader parent = Thread.currentThread().getContextClassLoader(); URL[] urls = new URL[clientJars.size()]; for (int i = 0; i < clientJars.size(); i++) { urls[i] = (URL)clientJars.get(i); } URLClassLoader cl = new URLClassLoader(urls, parent); Thread.currentThread().setContextClassLoader(cl); } } protected void tearDown() throws Exception { for (int i = 0; i < archives.length; i++) { String archive = archives[archives.length - i - 1]; delegate.undeploy(archive); } } public MBeanServerConnection getServer() throws NamingException { return delegate.getServer(); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/GenericSOAPHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/test/GenericSOAPHandler.jav0000644000175000017500000000355110650145103031364 0ustar godgod/* * 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.wsf.test; import javax.xml.ws.handler.LogicalMessageContext; import javax.xml.ws.handler.soap.SOAPHandler; import javax.xml.namespace.QName; import java.util.Set; import java.util.HashSet; /** * A generic jaxws soap handler * * @author Thomas.Diesler@jboss.org * @since 13-Aug-2006 */ public abstract class GenericSOAPHandler extends GenericHandler implements SOAPHandler { // The header blocks that can be processed by this Handler instance private Set headers = new HashSet(); /** Gets the header blocks that can be processed by this Handler instance. */ public Set getHeaders() { return headers; } /** Sets the header blocks that can be processed by this Handler instance. */ public void setHeaders(Set headers) { this.headers = headers; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/0000755000175000017500000000000010755000225025633 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/0000755000175000017500000000000010755000224027260 5ustar godgod././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/JDKLogManager.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/JDKLogManage0000644000175000017500000000314610732477776031423 0ustar godgod/* * 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.wsf.common.logging; // $Id: JDKLogManager.java 5373 2007-12-20 14:45:18Z thomas.diesler@jboss.com $ import java.util.logging.LogManager; import java.util.logging.Logger; /** * A LogManager that adds a JBossLogHandler to every Logger * * @author Thomas.Diesler@jboss.com * @since 18-Dec-2007 */ public class JDKLogManager extends LogManager { @Override public synchronized Logger getLogger(String name) { Logger logger = super.getLogger(name); if (logger == null) logger = new JDKLogger(name); logger.addHandler(new JDKLogHandler()); return logger; } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/JDKLogHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/JDKLogHandle0000644000175000017500000001031710732507455031410 0ustar godgod/* * 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.wsf.common.logging; // $Id: JDKLogHandler.java 5377 2007-12-20 15:50:05Z thomas.diesler@jboss.com $ import java.util.logging.ErrorManager; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.SimpleFormatter; import org.jboss.logging.Logger; /** * A Handler (java.util.logging.Handler) class redirecting messages * to the jboss logging system. * * @author Alessio Soldano, * @author Stefano Maestri, * @author Thomas.Diesler@jboss.com * @since 14-Jun-2007 */ public class JDKLogHandler extends Handler { public JDKLogHandler() { super.setFormatter(new SimpleFormatter()); } @Override public void publish(LogRecord record) { if (isLoggable(record)) { Logger logger = getJBossLogger(record); Level level = record.getLevel(); Throwable th = record.getThrown(); if (level == Level.FINER || level == Level.FINEST) { String msg = getMessage(record); logger.trace(msg, th); } else if (level == Level.FINE) { String msg = getMessage(record); logger.debug(msg, th); } else if (level == Level.INFO || level == Level.CONFIG || level == Level.ALL) { String msg = getMessage(record); logger.info(msg, th); } else if (level == Level.WARNING) { String msg = getMessage(record); logger.warn(msg, th); } else if (level == Level.SEVERE) { String msg = getMessage(record); logger.error(msg, th); } else if (level == Level.OFF) { // do nothing } } } private Logger getJBossLogger(LogRecord record) { return Logger.getLogger(record.getLoggerName()); } private String getMessage(LogRecord record) { String msg = null; try { msg = getFormatter().formatMessage(record); } catch (Exception ex) { // We don't want to throw an exception here, but we // report the exception to any registered ErrorManager. reportError("Cannot obtain message from log record", ex, ErrorManager.FORMAT_FAILURE); } return msg; } @Override public boolean isLoggable(LogRecord record) { Logger logger = getJBossLogger(record); Level level = record.getLevel(); boolean isLoggable = false; if (level == Level.FINER || level == Level.FINEST) { isLoggable = logger.isTraceEnabled(); } else if (level == Level.FINE) { isLoggable = logger.isDebugEnabled(); } else if (level == Level.INFO || level == Level.CONFIG) { isLoggable = logger.isInfoEnabled(); } else if (level == Level.SEVERE || level == Level.WARNING || level == Level.ALL) { isLoggable = true; } return isLoggable; } @Override public void flush() { //nothing to do } @Override public void close() throws SecurityException { //nothing to do } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/JDKLogger.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/JDKLogger.ja0000644000175000017500000000334610732477776031403 0ustar godgod/* * 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.wsf.common.logging; // $Id: JDKLogger.java 5373 2007-12-20 14:45:18Z thomas.diesler@jboss.com $ import java.util.logging.Level; import java.util.logging.Logger; /** * A LogManager that adds a JBossLogHandler to every Logger * * @author Thomas.Diesler@jboss.com * @since 18-Dec-2007 */ public class JDKLogger extends Logger { protected JDKLogger(String name) { super(name, null); org.jboss.logging.Logger jbl = org.jboss.logging.Logger.getLogger(name); if (jbl.isTraceEnabled()) { setLevel(Level.FINEST); } else if (jbl.isDebugEnabled()) { setLevel(Level.FINE); } else if (jbl.isInfoEnabled()) { setLevel(Level.INFO); } } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/JDKLogRedirector.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/logging/JDKLogRedire0000644000175000017500000000616510732507455031435 0ustar godgod/* * 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.wsf.common.logging; import java.util.LinkedList; import java.util.List; import java.util.logging.ConsoleHandler; import java.util.logging.Filter; import java.util.logging.Handler; import java.util.logging.LogManager; import java.util.logging.LogRecord; import java.util.logging.Logger; /** * Redirects JDK Logger output to the JBoss Logger. * * @author Alessio Soldano, * @author Stefano Maestri, * @author Thomas.Diesler@jboss.com * @since 14-Jun-2007 */ public class JDKLogRedirector { private List namespaces = new LinkedList(); public void addNamespace(String ns) { namespaces.add(ns); } public List getNamespaces() { return namespaces; } public void setNamespaces(List namespaces) { this.namespaces = namespaces; } public void start() { modifyRootLogger(); addNamespaceHandlers(); } private void modifyRootLogger() { LogManager logManager = LogManager.getLogManager(); Logger root = logManager.getLogger(""); while (root.getParent() != null) root = root.getParent(); Handler[] handlers = root.getHandlers(); for (int i = 0; i < handlers.length; i++) { Handler handler = handlers[i]; if (handler instanceof ConsoleHandler) { Filter filter = new Filter() { public boolean isLoggable(LogRecord record) { String name = record.getLoggerName(); for (String ns : namespaces) { if (name.startsWith(ns)) return false; } return true; } }; handler.setFilter(filter); } } } private void addNamespaceHandlers() { LogManager logManager = LogManager.getLogManager(); for (String ns : namespaces) { JDKLogger log = new JDKLogger(ns); log.addHandler(new JDKLogHandler()); logManager.addLogger(log); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/management/0000755000175000017500000000000010755000225027747 5ustar godgod././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/management/AbstractServerConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/management/AbstractS0000644000175000017500000001525310655066037031602 0ustar godgod/* * 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.wsf.common.management; //$Id: AbstractServerConfig.java 4201 2007-08-04 12:07:59Z thomas.diesler@jboss.com $ import java.io.File; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Set; import javax.management.AttributeNotFoundException; import javax.management.JMException; import javax.management.MBeanServer; import javax.management.ObjectName; import org.jboss.logging.Logger; import org.jboss.wsf.common.ObjectNameFactory; import org.jboss.wsf.spi.management.ServerConfig; /** * Basic implementation of a ServerConfig * * @author Thomas.Diesler@jboss.org * @author darran.lofthouse@jboss.com * @since 08-May-2006 */ public abstract class AbstractServerConfig implements AbstractServerConfigMBean, ServerConfig { private static final Logger log = Logger.getLogger(AbstractServerConfig.class); // The MBeanServer private MBeanServer mbeanServer; // The webservice host name that will be used when updating the wsdl private String webServiceHost = UNDEFINED_HOSTNAME; // The webservice port that will be used when updating the wsdl private int webServicePort; // The webservice port that will be used when updating the wsdl private int webServiceSecurePort; // Whether we should always modify the soap address to the deployed endpoing location private boolean modifySOAPAddress; public MBeanServer getMbeanServer() { return mbeanServer; } public void setMbeanServer(MBeanServer mbeanServer) { this.mbeanServer = mbeanServer; } public String getWebServiceHost() { return webServiceHost; } public void setWebServiceHost(String host) throws UnknownHostException { if (host == null || host.trim().length() == 0) { log.debug("Using undefined host: " + UNDEFINED_HOSTNAME); host = UNDEFINED_HOSTNAME; } if ("0.0.0.0".equals(host)) { InetAddress localHost = InetAddress.getLocalHost(); log.debug("Using local host: " + localHost.getHostName()); host = localHost.getHostName(); } this.webServiceHost = host; } public void setWebServicePort(int port) { this.webServicePort = port; } public void setWebServiceSecurePort(int port) { this.webServiceSecurePort = port; } public boolean isModifySOAPAddress() { return modifySOAPAddress; } public void setModifySOAPAddress(boolean modify) { this.modifySOAPAddress = modify; } public File getServerTempDir() { try { ObjectName oname = ObjectNameFactory.create("jboss.system:type=ServerConfig"); File tmpdir = (File)getMbeanServer().getAttribute(oname, "ServerTempDir"); return tmpdir; } catch (JMException e) { return null; } } public File getServerDataDir() { try { ObjectName oname = ObjectNameFactory.create("jboss.system:type=ServerConfig"); File tmpdir = (File)getMbeanServer().getAttribute(oname, "ServerDataDir"); return tmpdir; } catch (JMException e) { return null; } } public int getWebServicePort() { if (webServicePort <= 0) webServicePort = getConnectorPort("HTTP/1.1", false); int localPort = webServicePort; if (localPort <= 0) { // Do not initialize webServicePort with the default, the connector port may become available later log.warn("Unable to calculate 'WebServicePort', using default '8080'"); localPort = 8080; } return localPort; } public int getWebServiceSecurePort() { if (webServiceSecurePort <= 0) webServiceSecurePort = getConnectorPort("HTTP/1.1", true); int localPort = webServiceSecurePort; if (localPort <= 0) { // Do not initialize webServiceSecurePort with the default, the connector port may become available later log.warn("Unable to calculate 'WebServiceSecurePort', using default '8443'"); localPort = 8443; } return localPort; } public void create() throws Exception { getMbeanServer().registerMBean(this, AbstractServerConfigMBean.OBJECT_NAME); } public void destroy() throws Exception { getMbeanServer().unregisterMBean(AbstractServerConfigMBean.OBJECT_NAME); } private int getConnectorPort(final String protocol, final boolean secure) { int port = -1; try { ObjectName connectors = new ObjectName("jboss.web:type=Connector,*"); Set connectorNames = getMbeanServer().queryNames(connectors, null); for (Object current : connectorNames) { ObjectName currentName = (ObjectName)current; try { int connectorPort = (Integer)getMbeanServer().getAttribute(currentName, "port"); boolean connectorSecure = (Boolean)getMbeanServer().getAttribute(currentName, "secure"); String connectorProtocol = (String)getMbeanServer().getAttribute(currentName, "protocol"); if (protocol.equals(connectorProtocol) && secure == connectorSecure) { if (port > -1) { log.warn("Found multiple connectors for protocol='" + protocol + "' and secure='" + secure + "', using first port found '" + port + "'"); } else { port = connectorPort; } } } catch (AttributeNotFoundException ignored) { } } return port; } catch (JMException e) { return -1; } } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/management/AbstractServerConfigMBean.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/management/AbstractS0000644000175000017500000000256010656374256031605 0ustar godgod/* * 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.wsf.common.management; import javax.management.ObjectName; import org.jboss.wsf.common.ObjectNameFactory; import org.jboss.wsf.spi.management.ServerConfig; public interface AbstractServerConfigMBean extends ServerConfig { /** The object name in the MBean server */ ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=ServerConfig"); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/ObjectNameFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/ObjectNameFactory.ja0000644000175000017500000000421610650145103031510 0ustar godgod/* * 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.wsf.common; import java.util.Hashtable; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; /** * A simple factory for creating safe object names. * * @author Thomas.Diesler@jboss.org * @since 08-May-2006 */ public class ObjectNameFactory { public static ObjectName create(String name) { try { return new ObjectName(name); } catch (MalformedObjectNameException e) { throw new Error("Invalid ObjectName: " + name + "; " + e); } } public static ObjectName create(String domain, String key, String value) { try { return new ObjectName(domain, key, value); } catch (MalformedObjectNameException e) { throw new Error("Invalid ObjectName: " + domain + "," + key + "," + value + "; " + e); } } public static ObjectName create(String domain, Hashtable table) { try { return new ObjectName(domain, table); } catch (MalformedObjectNameException e) { throw new Error("Invalid ObjectName: " + domain + "," + table + "; " + e); } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/ResourceLoaderAdapter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/ResourceLoaderAdapte0000644000175000017500000000644110654403525031630 0ustar godgod/* * 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.wsf.common; // $Id: ResourceLoaderAdapter.java 3137 2007-05-18 13:41:57Z thomas.diesler@jboss.com $ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; /** * The default file adapter loads resources through an associated classloader. * If no classload is set, the the thread context classloader will be used. * * @author Heiko.Braun@jboss.org * @since 25.01.2007 */ public class ResourceLoaderAdapter implements UnifiedVirtualFile { private URL resourceURL; private ClassLoader loader; public ResourceLoaderAdapter() { this(Thread.currentThread().getContextClassLoader()); } public ResourceLoaderAdapter(ClassLoader loader) { this.loader = loader; } private ResourceLoaderAdapter(ClassLoader loader, URL resourceURL) { this.resourceURL = resourceURL; this.loader = loader; } public UnifiedVirtualFile findChild(String resourcePath) throws IOException { URL resourceURL = null; if (resourcePath != null) { // Try the child as URL try { resourceURL = new URL(resourcePath); } catch (MalformedURLException ex) { // ignore } // Try the filename as File if (resourceURL == null) { try { File file = new File(resourcePath); if (file.exists()) resourceURL = file.toURL(); } catch (MalformedURLException e) { // ignore } } // Try the filename as Resource if (resourceURL == null) { try { resourceURL = loader.getResource(resourcePath); } catch (Exception ex) { // ignore } } } if (resourceURL == null) throw new IOException("Cannot get URL for: " + resourcePath); return new ResourceLoaderAdapter(loader, resourceURL); } public URL toURL() { if (null == this.resourceURL) throw new IllegalStateException("UnifiedVirtualFile not initialized"); return resourceURL; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/DOMUtils.java0000644000175000017500000004711610714607713030161 0ustar godgod/* * 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.wsf.common; // $Id: DOMUtils.java 5012 2007-11-08 13:31:55Z heiko.braun@jboss.com $ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.util.LinkedList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.jboss.logging.Logger; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** * DOM2 utilites * * @author Thomas.Diesler@jboss.org */ public final class DOMUtils { private static Logger log = Logger.getLogger(DOMUtils.class); // All elements created by the same thread are created by the same builder and belong to the same doc private static ThreadLocal documentThreadLocal = new ThreadLocal(); private static ThreadLocal builderThreadLocal = new ThreadLocal() { protected DocumentBuilder initialValue() { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); setEntityResolver(builder); return builder; } catch (ParserConfigurationException e) { throw new RuntimeException("Failed to create DocumentBuilder", e); } } private void setEntityResolver(DocumentBuilder builder) { String[] resolvers = new String[] { "org.jboss.ws.core.utils.JBossWSEntityResolver", "org.jboss.util.xml.JBossEntityResolver" }; EntityResolver entityResolver = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); for (String resolver : resolvers) { try { Class resolverClass = loader.loadClass(resolver); entityResolver = (EntityResolver)resolverClass.newInstance(); } catch (Exception ex) { log.debug("Cannot load: " + resolver); } } if (entityResolver != null) builder.setEntityResolver(entityResolver); } }; public static void clearThreadLocals() { documentThreadLocal.remove(); builderThreadLocal.remove(); } // Hide the constructor private DOMUtils() { } /** Initialize the DocumentBuilder */ public static DocumentBuilder getDocumentBuilder() { return builderThreadLocal.get(); } /** Parse the given XML string and return the root Element */ public static Element parse(String xmlString) throws IOException { try { return parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8"))); } catch (IOException e) { log.error("Cannot parse: " + xmlString); throw e; } } /** Parse the given XML stream and return the root Element */ public static Element parse(InputStream xmlStream) throws IOException { try { return getDocumentBuilder().parse(xmlStream).getDocumentElement(); } catch (SAXException se) { throw new IOException(se.toString()); } } /** Parse the given input source and return the root Element */ public static Element parse(InputSource source) throws IOException { try { return getDocumentBuilder().parse(source).getDocumentElement(); } catch (SAXException se) { throw new IOException(se.toString()); } } /** Create an Element for a given name */ public static Element createElement(String localPart) { Document doc = getOwnerDocument(); log.trace("createElement {}" + localPart); return doc.createElement(localPart); } /** Create an Element for a given name and prefix */ public static Element createElement(String localPart, String prefix) { Document doc = getOwnerDocument(); log.trace("createElement {}" + prefix + ":" + localPart); return doc.createElement(prefix + ":" + localPart); } /** Create an Element for a given name, prefix and uri */ public static Element createElement(String localPart, String prefix, String uri) { Document doc = getOwnerDocument(); if (prefix == null || prefix.length() == 0) { log.trace("createElement {" + uri + "}" + localPart); return doc.createElementNS(uri, localPart); } else { log.trace("createElement {" + uri + "}" + prefix + ":" + localPart); return doc.createElementNS(uri, prefix + ":" + localPart); } } /** Create an Element for a given QName */ public static Element createElement(QName qname) { return createElement(qname.getLocalPart(), qname.getPrefix(), qname.getNamespaceURI()); } /** Create a org.w3c.dom.Text node */ public static Text createTextNode(String value) { Document doc = getOwnerDocument(); return doc.createTextNode(value); } /** Get the qname of the given node. */ public static QName getElementQName(Element el) { String qualifiedName = el.getNodeName(); return resolveQName(el, qualifiedName); } /** Transform the given qualified name into a QName */ public static QName resolveQName(Element el, String qualifiedName) { QName qname; String prefix = ""; String namespaceURI = ""; String localPart = qualifiedName; int colIndex = qualifiedName.indexOf(":"); if (colIndex > 0) { prefix = qualifiedName.substring(0, colIndex); localPart = qualifiedName.substring(colIndex + 1); if ("xmlns".equals(prefix)) { namespaceURI = "URI:XML_PREDEFINED_NAMESPACE"; } else { Element nsElement = el; while (namespaceURI.equals("") && nsElement != null) { namespaceURI = nsElement.getAttribute("xmlns:" + prefix); if (namespaceURI.equals("")) nsElement = getParentElement(nsElement); } } if (namespaceURI.equals("")) throw new IllegalArgumentException("Cannot find namespace uri for: " + qualifiedName); } else { Element nsElement = el; while (namespaceURI.equals("") && nsElement != null) { namespaceURI = nsElement.getAttribute("xmlns"); if (namespaceURI.equals("")) nsElement = getParentElement(nsElement); } } qname = new QName(namespaceURI, localPart, prefix); return qname; } /** Get the value from the given attribute * * @return null if the attribute value is empty or the attribute is not present */ public static String getAttributeValue(Element el, String attrName) { return getAttributeValue(el, new QName(attrName)); } /** Get the value from the given attribute * * @return null if the attribute value is empty or the attribute is not present */ public static String getAttributeValue(Element el, QName attrName) { String attr = null; if ("".equals(attrName.getNamespaceURI())) attr = el.getAttribute(attrName.getLocalPart()); else attr = el.getAttributeNS(attrName.getNamespaceURI(), attrName.getLocalPart()); if ("".equals(attr)) attr = null; return attr; } /** Get the qname value from the given attribute */ public static QName getAttributeValueAsQName(Element el, String attrName) { return getAttributeValueAsQName(el, new QName(attrName)); } /** Get the qname value from the given attribute */ public static QName getAttributeValueAsQName(Element el, QName attrName) { QName qname = null; String qualifiedName = getAttributeValue(el, attrName); if (qualifiedName != null) { qname = resolveQName(el, qualifiedName); } return qname; } /** Get the boolean value from the given attribute */ public static boolean getAttributeValueAsBoolean(Element el, String attrName) { return getAttributeValueAsBoolean(el, new QName(attrName)); } /** Get the boolean value from the given attribute */ public static boolean getAttributeValueAsBoolean(Element el, QName attrName) { String attrVal = getAttributeValue(el, attrName); boolean ret = "true".equalsIgnoreCase(attrVal) || "1".equalsIgnoreCase(attrVal); return ret; } /** Get the integer value from the given attribute */ public static Integer getAttributeValueAsInteger(Element el, String attrName) { return getAttributeValueAsInteger(el, new QName(attrName)); } /** Get the integer value from the given attribute */ public static Integer getAttributeValueAsInteger(Element el, QName attrName) { String attrVal = getAttributeValue(el, attrName); return (attrVal != null ? new Integer(attrVal) : null); } /** Get the attributes as Map */ public static Map getAttributes(Element el) { Map attmap = new HashMap(); NamedNodeMap attribs = el.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attr = (Attr)attribs.item(i); String name = attr.getName(); QName qname = resolveQName(el, name); String value = attr.getNodeValue(); attmap.put(qname, value); } return attmap; } /** Copy attributes between elements */ public static void copyAttributes(Element destElement, Element srcElement) { NamedNodeMap attribs = srcElement.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attr = (Attr)attribs.item(i); String uri = attr.getNamespaceURI(); String qname = attr.getName(); String value = attr.getNodeValue(); // Prevent DOMException: NAMESPACE_ERR: An attempt is made to create or // change an object in a way which is incorrect with regard to namespaces. if (uri == null && qname.startsWith("xmlns")) { log.trace("Ignore attribute: [uri=" + uri + ",qname=" + qname + ",value=" + value + "]"); } else { destElement.setAttributeNS(uri, qname, value); } } } /** True if the node has text child elements only */ public static boolean hasTextChildNodesOnly(Node node) { NodeList nodeList = node.getChildNodes(); if (nodeList.getLength() == 0) return false; for (int i = 0; i < nodeList.getLength(); i++) { Node acksToChildNode = nodeList.item(i); if (acksToChildNode.getNodeType() != Node.TEXT_NODE) return false; } return true; } /** True if the node has child elements */ public static boolean hasChildElements(Node node) { NodeList nlist = node.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) return true; } return false; } /** Gets child elements */ public static Iterator getChildElements(Node node) { List list = new LinkedList(); NodeList nlist = node.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) list.add((Element)child); } return list.iterator(); } /** Get the concatenated text content, or null. */ public static String getTextContent(Node node) { boolean hasTextContent = false; StringBuffer buffer = new StringBuffer(); NodeList nlist = node.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); if (child.getNodeType() == Node.TEXT_NODE) { buffer.append(child.getNodeValue()); hasTextContent = true; } } return (hasTextContent ? buffer.toString() : null); } /** Gets the first child element */ public static Element getFirstChildElement(Node node) { return getFirstChildElementIntern(node, null); } /** Gets the first child element for a given local name without namespace */ public static Element getFirstChildElement(Node node, String nodeName) { return getFirstChildElementIntern(node, new QName(nodeName)); } /** Gets the first child element for a given qname */ public static Element getFirstChildElement(Node node, QName nodeName) { return getFirstChildElementIntern(node, nodeName); } private static Element getFirstChildElementIntern(Node node, QName nodeName) { Element childElement = null; Iterator it = getChildElementsIntern(node, nodeName); if (it.hasNext()) { childElement = (Element)it.next(); } return childElement; } /** Gets the child elements for a given local name without namespace */ public static Iterator getChildElements(Node node, String nodeName) { return getChildElementsIntern(node, new QName(nodeName)); } /** Gets the child element for a given qname */ public static Iterator getChildElements(Node node, QName nodeName) { return getChildElementsIntern(node, nodeName); } public static List getChildElementsAsList(Node node, String nodeName) { return getChildElementsAsListIntern(node, new QName(nodeName)); } public static List getChildElementsAsList(Node node, QName nodeName) { return getChildElementsAsListIntern(node, nodeName); } private static List getChildElementsAsListIntern(Node node, QName nodeName) { List list = new LinkedList(); NodeList nlist = node.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { if (nodeName == null) { list.add((Element)child); } else { QName qname; if (nodeName.getNamespaceURI().length() > 0) { qname = new QName(child.getNamespaceURI(), child.getLocalName()); } else { qname = new QName(child.getLocalName()); } if (qname.equals(nodeName)) { list.add((Element)child); } } } } return list; } private static Iterator getChildElementsIntern(Node node, QName nodeName) { return getChildElementsAsListIntern(node, nodeName).iterator(); } /** Gets parent element or null if there is none */ public static Element getParentElement(Node node) { Node parent = node.getParentNode(); return (parent instanceof Element ? (Element)parent : null); } /** Get the owner document that is associated with the current thread */ public static Document getOwnerDocument() { Document doc = documentThreadLocal.get(); if (doc == null) { doc = getDocumentBuilder().newDocument(); documentThreadLocal.set(doc); } return doc; } public static Element sourceToElement(Source source) throws IOException { Element retElement = null; try { if (source instanceof StreamSource) { StreamSource streamSource = (StreamSource)source; InputStream ins = streamSource.getInputStream(); if (ins != null) { retElement = DOMUtils.parse(ins); } else { Reader reader = streamSource.getReader(); retElement = DOMUtils.parse(new InputSource(reader)); } } else if (source instanceof DOMSource) { DOMSource domSource = (DOMSource)source; Node node = domSource.getNode(); if (node instanceof Element) { retElement = (Element)node; } else if (node instanceof Document) { retElement = ((Document)node).getDocumentElement(); } else { throw new RuntimeException("Unsupported Node type: " + node.getClass().getName()); } } else if (source instanceof SAXSource) { // The fact that JAXBSource derives from SAXSource is an implementation detail. // Thus in general applications are strongly discouraged from accessing methods defined on SAXSource. // The XMLReader object obtained by the getXMLReader method shall be used only for parsing the InputSource object returned by the getInputSource method. TransformerFactory tf = TransformerFactory.newInstance(); ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); Transformer transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.transform(source, new StreamResult(baos)); retElement = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray())); } else { throw new RuntimeException("Source type not implemented: " + source.getClass().getName()); } } catch (TransformerException ex) { IOException ioex = new IOException(); ioex.initCause(ex); throw ioex; } return retElement; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/JavaUtils.java0000644000175000017500000004641510650145103030411 0ustar godgod/* * 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.wsf.common; // $Id: JavaUtils.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.lang.reflect.*; import java.util.HashMap; import java.util.HashSet; import org.jboss.logging.Logger; /** Java utilities * * @author Thomas.Diesler@jboss.org * @since 22-Dec-2004 */ public class JavaUtils { // provide logging private static final Logger log = Logger.getLogger(JavaUtils.class); private static HashMap primitiveNames = new HashMap(8); private static HashMap primitiveNameDescriptors = new HashMap(8); private static HashSet reservedKeywords = new HashSet(50); static { primitiveNames.put("int", int.class); primitiveNames.put("short", short.class); primitiveNames.put("boolean", boolean.class); primitiveNames.put("byte", byte.class); primitiveNames.put("long", long.class); primitiveNames.put("double", double.class); primitiveNames.put("float", float.class); primitiveNames.put("char", char.class); primitiveNameDescriptors.put("int", "I"); primitiveNameDescriptors.put("short", "S"); primitiveNameDescriptors.put("boolean", "Z"); primitiveNameDescriptors.put("byte", "B"); primitiveNameDescriptors.put("long", "J"); primitiveNameDescriptors.put("double", "D"); primitiveNameDescriptors.put("float", "F"); primitiveNameDescriptors.put("char", "C"); reservedKeywords.add("abstract"); reservedKeywords.add("continue"); reservedKeywords.add("for"); reservedKeywords.add("new"); reservedKeywords.add("switch"); reservedKeywords.add("assert"); reservedKeywords.add("default"); reservedKeywords.add("if"); reservedKeywords.add("package"); reservedKeywords.add("synchronized"); reservedKeywords.add("boolean"); reservedKeywords.add("do"); reservedKeywords.add("goto"); reservedKeywords.add("private"); reservedKeywords.add("this"); reservedKeywords.add("break"); reservedKeywords.add("double"); reservedKeywords.add("implements"); reservedKeywords.add("protected"); reservedKeywords.add("throw"); reservedKeywords.add("byte"); reservedKeywords.add("else"); reservedKeywords.add("import"); reservedKeywords.add("public"); reservedKeywords.add("throws"); reservedKeywords.add("case"); reservedKeywords.add("enum"); reservedKeywords.add("instanceof"); reservedKeywords.add("return"); reservedKeywords.add("transient"); reservedKeywords.add("catch"); reservedKeywords.add("extends"); reservedKeywords.add("int"); reservedKeywords.add("short"); reservedKeywords.add("try"); reservedKeywords.add("char"); reservedKeywords.add("final"); reservedKeywords.add("interface"); reservedKeywords.add("static"); reservedKeywords.add("void"); reservedKeywords.add("class"); reservedKeywords.add("finally"); reservedKeywords.add("long"); reservedKeywords.add("strictfp"); reservedKeywords.add("volatile"); reservedKeywords.add("const"); reservedKeywords.add("float"); reservedKeywords.add("native"); reservedKeywords.add("super"); reservedKeywords.add("while"); } /** * Load a Java type from a given class loader. * * @param typeName maybe the source notation of a primitve, class name, array of both */ public static Class loadJavaType(String typeName) throws ClassNotFoundException { return loadJavaType(typeName, null); } /** * Load a Java type from a given class loader. * * @param typeName maybe the source notation of a primitve, class name, array of both */ public static Class loadJavaType(String typeName, ClassLoader classLoader) throws ClassNotFoundException { if (classLoader == null) classLoader = Thread.currentThread().getContextClassLoader(); Class javaType = primitiveNames.get(typeName); if (javaType == null) javaType = getArray(typeName, classLoader); if (javaType == null) javaType = classLoader.loadClass(typeName); return javaType; } /** * True if the given type name is the source notation of a primitive or array of which. */ public static boolean isPrimitive(String javaType) { return getPrimitiveType(javaType) != null; } /** * True if the given class is a primitive or array of which. */ public static boolean isPrimitive(Class javaType) { return javaType.isPrimitive() || (javaType.isArray() && isPrimitive(javaType.getComponentType())); } public static Class getPrimitiveType(String javaType) { Class type = primitiveNames.get(javaType); if (type != null) return type; try { // null loader = primitive only type = getArray(javaType, null); } catch (ClassNotFoundException e) { // This will actually never be thrown since is null } return type; } private static Class getArray(String javaType, ClassLoader loader) throws ClassNotFoundException { if (javaType.charAt(0) == '[') return getArrayFromJVMName(javaType, loader); if (javaType.endsWith("[]")) return getArrayFromSourceName(javaType, loader); return null; } private static Class getArrayFromJVMName(String javaType, ClassLoader loader) throws ClassNotFoundException { Class componentType; int componentStart = javaType.lastIndexOf('[') + 1; switch (javaType.charAt(componentStart)) { case 'I': componentType = int.class; break; case 'S': componentType = short.class; break; case 'Z': componentType = boolean.class; break; case 'B': componentType = byte.class; break; case 'J': componentType = long.class; break; case 'D': componentType = double.class; break; case 'F': componentType = float.class; break; case 'C': componentType = char.class; break; case 'L': if (loader == null) return null; String name = javaType.substring(componentStart + 1, javaType.length() - 1); componentType = loader.loadClass(name); break; default: throw new IllegalArgumentException("Invalid binary component for array: " + javaType.charAt(componentStart)); } // componentStart doubles as the number of '['s which is the number of dimensions return Array.newInstance(componentType, new int[componentStart]).getClass(); } private static Class getArrayFromSourceName(String javaType, ClassLoader loader) throws ClassNotFoundException { int arrayStart = javaType.indexOf('['); String componentName = javaType.substring(0, arrayStart); Class componentType = primitiveNames.get(componentName); if (componentType == null) { if (loader == null) return null; componentType = loader.loadClass(componentName); } // [][][][] divided by 2 int dimensions = (javaType.length() - arrayStart) >> 1; return Array.newInstance(componentType, new int[dimensions]).getClass(); } /** * Get the corresponding primitive for a give wrapper type. * Also handles arrays of which. */ public static Class getPrimitiveType(Class javaType) { if (javaType == Integer.class) return int.class; if (javaType == Short.class) return short.class; if (javaType == Boolean.class) return boolean.class; if (javaType == Byte.class) return byte.class; if (javaType == Long.class) return long.class; if (javaType == Double.class) return double.class; if (javaType == Float.class) return float.class; if (javaType == Character.class) return char.class; if (javaType == Integer[].class) return int[].class; if (javaType == Short[].class) return short[].class; if (javaType == Boolean[].class) return boolean[].class; if (javaType == Byte[].class) return byte[].class; if (javaType == Long[].class) return long[].class; if (javaType == Double[].class) return double[].class; if (javaType == Float[].class) return float[].class; if (javaType == Character[].class) return char[].class; if (javaType.isArray() && javaType.getComponentType().isArray()) { Class compType = getPrimitiveType(javaType.getComponentType()); return Array.newInstance(compType, 0).getClass(); } return javaType; } /** * Converts an n-dimensional array of wrapper types to primitive types */ public static Object getPrimitiveValueArray(Object value) { if (value == null) return null; Class javaType = value.getClass(); if (javaType.isArray()) { int length = Array.getLength(value); Object destArr = Array.newInstance(getPrimitiveType(javaType.getComponentType()), length); for (int i = 0; i < length; i++) { Object srcObj = Array.get(value, i); Array.set(destArr, i, getPrimitiveValueArray(srcObj)); } return destArr; } return value; } /** * Get the corresponding wrapper type for a give primitive. * Also handles arrays of which. */ public static Class getWrapperType(Class javaType) { if (javaType == int.class) return Integer.class; if (javaType == short.class) return Short.class; if (javaType == boolean.class) return Boolean.class; if (javaType == byte.class) return Byte.class; if (javaType == long.class) return Long.class; if (javaType == double.class) return Double.class; if (javaType == float.class) return Float.class; if (javaType == char.class) return Character.class; if (javaType == int[].class) return Integer[].class; if (javaType == short[].class) return Short[].class; if (javaType == boolean[].class) return Boolean[].class; if (javaType == byte[].class) return Byte[].class; if (javaType == long[].class) return Long[].class; if (javaType == double[].class) return Double[].class; if (javaType == float[].class) return Float[].class; if (javaType == char[].class) return Character[].class; if (javaType.isArray() && javaType.getComponentType().isArray()) { Class compType = getWrapperType(javaType.getComponentType()); return Array.newInstance(compType, 0).getClass(); } return javaType; } /** * Converts an n-dimensional array of primitive types to wrapper types */ public static Object getWrapperValueArray(Object value) { if (value == null) return null; Class javaType = value.getClass(); if (javaType.isArray()) { int length = Array.getLength(value); Object destArr = Array.newInstance(getWrapperType(javaType.getComponentType()), length); for (int i = 0; i < length; i++) { Object srcObj = Array.get(value, i); Array.set(destArr, i, getWrapperValueArray(srcObj)); } return destArr; } return value; } public static Object syncArray(Object array, Class target) { return (JavaUtils.isPrimitive(target)) ? JavaUtils.getPrimitiveValueArray(array) : JavaUtils.getWrapperValueArray(array); } /** * Return true if the dest class is assignable from the src. * Also handles arrays and primitives. */ public static boolean isAssignableFrom(Class dest, Class src) { if (dest == null) throw new IllegalArgumentException("Destination class cannot be null"); if (src == null) throw new IllegalArgumentException("Source class cannot be null"); boolean isAssignable = dest.isAssignableFrom(src); if (isAssignable == false && dest.getName().equals(src.getName())) { ClassLoader destLoader = dest.getClassLoader(); ClassLoader srcLoader = src.getClassLoader(); if(log.isDebugEnabled()) log.debug("Not assignable because of conflicting class loaders:\ndstLoader=" + destLoader + "\nsrcLoader=" + srcLoader); } if (isAssignable == false && isPrimitive(dest)) { dest = getWrapperType(dest); isAssignable = dest.isAssignableFrom(src); } if (isAssignable == false && isPrimitive(src)) { src = getWrapperType(src); isAssignable = dest.isAssignableFrom(src); } return isAssignable; } public static String convertJVMNameToSourceName(String typeName, ClassLoader loader) { // TODO Don't use a ClassLoader for this, we need to just convert it try { Class javaType = loadJavaType(typeName, loader); typeName = getSourceName(javaType); } catch (Exception e) { } return typeName; } /** * Converts a JVM external name to a JVM signature name. An external name is * that which is returned from {@link Class#getName()} A signature name is * the name in class file format. *

* For example: *

* [java.lang.Object *

* becomes: *

* [Ljava/lang/Object; * * @param externalName * @return */ public static String toSignature(String externalName) { if (externalName == null) return null; String ret = primitiveNameDescriptors.get(externalName); if (ret != null) return ret; ret = externalName.replace('.', '/'); return (ret.charAt(0) == '[') ? ret : "L" + ret + ";"; } public static String printArray(Object[] val) { if (val == null) return "null"; StringBuilder out = new StringBuilder("["); for (int i = 0; i < val.length; i++) { if (i > 0) { out.append(","); } out.append(val[i].getClass().isArray() ? printArray((Object[])val[i]) : val[i]); } return out.append("]").toString(); } public static String getSourceName(Class type) { if (! type.isArray()) return type.getName(); String arrayNotation = ""; Class component = type; while(component.isArray()) { component = component.getComponentType(); arrayNotation += "[]"; } return component.getName() + arrayNotation; } public static String capitalize(String source) { if (source == null) return null; if (source.length() == 0) return source; if (Character.isUpperCase(source.charAt(0))) return source; char c = Character.toUpperCase(source.charAt(0)); return c + source.substring(1); } public static boolean isLoaded(String className, ClassLoader loader) { try { loadJavaType(className, loader); } catch (ClassNotFoundException e) { return false; } return true; } public static String getPackageName(Class clazz) { String fullName = clazz.getName(); return fullName.substring(0, fullName.lastIndexOf(".")); } public static boolean isReservedKeyword(String keyword) { return reservedKeywords.contains(keyword); } /** * Erases a type according to the JLS type erasure rules * * @param t type to erase * @return erased type */ public static Class erasure(Type type) { if (type instanceof ParameterizedType) { return erasure(((ParameterizedType)type).getRawType()); } if (type instanceof TypeVariable) { return erasure(((TypeVariable)type).getBounds()[0]); } if (type instanceof WildcardType) { return erasure(((WildcardType)type).getUpperBounds()[0]); } if (type instanceof GenericArrayType) { return Array.newInstance(erasure(((GenericArrayType)type).getGenericComponentType()), 0).getClass(); } // Only type left is class return (Class)type; } public static String[] getRawParameterTypeArguments(ParameterizedType type) { Type[] arguments = type.getActualTypeArguments(); String[] ret = new String[arguments.length]; for (int i = 0; i < arguments.length; i++) { Class raw = erasure(arguments[i]); ret[i] = raw.getName(); } return ret; } /** * This method tests for retro translation by searching for a known problem where Class * does not implement Type. If this is true, then code must never cast a Class to a Type. * * @return true if we are in retro */ public static boolean isRetro14() { return !(String.class instanceof java.lang.reflect.Type); } /** * Tests if this class loader is a JBoss RepositoryClassLoader * * @param loader * @return */ public static boolean isJBossRepositoryClassLoader(ClassLoader loader) { Class clazz = loader.getClass(); while (!clazz.getName().startsWith("java")) { if ("org.jboss.mx.loading.RepositoryClassLoader".equals(clazz.getName())) return true; clazz = clazz.getSuperclass(); } return false; } /** * Clears black lists on a JBoss RepositoryClassLoader. This is somewhat of a hack, and * could be replaced with an integration module. This is needed when the following order of * events occur. * *

    *
  1. loadClass() returns not found
  2. *
  3. Some call to defineClass()
  4. *
      * * The CNFE triggers a black list addition, which cause the class never again to be found. * * @param loader the loader to clear black lists for */ public static void clearBlacklists(ClassLoader loader) { if (isJBossRepositoryClassLoader(loader)) { for(Method m : loader.getClass().getMethods()) { if("clearBlackLists".equalsIgnoreCase(m.getName())) { try { m.invoke(loader); } catch (Exception e) { if(log.isDebugEnabled()) log.debug("Could not clear blacklists on " + loader); } } } } } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/IOUtils.java0000644000175000017500000001132610714607713030043 0ustar godgod/* * 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.wsf.common; // $Id: IOUtils.java 5012 2007-11-08 13:31:55Z heiko.braun@jboss.com $ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; import javax.activation.DataHandler; import javax.xml.ws.WebServiceException; import org.jboss.wsf.spi.management.ServerConfig; import org.jboss.wsf.spi.management.ServerConfigFactory; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; /** * IO utilites * * @author Thomas.Diesler@jboss.org */ public final class IOUtils { // Hide the constructor private IOUtils() { } public static Writer getCharsetFileWriter(File file, String charset) throws IOException { return new OutputStreamWriter(new FileOutputStream(file), charset); } /** Copy the input stream to the output stream */ public static void copyStream(OutputStream outs, InputStream ins) throws IOException { try { byte[] bytes = new byte[1024]; int r = ins.read(bytes); while (r > 0) { outs.write(bytes, 0, r); r = ins.read(bytes); } } catch (IOException e) { throw e; } finally{ ins.close(); } } /** Copy the reader to the output stream */ public static void copyReader(OutputStream outs, Reader reader) throws IOException { try { OutputStreamWriter writer = new OutputStreamWriter(outs); char[] bytes = new char[1024]; int r = reader.read(bytes); while (r > 0) { writer.write(bytes, 0, r); r = reader.read(bytes); } } catch (IOException e) { throw e; } finally{ reader.close(); } } public static byte[] convertToBytes(DataHandler dh) { try { ByteArrayOutputStream buffOS = new ByteArrayOutputStream(); dh.writeTo(buffOS); return buffOS.toByteArray(); } catch (IOException e) { throw new WebServiceException("Unable to convert DataHandler to byte[]: " + e.getMessage()); } } /** * Transform a Reader to an InputStream * Background is that DocumentBuilder.parse() cannot take the Reader directly */ public static InputStream transformReader(Reader reader) throws IOException { try { int capacity = 1024; char[] charBuffer = new char[capacity]; StringBuffer strBuffer = new StringBuffer(capacity); int len = reader.read(charBuffer, 0, capacity); while (len > 0) { strBuffer.append(charBuffer, 0, len); len = reader.read(charBuffer, 0, capacity); } return new ByteArrayInputStream(strBuffer.toString().getBytes()); } catch (IOException e) { throw e; } finally{ reader.close(); } } public static File createTempDirectory() throws IOException { File tmpdir = null; try { // TODO: recursive dependency, ohoh SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); ServerConfig config = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig(); tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/jbossws"); tmpdir.mkdirs(); } catch (Throwable t) { // Use the Java temp directory if there is no server config (the client) } return tmpdir; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/KernelAwareSPIFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/KernelAwareSPIFactor0000644000175000017500000000314210654321205031473 0ustar godgod/* * 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.wsf.common; import org.jboss.kernel.Kernel; import org.jboss.kernel.spi.registry.KernelRegistry; import org.jboss.kernel.spi.registry.KernelRegistryEntry; import org.jboss.wsf.spi.util.KernelLocator; /** * @author Heiko.Braun@jboss.com * Created: Jul 19, 2007 */ public class KernelAwareSPIFactory { public T getKernelProvidedSPI(String beanName, Class spiArtifact) { Kernel kernel = KernelLocator.getKernel(); KernelRegistry registry = kernel.getRegistry(); KernelRegistryEntry entry = registry.getEntry(beanName); return (T)entry.getTarget(); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/URLLoaderAdapter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/URLLoaderAdapter.jav0000644000175000017500000000660110654403525031442 0ustar godgod/* * 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.wsf.common; // $Id: URLLoaderAdapter.java 3830 2007-07-09 17:01:33Z heiko.braun@jboss.com $ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; /** * Load resources through a URLClassLoader.
      * NOTE: The associated classloader doesn't do parent delegation. * * * @author Heiko.Braun@jboss.org * @since 25.01.2007 */ public class URLLoaderAdapter implements UnifiedVirtualFile { private URL rootURL; private URL resourceURL; private transient URLClassLoader loader; public URLLoaderAdapter(URL rootURL) { this.rootURL = rootURL; } private URLLoaderAdapter(URL rootURL, URLClassLoader loader, URL resourceURL) { this.rootURL = rootURL; this.resourceURL = resourceURL; this.loader = loader; } public UnifiedVirtualFile findChild(String resourcePath) throws IOException { URL resourceURL = null; if (resourcePath != null) { // Try the child as URL try { resourceURL = new URL(resourcePath); } catch (MalformedURLException ex) { // ignore } // Try the filename as File if (resourceURL == null) { try { File file = new File(resourcePath); if (file.exists()) resourceURL = file.toURL(); } catch (MalformedURLException e) { // ignore } } // Try the filename as Resource if (resourceURL == null) { try { resourceURL = getResourceLoader().getResource(resourcePath); } catch (Exception ex) { // ignore } } } if (resourceURL == null) throw new IOException("Cannot get URL for: " + resourcePath); return new URLLoaderAdapter(rootURL, loader, resourceURL); } public URL toURL() { if (resourceURL != null) return resourceURL; else return rootURL; } private URLClassLoader getResourceLoader() { if (loader == null) { loader = new URLClassLoader(new URL[] { rootURL }); } return loader; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-common/org/jboss/wsf/common/DOMWriter.java0000644000175000017500000004255210650145103030321 0ustar godgod/* * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package org.jboss.wsf.common; // $Id: DOMWriter.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Traverse a DOM tree in order to print a document that is parsed. * * @author Andy Clark, IBM * @author Thomas.Diesler@jboss.org * @version $Revision: 3959 $ */ public class DOMWriter { // Print writer private PrintWriter out; // True, if canonical output private boolean canonical; // True, if pretty printing should be used private boolean prettyprint; // True, if the XML declaration should be written private boolean writeXMLDeclaration; // Explicit character set encoding private String charsetName; // indent for the pretty printer private int prettyIndent; // True, if the XML declaration has been written private boolean wroteXMLDeclaration; // The node that started the write private Node rootNode; // True if we want namespace completion private boolean completeNamespaces = true; // The current default namespace private String currentDefaultNamespace; public DOMWriter(Writer w) { this.out = new PrintWriter(w); } public DOMWriter(Writer w, String charsetName) { this.out = new PrintWriter(w); this.charsetName = charsetName; this.writeXMLDeclaration = true; } public DOMWriter(OutputStream stream) { try { this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); } catch (UnsupportedEncodingException e) { // ignore, UTF-8 should be available } } public DOMWriter(OutputStream stream, String charsetName) { try { this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName)); this.charsetName = charsetName; this.writeXMLDeclaration = true; } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Unsupported encoding: " + charsetName); } } /** * Print a node with explicit prettyprinting. * The defaults for all other DOMWriter properties apply. * */ public static String printNode(Node node, boolean prettyprint) { StringWriter strw = new StringWriter(); new DOMWriter(strw).setPrettyprint(prettyprint).print(node); return strw.toString(); } public boolean isCanonical() { return canonical; } /** * Set wheter entities should appear in their canonical form. * The default is false. */ public DOMWriter setCanonical(boolean canonical) { this.canonical = canonical; return this; } /** * Set wheter subelements should have their namespaces completed. * Setting this to false may lead to invalid XML fragments. * The default is true. */ public DOMWriter setCompleteNamespaces(boolean complete) { this.completeNamespaces = complete; return this; } public boolean isPrettyprint() { return prettyprint; } /** * Set wheter element should be indented. * The default is false. */ public DOMWriter setPrettyprint(boolean prettyprint) { this.prettyprint = prettyprint; return this; } public boolean isWriteXMLDeclaration() { return writeXMLDeclaration; } /** * Set wheter the XML declaration should be written. * The default is false. */ public DOMWriter setWriteXMLDeclaration(boolean flag) { this.writeXMLDeclaration = flag; return this; } public void print(Node node) { rootNode = node; printInternal(node, false); } private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print(""); if (prettyprint) out.println(); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); Map nsMap = new HashMap(); String elPrefix = node.getPrefix(); String elNamespaceURI = node.getNamespaceURI(); if (elPrefix != null) { String nsURI = getNamespaceURI(elPrefix, element, rootNode); nsMap.put(elPrefix, nsURI); } Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String atPrefix = attr.getPrefix(); String atName = attr.getNodeName(); String atValue = normalize(attr.getNodeValue(), canonical); if (atName.equals("xmlns")) currentDefaultNamespace = atValue; if (atPrefix != null && !atPrefix.equals("xmlns") && !atPrefix.equals("xml")) { String nsURI = getNamespaceURI(atPrefix, element, rootNode); nsMap.put(atPrefix, nsURI); // xsi:type='ns1:SubType', xsi:type='xsd:string' if (atName.equals(atPrefix + ":type") && atValue.indexOf(":") > 0) { // xsi defined on the envelope if (nsURI == null) nsURI = getNamespaceURI(atPrefix, element, null); if ("http://www.w3.org/2001/XMLSchema-instance".equals(nsURI)) { String typePrefix = atValue.substring(0, atValue.indexOf(":")); String typeURI = getNamespaceURI(typePrefix, element, rootNode); nsMap.put(typePrefix, typeURI); } } } out.print(" " + atName + "='" + atValue + "'"); } // Add namespace declaration for prefixes // that are defined further up the tree if (completeNamespaces) { Iterator itPrefix = nsMap.keySet().iterator(); while (itPrefix.hasNext()) { String prefix = (String)itPrefix.next(); String nsURI = (String)nsMap.get(prefix); if (nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } } } // The SAX ContentHandler will by default not add the namespace declaration // World if (elPrefix == null && elNamespaceURI != null) { String defaultNamespace = element.getAttribute("xmlns"); if (defaultNamespace.length() == 0 && !elNamespaceURI.equals(currentDefaultNamespace)) { out.print(" xmlns='" + elNamespaceURI + "'"); currentDefaultNamespace = elNamespaceURI; } } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue(), canonical)); } else { out.print(""); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue(), canonical); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print(" 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print(""); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); } private String getNamespaceURI(String prefix, Element element, Node stopNode) { Node parent = element.getParentNode(); String nsURI = element.getAttribute("xmlns:" + prefix); if (nsURI.length() == 0 && element != stopNode && parent instanceof Element) return getNamespaceURI(prefix, (Element)parent, stopNode); return (nsURI.length() > 0 ? nsURI : null); } private boolean isEndMarkerIndented(Node node) { if (prettyprint) { NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node children = childNodes.item(i); if (children.getNodeType() == Node.ELEMENT_NODE) { return true; } } } return false; } /** Returns a sorted list of attributes. */ private Attr[] sortAttributes(NamedNodeMap attrs) { int len = (attrs != null) ? attrs.getLength() : 0; Attr array[] = new Attr[len]; for (int i = 0; i < len; i++) { array[i] = (Attr)attrs.item(i); } for (int i = 0; i < len - 1; i++) { String name = array[i].getNodeName(); int index = i; for (int j = i + 1; j < len; j++) { String curName = array[j].getNodeName(); if (curName.compareTo(name) < 0) { name = curName; index = j; } } if (index != i) { Attr temp = array[i]; array[i] = array[index]; array[index] = temp; } } return (array); } /** Normalizes the given string. */ public static String normalize(String s, boolean canonical) { StringBuffer str = new StringBuffer(); int len = (s != null) ? s.length() : 0; for (int i = 0; i < len; i++) { char ch = s.charAt(i); switch (ch) { case '<': { str.append("<"); break; } case '>': { str.append(">"); break; } case '&': { str.append("&"); break; } case '"': { str.append("""); break; } case '\'': { str.append("'"); break; } case '\r': case '\n': { if (canonical) { str.append("&#"); str.append(Integer.toString(ch)); str.append(';'); break; } // else, default append char } default: { str.append(ch); } } } return (str.toString()); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/0000755000175000017500000000000010755000234021140 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/0000755000175000017500000000000010755000234021727 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/0000755000175000017500000000000010755000234023047 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/0000755000175000017500000000000010755000234023646 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/0000755000175000017500000000000010755000241024437 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/http/0000755000175000017500000000000010755000234025420 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/http/HttpContext.java0000644000175000017500000000255010654357356030573 0ustar godgod/* * 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.wsf.spi.http; import org.jboss.wsf.spi.deployment.Extensible; // $Id: HttpContext.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * An abstract HTTP Context * * @author Thomas.Diesler@jboss.org * @since 07-Jul-2006 */ public interface HttpContext extends Extensible { HttpServer getHttpServer(); String getContextRoot(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/http/HttpServer.java0000644000175000017500000000337710654357356030425 0ustar godgod/* * 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.wsf.spi.http; // $Id: HttpServer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.ws.Endpoint; import org.jboss.wsf.spi.deployment.Extensible; /** * An abstract HTTP Server * * @author Thomas.Diesler@jboss.org * @since 07-Jul-2006 */ public interface HttpServer extends Extensible { /** The default bean name */ String BEAN_NAME = "WSHTTPServer"; /** Start an instance of this HTTP server */ void start(); /** Create an HTTP context */ HttpContext createContext(String string); /** Publish an JAXWS endpoint to the HTTP server */ void publish(HttpContext context, Endpoint endpoint); /** Destroys an JAXWS endpoint on the HTTP server */ void destroy(HttpContext context, Endpoint endpoint); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/http/HttpContextFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/http/HttpContextFactory.ja0000644000175000017500000000261610652566276031600 0ustar godgod/* * 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.wsf.spi.http; import org.jboss.wsf.spi.SPIView; // $Id: HttpContext.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A factory for an abstract HTTP Context * * @author Thomas.Diesler@jboss.org * @since 07-Jul-2006 */ public abstract class HttpContextFactory implements SPIView { public abstract HttpContext newHttpContext(HttpServer server, String contextRoot); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/http/HttpServerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/http/HttpServerFactory.jav0000644000175000017500000000254510653357134031601 0ustar godgod/* * 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.wsf.spi.http; import org.jboss.wsf.spi.SPIView; // $Id: HttpContext.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A factory for an abstract HTTP server * * @author Thomas.Diesler@jboss.org * @since 07-Jul-2006 */ public abstract class HttpServerFactory implements SPIView { public abstract HttpServer getHttpServer(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/0000755000175000017500000000000010755000235026622 5ustar godgod././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/SecurityHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/SecurityHandler0000644000175000017500000000261210624565305031664 0ustar godgod/* * 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.wsf.spi.deployment; // $Id: SecurityHandler.java 3183 2007-05-22 13:06:13Z thomas.diesler@jboss.com $ import org.dom4j.Element; public interface SecurityHandler { /** Add the security domain to jboss-web.xml */ void addSecurityDomain(Element jbossWeb, Deployment dep); /** Add the security roles to web.xml */ void addSecurityRoles(Element webApp, Deployment dep); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/Extensible.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/Extensible.java0000644000175000017500000000377110654357356031620 0ustar godgod/* * 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.wsf.spi.deployment; //$Id: Deployment.java 3999 2007-07-26 11:33:20Z thomas.diesler@jboss.com $ import java.util.Collection; import java.util.Map; import java.util.Set; /** * A general extendible artifact * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public interface Extensible { /** Add arbitrary attachments */ T addAttachment(Class key, Object value); /** Get arbitrary attachments */ Collection getAttachments(); /** Get an arbitrary attachment */ T getAttachment(Class key); /** Remove arbitrary attachments */ T removeAttachment(Class key); /** Get an property */ Object getProperty(String key); /** Set a property */ void setProperty(String key, Object value); /** Remove a property */ void removeProperty(String key); /** Get the set of property names */ Set getProperties(); /** Set a map of properties */ void setProperties(Map props); }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/Deployment.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/Deployment.java0000644000175000017500000000513210741242224031607 0ustar godgod/* * 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.wsf.spi.deployment; // $Id: Deployment.java 5447 2008-01-09 22:03:00Z thomas.diesler@jboss.com $ /** * A general web service deployment dep. * * It has no notion of J2EE deployment packages. * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public interface Deployment extends Extensible { public enum DeploymentType { JAXRPC_CLIENT, JAXRPC_JSE, JAXRPC_EJB21, JAXWS_JSE, JAXWS_EJB3, @Deprecated JAXRPC_EJB3 }; public enum DeploymentState { UNDEFINED, CREATED, STARTED, STOPPED, DESTROYED }; /** Get the identifier for this deployment */ String getSimpleName(); /** Set the identifier for this deployment */ void setSimpleName(String name); /** Get the class loader for this deployment */ ClassLoader getInitialClassLoader(); /** Set the class loader for this deployment */ void setInitialClassLoader(ClassLoader loader); /** Get the runtime class loader for this deployment */ ClassLoader getRuntimeClassLoader(); /** Set the runtime class loader for this deployment */ void setRuntimeClassLoader(ClassLoader loader); /** Get the deployment type */ DeploymentType getType(); /** Set the deployment type */ void setType(DeploymentType type); /** Get the current deployment state */ DeploymentState getState(); /** Set the current deployment state */ void setState(DeploymentState type); /** Get the service assiated with this deployment */ Service getService(); /** Set the service assiated with this deployment */ void setService(Service service); }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/WSFDeploymentException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/WSFDeploymentEx0000644000175000017500000000336510650145103031547 0ustar godgod/* * 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.wsf.spi.deployment; // $Id: WSFDeploymentException.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ /** * A general deployment exception * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public class WSFDeploymentException extends RuntimeException { public WSFDeploymentException(String message, Throwable cause) { super(message, cause); } public WSFDeploymentException(String message) { super(message); } public WSFDeploymentException(Throwable cause) { super(cause); } public static void rethrow(Throwable cause) { if (cause instanceof WSFDeploymentException) throw (WSFDeploymentException)cause; throw new WSFDeploymentException(cause); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/DeploymentAspect.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/DeploymentAspec0000644000175000017500000000554410654274232031661 0ustar godgod/* * 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.wsf.spi.deployment; //$Id: AbstractDeployer.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; import org.jboss.logging.Logger; /** * A deployment aspect that does nothing. * * A deployment aspects can require/provide a set of string conditions. * This determins the order of deployment aspects in the deployment aspect manager. * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public abstract class DeploymentAspect { // provide logging protected final Logger log = Logger.getLogger(getClass()); public static final String LAST_DEPLOYMENT_ASPECT = "LAST_DEPLOYMENT_ASPECT"; private String provides; private String requires; public String getProvides() { return provides; } public void setProvides(String provides) { this.provides = provides; } public String getRequires() { return requires; } public void setRequires(String requires) { this.requires = requires; } public void create(Deployment dep) { } public void destroy(Deployment dep) { } public void start(Deployment dep) { } public void stop(Deployment dep) { } public Set getProvidesAsSet() { Set condset = new HashSet(); if (provides != null) { StringTokenizer st = new StringTokenizer(provides, ", "); while (st.hasMoreTokens()) condset.add(st.nextToken()); } return condset; } public Set getRequiresAsSet() { Set condset = new HashSet(); if (requires != null) { StringTokenizer st = new StringTokenizer(requires, ", "); while (st.hasMoreTokens()) condset.add(st.nextToken()); } return condset; } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/Endpoint.java0000644000175000017500000001041410732533146031254 0ustar godgod/* * 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.wsf.spi.deployment; // $Id: Endpoint.java 5379 2007-12-20 18:37:26Z alessio.soldano@jboss.com $ import java.util.List; import javax.management.ObjectName; import org.jboss.wsf.spi.invocation.InvocationHandler; import org.jboss.wsf.spi.invocation.RequestHandler; import org.jboss.wsf.spi.management.EndpointMetrics; import org.jboss.wsf.spi.management.recording.Record; import org.jboss.wsf.spi.management.recording.RecordProcessor; /** * A general JAXWS endpoint. * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public interface Endpoint extends Extensible { static final String SEPID_DOMAIN = "jboss.ws"; static final String SEPID_PROPERTY_CONTEXT = "context"; static final String SEPID_PROPERTY_ENDPOINT = "endpoint"; static final String SEPID_DOMAIN_ENDPOINT = SEPID_DOMAIN + "." + SEPID_PROPERTY_ENDPOINT; public enum EndpointState { UNDEFINED, CREATED, STARTED, STOPPED, DESTROYED }; /** Get the service this endpoint belongs to */ Service getService(); /** Set the service this endpoint belongs to */ void setService(Service service); /** Get the unique identifier for this endpoint */ ObjectName getName(); /** Set the unique identifier for this endpoint */ void setName(ObjectName epName); /** Get the short name for this endpoint */ String getShortName(); /** Set the short name for this endpoint */ void setShortName(String shortName); /** Get the current state for this endpoint */ EndpointState getState(); /** Set the current state for this endpoint */ void setState(EndpointState state); /** Get the endpoint implementation bean */ String getTargetBeanName(); /** Set the endpoint implementation bean */ void setTargetBeanName(String epImpl); /** Use the deployment classloader to load the bean */ Class getTargetBeanClass(); /** Get the URL pattern for this endpoint */ String getURLPattern(); /** Set the URL pattern for this endpoint */ void setURLPattern(String urlPattern); /** Get endpoint address */ String getAddress(); /** Set endpoint address */ void setAddress(String address); /** Set the request handler for this endpoint */ void setRequestHandler(RequestHandler handler); /** Get the request handler for this endpoint */ RequestHandler getRequestHandler(); /** Get the lifecycle handler for this endpoint */ LifecycleHandler getLifecycleHandler(); /** Set the lifecycle handler for this endpoint */ void setLifecycleHandler(LifecycleHandler handler); /** Get the endpoint bean invoker */ InvocationHandler getInvocationHandler(); /** Set the endpoint bean invoker */ void setInvocationHandler(InvocationHandler invoker); /** Get the endpoint metrics for this endpoint */ EndpointMetrics getEndpointMetrics(); /** Set the endpoint metrics for this endpoint */ void setEndpointMetrics(EndpointMetrics metrics); /** Get the record processors configured for this endpoint **/ List getRecordProcessors(); /** Set the record processors for this endpoint **/ void setRecordProcessors(List recordProcessors); /** Ask configured processors for processing of the given record **/ void processRecord(Record record); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/Service.java0000644000175000017500000000365110654357356031113 0ustar godgod/* * 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.wsf.spi.deployment; // $Id: Service.java 4100 2007-08-02 13:41:02Z thomas.diesler@jboss.com $ import java.util.List; /** * A general service deployment. * * Maintains a named set of EndpointDeployments * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public interface Service extends Extensible { /** Get the deployment this service belongs to */ Deployment getDeployment(); /** Set the deployment this service belongs to */ void setDeployment(Deployment dep); /** Add an endpoint to the service */ void addEndpoint(Endpoint endpoint); /** Get the list of endpoints */ List getEndpoints(); /** Get an endpoint by name */ Endpoint getEndpointByName(String simpleName); /** Get the context root for this service */ String getContextRoot(); /** Set the context root for this service */ void setContextRoot(String contextRoot); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/ArchiveDeployment.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/ArchiveDeployme0000644000175000017500000000370510654066746031653 0ustar godgod/* * 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.wsf.spi.deployment; //$Id: Deployment.java 3992 2007-07-25 12:48:59Z thomas.diesler@jboss.com $ import java.io.IOException; import java.net.URL; /** * A general web service deployment dep. * * It has no notion of J2EE deployment packages. * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public interface ArchiveDeployment extends Deployment { /** Get the optional parent of this deployment */ ArchiveDeployment getParent(); /** Set the optional parent for this deployment */ void setParent (ArchiveDeployment parent); /** Get the root file for this deployment */ UnifiedVirtualFile getRootFile(); /** Set the root file for this deployment */ void setRootFile(UnifiedVirtualFile root); /** The concatenated names including all parents. */ String getCanonicalName(); /** Get the URL for a given resource path */ URL getMetaDataFileURL(String resourcePath) throws IOException; }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/DeploymentAspectManagerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/DeploymentAspec0000644000175000017500000000312710655610016031647 0ustar godgod/* * 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.wsf.spi.deployment; import org.jboss.wsf.spi.SPIView; /** * Creates DeploymentAspectManager's by {@link org.jboss.wsf.spi.deployment.Deployment.DeploymentType} * * @author Heiko.Braun@jboss.com * Created: Jul 20, 2007 */ public abstract class DeploymentAspectManagerFactory implements SPIView { public abstract DeploymentAspectManager getDeploymentAspectManager(Deployment.DeploymentType deploymentType); /** * Get a named instance of a deployment aspect manager */ public abstract DeploymentAspectManager getDeploymentAspectManager(String beanName); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/AbstractExtensible.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/AbstractExtensi0000644000175000017500000000457110654357356031700 0ustar godgod/* * 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.wsf.spi.deployment; //$Id: BasicDeploymentContext.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; /** * A general extendible artifact * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public abstract class AbstractExtensible implements Extensible { private Map attachments = new HashMap(); private Map properties = new HashMap(); public Collection getAttachments() { return attachments.values(); } public T getAttachment(Class clazz) { return (T)attachments.get(clazz); } public T addAttachment(Class clazz, Object obj) { return (T)attachments.put(clazz, obj); } public T removeAttachment(Class key) { return (T)attachments.remove(key); } public Set getProperties() { return properties.keySet(); } public Object getProperty(String key) { return properties.get(key); } public void removeProperty(String key) { properties.remove(key); } public void setProperty(String key, Object value) { properties.put(key, value); } public void setProperties(Map props) { properties.putAll(props); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/LifecycleHandlerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/LifecycleHandle0000644000175000017500000000241210727271241031565 0ustar godgod/* * 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.wsf.spi.deployment; import org.jboss.wsf.spi.SPIView; /** * @author Heiko.Braun@jboss.com * Created: Jul 23, 2007 */ public abstract class LifecycleHandlerFactory implements SPIView { public abstract LifecycleHandler newLifecycleHandler(); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/UnifiedVirtualFile.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/UnifiedVirtualF0000644000175000017500000000304610654066746031631 0ustar godgod/* * 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.wsf.spi.deployment; // $Id: UnifiedVirtualFile.java 3137 2007-05-18 13:41:57Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.Serializable; import java.net.URL; /** * An adaptor to a VirtualFile from jboss-vfs.jar * jboss-vfs cannot be used in jboss-4.x because of its dependeny on jboss-common-core.jar * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public interface UnifiedVirtualFile extends Serializable { UnifiedVirtualFile findChild(String child) throws IOException; URL toURL(); } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/DeploymentModelFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/DeploymentModel0000644000175000017500000000262010653425525031660 0ustar godgod/* * 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.wsf.spi.deployment; import org.jboss.wsf.spi.SPIView; /** * @author Heiko.Braun@jboss.com * Created: Jul 18, 2007 */ public abstract class DeploymentModelFactory implements SPIView { public abstract Deployment newDeployment(String simpleName, ClassLoader initialLoader); public abstract Service newService(); public abstract Endpoint newEndpoint(String targetBean); } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/DeploymentAspectManager.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/DeploymentAspec0000644000175000017500000000367010656305210031650 0ustar godgod/* * 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.wsf.spi.deployment; // $Id: DeploymentAspectManager.java 4244 2007-08-08 09:19:04Z thomas.diesler@jboss.com $ import java.util.List; /** * A general service deployment manger. * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public interface DeploymentAspectManager { /** Get the name for this aspect manager */ String getName(); /** Get the optional parent for this manager */ DeploymentAspectManager getParent(); /** Set the optional parent for this manager */ void setParent(DeploymentAspectManager dam); /** Get the ordered list of registered deployment aspects */ List getDeploymentAspects(); /** Set the ordered list of registered deployment aspects */ void setDeploymentAspects(List aspects); /** Deploy a web service */ void deploy(Deployment dep); /** Undeploy a web service */ void undeploy(Deployment dep); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/LifecycleHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/deployment/LifecycleHandle0000644000175000017500000000300210623427336031564 0ustar godgod/* * 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.wsf.spi.deployment; /** * Handles endpoint Lifecycle events * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public interface LifecycleHandler { /** Handle the create step of an endpoint */ void create(Endpoint endpoint); /** Handle the start step of an endpoint */ void start(Endpoint endpoint); /** Handle the stop step of an endpoint */ void stop(Endpoint endpoint); /** Handle the destroy step of an endpoint */ void destroy(Endpoint endpoint); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/0000755000175000017500000000000010755000235026222 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/0000755000175000017500000000000010755000235030543 5ustar godgod././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/PortC0000644000175000017500000001564710623427336031543 0ustar godgod/* * 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. */ // $Id: PortComponentMetaData.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ package org.jboss.wsf.spi.metadata.webservices; // $Id: PortComponentMetaData.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; /** * XML Binding and ws4ee meta-data element for * webservices/webservice-description/port-component *

      * A port component is the equivalent of an ordinary Axis service (and * as such it constitutes the building blocks for jaxrpc services). *

      * * @author Thomas.Diesler@jboss.org * @since 15-April-2004 */ public class PortComponentMetaData { /** * The index of the webservice-description in webservices.xml */ public static final String PARAMETER_WEBSERVICE_ID = "webserviceID"; // provide logging private static final Logger log = Logger.getLogger(PortComponentMetaData.class); // The parent element private WebserviceDescriptionMetaData webserviceDescription; /** The required element * This name bears no relationship to the WSDL port name. * This name must be unique amongst all port component names in a module. */ private String portComponentName; // The required element private QName wsdlPort; // The required element private String serviceEndpointInterface; // The required or in the element private String ejbLink; private String servletLink; // The optional elements private List handlers = new ArrayList(); // The HTTP context root private String contextRoot; // The optional secure wsdl access private Boolean secureWSDLAccess; // ----------------------------------------- // JAX-WS additions private boolean enableMtom; private QName wsdlService; private String protocolBinding; private UnifiedHandlerChainsMetaData handlerChains; /** Construct a new PortComponentMetaData for a given WebserviceDescriptionMetaData */ public PortComponentMetaData(WebserviceDescriptionMetaData webserviceDescription) { this.webserviceDescription = webserviceDescription; } public WebserviceDescriptionMetaData getWebserviceDescription() { return webserviceDescription; } public String getPortComponentName() { return portComponentName; } public void setPortComponentName(String portComponentName) { this.portComponentName = portComponentName; } public QName getWsdlPort() { return wsdlPort; } public void setWsdlPort(QName wsdlPort) { if (wsdlPort.getNamespaceURI().length() == 0) log.warn(" element in webservices.xml not namespace qualified: " + wsdlPort); this.wsdlPort = wsdlPort; } public String getEjbLink() { return ejbLink; } public void setEjbLink(String ejbLink) { this.ejbLink = ejbLink; } public String getServletLink() { return servletLink; } public void setServletLink(String servletLink) { this.servletLink = servletLink; } public String getServiceEndpointInterface() { return serviceEndpointInterface; } public void setServiceEndpointInterface(String serviceEndpointInterface) { this.serviceEndpointInterface = serviceEndpointInterface; } public void addHandler(UnifiedHandlerMetaData handler) { handlers.add(handler); } public UnifiedHandlerMetaData[] getHandlers() { UnifiedHandlerMetaData[] array = new UnifiedHandlerMetaData[handlers.size()]; handlers.toArray(array); return array; } public String getContextRoot() { return contextRoot; } public void setContextRoot(String contextRoot) { this.contextRoot = contextRoot; } public Boolean getSecureWSDLAccess() { return secureWSDLAccess; } public void setSecureWSDLAccess(Boolean secureWSDLAccess) { this.secureWSDLAccess = secureWSDLAccess; } public boolean isEnableMtom() { return enableMtom; } public void setEnableMtom(boolean enableMtom) { this.enableMtom = enableMtom; } public QName getWsdlService() { return wsdlService; } public void setWsdlService(QName wsdlService) { this.wsdlService = wsdlService; } public String getProtocolBinding() { return protocolBinding; } public void setProtocolBinding(String protocolBinding) { this.protocolBinding = protocolBinding; } public UnifiedHandlerChainsMetaData getHandlerChains() { return handlerChains; } public void setHandlerChains(UnifiedHandlerChainsMetaData handlerChains) { this.handlerChains = handlerChains; } public String serialize() { StringBuilder builder = new StringBuilder(""); builder.append("").append(portComponentName).append(""); builder.append(""); builder.append(wsdlPort.getPrefix()).append(':').append(wsdlPort.getLocalPart()).append(""); builder.append("").append(serviceEndpointInterface).append(""); builder.append(""); if (ejbLink != null) builder.append("" + ejbLink + ""); else builder.append(""+ servletLink + ""); builder.append(""); builder.append(""); return builder.toString(); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/Webse0000644000175000017500000000623310623427336031550 0ustar godgod/* * 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. */ // $Id: WebservicesMetaData.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ package org.jboss.wsf.spi.metadata.webservices; import java.net.URL; import java.util.ArrayList; // $Id: WebservicesMetaData.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ /** * XML Binding root element for webservices.xml * * @author Thomas.Diesler@jboss.org * @since 15-April-2004 */ public class WebservicesMetaData { // The required elements private ArrayList webserviceDescriptions = new ArrayList(); // The URL to the webservices.xml descriptor private URL descriptorURL; public WebservicesMetaData() { } public WebservicesMetaData(URL descriptorURL) { this.descriptorURL = descriptorURL; } public URL getDescriptorURL() { return descriptorURL; } public void addWebserviceDescription(WebserviceDescriptionMetaData webserviceDescription) { webserviceDescriptions.add(webserviceDescription); } public WebserviceDescriptionMetaData[] getWebserviceDescriptions() { WebserviceDescriptionMetaData[] array = new WebserviceDescriptionMetaData[webserviceDescriptions.size()]; webserviceDescriptions.toArray(array); return array; } //Serialize as a String public String serialize() { //Construct the webservices.xml definitions StringBuilder buffer = new StringBuilder(); // header: opening webservices tag createHeader(buffer); // webservice-description subelements for (WebserviceDescriptionMetaData wm : webserviceDescriptions) buffer.append(wm.serialize()); // closing webservices tag buffer.append(""); return buffer.toString(); } private void createHeader(StringBuilder buf) { buf.append(""); } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/Webse0000644000175000017500000001221710623427336031547 0ustar godgod/* * 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.wsf.spi.metadata.webservices; // $Id: WebserviceDescriptionMetaData.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.logging.Logger; /** * XML Binding element for webservices/webservice-description * * @author Thomas.Diesler@jboss.org * @version $Revision: 3146 $ * @since 15-April-2004 */ public class WebserviceDescriptionMetaData { // provide logging private static final Logger log = Logger.getLogger(WebserviceDescriptionMetaData.class); // The parent element private WebservicesMetaData webservices; // The required element private String webserviceDescriptionName; // The required element private String wsdlFile; // The required element private String jaxrpcMappingFile; // The required elements private ArrayList portComponents = new ArrayList(); public WebserviceDescriptionMetaData(WebservicesMetaData webservices) { this.webservices = webservices; } public WebservicesMetaData getWebservices() { return webservices; } public void addPortComponent(PortComponentMetaData portComponent) { portComponents.add(portComponent); } public PortComponentMetaData[] getPortComponents() { PortComponentMetaData[] array = new PortComponentMetaData[portComponents.size()]; portComponents.toArray(array); return array; } /** * Get the QNames of the port components to be declared * in the namespaces * * @return */ public Collection getPortComponentQNames() { //TODO:Check if there is just one QName that drives all portcomponents //or each port component can have a distinct QName (namespace/prefix) //Maintain uniqueness of the QName Map map = new HashMap(); for (PortComponentMetaData pcm : portComponents) { QName qname = pcm.getWsdlPort(); map.put(qname.getPrefix(), qname); } return map.values(); } /** * Lookup a PortComponentMetaData by wsdl-port local part * * @param name - the wsdl-port local part * @return PortComponentMetaData if found, null otherwise */ public PortComponentMetaData getPortComponentByWsdlPort(String name) { ArrayList pcNames = new ArrayList(); for (PortComponentMetaData pc : portComponents) { String wsdlPortName = pc.getWsdlPort().getLocalPart(); if (wsdlPortName.equals(name)) return pc; pcNames.add(wsdlPortName); } log.error("Cannot get port component name '" + name + "', we have: " + pcNames); return null; } public String getWebserviceDescriptionName() { return webserviceDescriptionName; } public void setWebserviceDescriptionName(String webserviceDescriptionName) { this.webserviceDescriptionName = webserviceDescriptionName; } public String getWsdlFile() { return wsdlFile; } public void setWsdlFile(String wsdlFile) { this.wsdlFile = wsdlFile; } public String getJaxrpcMappingFile() { return jaxrpcMappingFile; } public void setJaxrpcMappingFile(String jaxrpcMappingFile) { this.jaxrpcMappingFile = jaxrpcMappingFile; } /** * Serialize as a String * * @return */ public String serialize() { StringBuilder buffer = new StringBuilder(""); buffer.append("").append(webserviceDescriptionName).append(""); buffer.append("").append(wsdlFile).append(""); buffer.append("").append(jaxrpcMappingFile).append(""); for (PortComponentMetaData pm : portComponents) buffer.append(pm.serialize()); buffer.append(""); return buffer.toString(); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/webservices/Webse0000644000175000017500000002765710654066746031575 0ustar godgod/* * 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.wsf.spi.metadata.webservices; // $Id: WebservicesFactory.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.net.URL; import javax.xml.ws.WebServiceException; import org.jboss.logging.Logger; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; /** * A JBossXB factory for {@link WebservicesMetaData} * * @author Thomas.Diesler@jboss.org * @since 16-Apr-2004 */ public class WebservicesFactory implements ObjectModelFactory { // provide logging private static final Logger log = Logger.getLogger(WebservicesFactory.class); // The URL to the webservices.xml descriptor private URL descriptorURL; public WebservicesFactory(URL descriptorURL) { this.descriptorURL = descriptorURL; } /** * Load webservices.xml from META-INF/webservices.xml * or WEB-INF/webservices.xml. * * @param root virtual file root * @return WebservicesMetaData or null if it cannot be found */ public static WebservicesMetaData loadFromVFSRoot(UnifiedVirtualFile root) { WebservicesMetaData webservices = null; UnifiedVirtualFile wsdd = null; try { wsdd = root.findChild("META-INF/webservices.xml"); } catch (IOException e) { // } // Maybe a web application deployment? if (null == wsdd) { try { wsdd = root.findChild("WEB-INF/webservices.xml"); } catch (IOException e) { // } } // the descriptor is optional if (wsdd != null) { URL wsddUrl = wsdd.toURL(); try { InputStream is = wsddUrl.openStream(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); ObjectModelFactory factory = new WebservicesFactory(wsddUrl); webservices = (WebservicesMetaData)unmarshaller.unmarshal(is, factory, null); is.close(); } catch (Exception e) { throw new WebServiceException("Failed to unmarshall webservices.xml:" + e.getMessage()); } } return webservices; } /** * This method is called on the factory by the object model builder when the parsing starts. * * @return the root of the object model. */ public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { WebservicesMetaData webservicesMetaData = new WebservicesMetaData(descriptorURL); return webservicesMetaData; } public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name) { return root; } /** * Called when parsing of a new element started. */ public Object newChild(WebservicesMetaData webservices, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("webservice-description".equals(localName)) return new WebserviceDescriptionMetaData(webservices); else return null; } /** * Called when parsing character is complete. */ public void addChild(WebservicesMetaData webservices, WebserviceDescriptionMetaData webserviceDescription, UnmarshallingContext navigator, String namespaceURI, String localName) { webservices.addWebserviceDescription(webserviceDescription); } /** * Called when parsing of a new element started. */ public Object newChild(WebserviceDescriptionMetaData webserviceDescription, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("port-component".equals(localName)) return new PortComponentMetaData(webserviceDescription); else return null; } /** * Called when parsing character is complete. */ public void addChild(WebserviceDescriptionMetaData webserviceDescription, PortComponentMetaData portComponent, UnmarshallingContext navigator, String namespaceURI, String localName) { webserviceDescription.addPortComponent(portComponent); } /** * Called when parsing of a new element started. */ public Object newChild(PortComponentMetaData portComponent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("handler".equals(localName)) return new UnifiedHandlerMetaData(null); else if ("handler-chains".equals(localName)) return new UnifiedHandlerChainsMetaData(); else return null; } /** * Called when parsing of a new element started. */ public Object newChild(UnifiedHandlerChainsMetaData handlerChains, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("handler-chain".equals(localName)) return new UnifiedHandlerChainMetaData(); else return null; } /** * Called when parsing of a new element started. */ public Object newChild(UnifiedHandlerChainMetaData handlerChains, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("handler".equals(localName)) return new UnifiedHandlerMetaData(); else return null; } /** * Called when parsing character is complete. */ public void addChild(PortComponentMetaData portComponent, UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName) { portComponent.addHandler(handler); } /** * Called when parsing character is complete. */ public void addChild(PortComponentMetaData portComponent, UnifiedHandlerChainsMetaData handlerChains, UnmarshallingContext navigator, String namespaceURI, String localName) { portComponent.setHandlerChains(handlerChains); } /** * Called when parsing character is complete. */ public void addChild(UnifiedHandlerChainsMetaData chains, UnifiedHandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName) { chains.addHandlerChain(handlerChain); } /** * Called when parsing character is complete. */ public void addChild(UnifiedHandlerChainMetaData chain, UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName) { chain.addHandler(handler); } /** * Called when parsing of a new element started. */ public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("init-param".equals(localName)) return new UnifiedInitParamMetaData(); else return null; } /** * Called when parsing character is complete. */ public void addChild(UnifiedHandlerMetaData handler, UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName) { handler.addInitParam(param); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(WebserviceDescriptionMetaData webserviceDescription, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("WebserviceDescriptionMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("webservice-description-name")) webserviceDescription.setWebserviceDescriptionName(value); else if (localName.equals("wsdl-file")) webserviceDescription.setWsdlFile(value); else if (localName.equals("jaxrpc-mapping-file")) webserviceDescription.setJaxrpcMappingFile(value); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(PortComponentMetaData portComponent, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("PortComponentMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("port-component-name")) portComponent.setPortComponentName(value); else if (localName.equals("wsdl-port")) portComponent.setWsdlPort(navigator.resolveQName(value)); else if (localName.equals("service-endpoint-interface")) portComponent.setServiceEndpointInterface(value); else if (localName.equals("ejb-link")) portComponent.setEjbLink(value); else if (localName.equals("servlet-link")) portComponent.setServletLink(value); else if (localName.equals("wsdl-service")) portComponent.setWsdlService(navigator.resolveQName(value)); else if (localName.equals("protocol-binding")) portComponent.setProtocolBinding(value); else if (localName.equals("enable-mtom")) portComponent.setEnableMtom(Boolean.valueOf(value)); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("handler-name")) handler.setHandlerName(value); else if (localName.equals("handler-class")) handler.setHandlerClass(value); else if (localName.equals("soap-header")) handler.addSoapHeader(navigator.resolveQName(value)); else if (localName.equals("soap-role")) handler.addSoapRole(value); else if (localName.equals("port-name")) handler.addPortName(value); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("param-name")) param.setParamName(value); else if (localName.equals("param-value")) param.setParamValue(value); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/0000755000175000017500000000000010755000236027050 5ustar godgod././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/SLSBMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/SLSBMetaData0000644000175000017500000000247010652273240031145 0ustar godgod/* * 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.wsf.spi.metadata.j2ee; // $Id: UnifiedSessionMetaData.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ /** * The container independent metadata of a stateless session bean. * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public class SLSBMetaData extends EJBMetaData { } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/EJBMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/EJBMetaData.0000644000175000017500000001034610652273353031066 0ustar godgod/* * 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.wsf.spi.metadata.j2ee; //$Id: UnifiedBeanMetaData.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * The container independent common meta data class for the entity, message-driven and session beans. * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public abstract class EJBMetaData { // The ejb-name element specifies an enterprise bean's name. private String ejbName; // The ejb-class element contains the fully-qualified name of the enterprise bean's class. private String ejbClass; // The home element contains the fully-qualified name of the enterprise bean's home interface. */ private String homeClass; // The local-home element contains the fully-qualified name of the enterprise bean's local home interface. private String localHomeClass; // The service-endpoint element contains the fully-qualified name of the beans service endpoint interface (SEI) private String seiName; // The JNDI name under with the home interface should be bound private String jndiName; // The JNDI name under with the local home interface should be bound private String localJndiName; // The optional port-component-name private String portComponentName; // The optional port-component-uri private String portComponentURI; // The optional security meta data private EJBSecurityMetaData securityMetaData; public String getEjbName() { return ejbName; } public void setEjbName(String ejbName) { this.ejbName = ejbName; } public String getEjbClass() { return ejbClass; } public void setEjbClass(String ejbClass) { this.ejbClass = ejbClass; } public String getServiceEndpointInterface() { return seiName; } public void setServiceEndpointInterface(String seiName) { this.seiName = seiName; } public String getContainerObjectNameJndiName() { return getHome() != null ? getJndiName() : getLocalJndiName(); } public String getHome() { return homeClass; } public void setHome(String homeClass) { this.homeClass = homeClass; } public String getJndiName() { return jndiName; } public void setJndiName(String jndiName) { this.jndiName = jndiName; } public String getLocalHome() { return localHomeClass; } public void setLocalHome(String localHomeClass) { this.localHomeClass = localHomeClass; } public String getLocalJndiName() { return localJndiName; } public void setLocalJndiName(String localJndiName) { this.localJndiName = localJndiName; } public String getPortComponentName() { return portComponentName; } public void setPortComponentName(String portComponentName) { this.portComponentName = portComponentName; } public String getPortComponentURI() { return portComponentURI; } public void setPortComponentURI(String portComponentURI) { this.portComponentURI = portComponentURI; } public EJBSecurityMetaData getSecurityMetaData() { return securityMetaData; } public void setSecurityMetaData(EJBSecurityMetaData securityMetaData) { this.securityMetaData = securityMetaData; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/MDBMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/MDBMetaData.0000755000175000017500000000307210652273240031064 0ustar godgod/* * 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.wsf.spi.metadata.j2ee; // $Id: UnifiedMessageDrivenMetaData.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ /** * The container independent metadata of a message driven bean. * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public class MDBMetaData extends EJBMetaData { private String destinationJndiName; public String getDestinationJndiName() { return destinationJndiName; } public void setDestinationJndiName(String destinationJndiName) { this.destinationJndiName = destinationJndiName; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/0000755000175000017500000000000010755000236031205 5ustar godgod././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/ServiceRefMetaDataParserFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/S0000644000175000017500000000246610654274232031351 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; // $Id: ServiceRefMetaDataParser.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ /** * @author Thomas.Diesler@jboss.org * @since 02-Aug-2007 */ public interface ServiceRefMetaDataParserFactory { ServiceRefMetaDataParser getServiceRefMetaDataParser(); } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/U0000644000175000017500000003110710743346427031352 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; // $Id$ import org.jboss.logging.Logger; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.serviceref.ServiceRefMetaData; import org.w3c.dom.Element; import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; import java.util.List; /** * The metdata data from service-ref element in web.xml, ejb-jar.xml, and * application-client.xml. * * @author Thomas.Diesler@jboss.org */ public class UnifiedServiceRefMetaData extends ServiceRefMetaData { // provide logging private static Logger log = Logger.getLogger(UnifiedServiceRefMetaData.class); private UnifiedVirtualFile vfsRoot; // Standard properties // The required element private String serviceRefName; // The JAXRPC required element private String serviceInterface; // service-res-type private String serviceRefType; // The optional element private String wsdlFile; // The optional element private String mappingFile; // The optional element private QName serviceQName; // The list elements private List portComponentRefs = new ArrayList(); // The optional elements. JAX-RPC handlers declared in the standard J2EE1.4 descriptor private List handlers = new ArrayList(); // The optional elements. JAX-WS handlers declared in the standard JavaEE5 descriptor private UnifiedHandlerChainsMetaData handlerChains; // JBoss properties // The optional element private String serviceImplClass; // The optional JBossWS config-name private String configName; // The optional JBossWS config-file private String configFile; // The optional URL of the actual WSDL to use, private String wsdlOverride; // The optional element. JAX-WS handler chain declared in the JBoss JavaEE5 descriptor private String handlerChain; // Arbitrary proxy properties given by private List callProperties = new ArrayList(); // The JAXWS annotated element. JDK1.4 does not have java.lang.reflect.AnnotatedElement so we use an untyped Object private transient Object anElement; // A flag that should be set when this service-ref has been bound. private transient boolean processed; // Maps 'injection-target-class' to 'injection-target-name' private List injectionTargets = new LinkedList(); public UnifiedServiceRefMetaData(UnifiedVirtualFile vfRoot) { this.vfsRoot = vfRoot; } public UnifiedServiceRefMetaData() { } public void merge(ServiceRefMetaData sref) { UnifiedServiceRefMetaData sourceRef = (UnifiedServiceRefMetaData)sref; serviceImplClass = sourceRef.serviceImplClass; configName = sourceRef.configName; configFile = sourceRef.configFile; wsdlOverride = sourceRef.wsdlOverride; handlerChain = sourceRef.handlerChain; callProperties = sourceRef.callProperties; if (serviceQName == null && sourceRef.serviceQName != null) serviceQName = sourceRef.serviceQName; for (UnifiedPortComponentRefMetaData pcref : sourceRef.getPortComponentRefs()) { String seiName = pcref.getServiceEndpointInterface(); QName portQName = pcref.getPortQName(); UnifiedPortComponentRefMetaData targetPCRef = getPortComponentRef(seiName, portQName); if (targetPCRef == null) { log.warn("Cannot find port component ref: [sei=" + seiName + ",port=" + portQName + "]"); if (seiName != null) addPortComponentRef(pcref); else log.warn("Ingore port component ref without SEI declaration: " + pcref); targetPCRef = pcref; } targetPCRef.merge(pcref); } } public UnifiedVirtualFile getVfsRoot() { return vfsRoot; } public void setVfsRoot(UnifiedVirtualFile vfsRoot) { this.vfsRoot = vfsRoot; } public String getServiceRefName() { return serviceRefName; } public void setServiceRefName(String serviceRefName) { this.serviceRefName = serviceRefName; } public String getMappingFile() { return mappingFile; } public void setMappingFile(String mappingFile) { this.mappingFile = mappingFile; } public URL getMappingLocation() { URL mappingURL = null; if (mappingFile != null) { try { mappingURL = vfsRoot.findChild(mappingFile).toURL(); } catch (Exception e) { throw new WebServiceException("Cannot find jaxrcp-mapping-file: " + mappingFile, e); } } return mappingURL; } public Collection getPortComponentRefs() { return portComponentRefs; } public UnifiedPortComponentRefMetaData getPortComponentRef(String seiName, QName portName) { UnifiedPortComponentRefMetaData matchingRef = null; for (UnifiedPortComponentRefMetaData ref : portComponentRefs) { if (ref.matches(seiName, portName)) { if (matchingRef != null) log.warn("Multiple matching port component ref: [sei=" + seiName + ",port=" + portName + "]"); matchingRef = ref; } } return matchingRef; } public void addPortComponentRef(UnifiedPortComponentRefMetaData pcRef) { portComponentRefs.add(pcRef); } public List getHandlers() { return handlers; } public void addHandler(UnifiedHandlerMetaData handler) { handlers.add(handler); } public String getServiceInterface() { return serviceInterface; } public void setServiceInterface(String serviceInterface) { this.serviceInterface = serviceInterface; } public String getServiceImplClass() { return serviceImplClass; } public void setServiceImplClass(String serviceImplClass) { this.serviceImplClass = serviceImplClass; } public QName getServiceQName() { return serviceQName; } public void setServiceQName(QName serviceQName) { this.serviceQName = serviceQName; } public String getServiceRefType() { return serviceRefType; } public void setServiceRefType(String serviceResType) { this.serviceRefType = serviceResType; } public String getWsdlFile() { return wsdlFile; } public void setWsdlFile(String wsdlFile) { this.wsdlFile = wsdlFile; } public URL getWsdlLocation() { URL wsdlLocation = null; if (wsdlOverride != null) { try { wsdlLocation = new URL(wsdlOverride); } catch (MalformedURLException e1) { try { wsdlLocation = vfsRoot.findChild(wsdlOverride).toURL(); } catch (Exception e) { throw new WebServiceException("Cannot find wsdl-override: " + wsdlOverride, e); } } } if (wsdlLocation == null && wsdlFile != null) { try { wsdlLocation = vfsRoot.findChild(wsdlFile).toURL(); } catch (Exception e) { throw new WebServiceException("Cannot find wsdl-file: " + wsdlFile, e); } } return wsdlLocation; } public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } public String getConfigName() { return configName; } public void setConfigName(String configName) { this.configName = configName; } public String getWsdlOverride() { return wsdlOverride; } public void setWsdlOverride(String wsdlOverride) { this.wsdlOverride = wsdlOverride; } public List getCallProperties() { return callProperties; } public void setCallProperties(List callProps) { callProperties = callProps; } public void addCallProperty(UnifiedCallPropertyMetaData callProp) { callProperties.add(callProp); } public UnifiedHandlerChainsMetaData getHandlerChains() { return handlerChains; } public void setHandlerChains(UnifiedHandlerChainsMetaData handlerChains) { this.handlerChains = handlerChains; } public String getHandlerChain() { return handlerChain; } public void setHandlerChain(String handlerChain) { this.handlerChain = handlerChain; } public Object getAnnotatedElement() { return anElement; } public boolean isProcessed() { return processed; } public void setProcessed(boolean flag) { this.processed = flag; } public void setAnnotatedElement(Object anElement) { this.anElement = anElement; } public void registerInjectionTarget(String classname) { this.injectionTargets.add( new String[]{classname, null} ); } public void finalizeInjectionTarget(String propName) { int index = this.injectionTargets.isEmpty() ? 0 : this.injectionTargets.size() - 1; this.injectionTargets.get(index)[1] = propName; } public List getInjectionTargets() { return this.injectionTargets; } @Override public void importStandardXml(Element root) { SPIProvider provider = SPIProviderResolver.getInstance().getProvider(); ServiceRefMetaDataParserFactory factory = provider.getSPI(ServiceRefMetaDataParserFactory.class); factory.getServiceRefMetaDataParser().importStandardXml(root, this); } @Override public void importJBossXml(Element root) { SPIProvider provider = SPIProviderResolver.getInstance().getProvider(); ServiceRefMetaDataParserFactory factory = provider.getSPI(ServiceRefMetaDataParserFactory.class); factory.getServiceRefMetaDataParser().importJBossXml(root, this); } public String toString() { StringBuilder str = new StringBuilder(); str.append("\nUnifiedServiceRef"); str.append("\n serviceRefName=" + serviceRefName); str.append("\n serviceInterface=" + serviceInterface); str.append("\n serviceImplClass=" + serviceImplClass); str.append("\n serviceRefType=" + serviceRefType); str.append("\n serviceQName=" + serviceQName); str.append("\n anElement=" + anElement); str.append("\n wsdlFile=" + wsdlFile); str.append("\n wsdlOverride=" + wsdlOverride); str.append("\n mappingFile=" + mappingFile); str.append("\n configName=" + configName); str.append("\n configFile=" + configFile); str.append("\n callProperties=" + callProperties); str.append("\n processed=" + processed); str.append("\n handlerChains=" + handlerChains); str.append("\n handlerChain=" + handlerChain); for (UnifiedHandlerMetaData uhmd : handlers) str.append(uhmd.toString()); for (UnifiedPortComponentRefMetaData pcref : portComponentRefs) str.append(pcref.toString()); return str.toString(); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/HandlerChainsObjectFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/H0000644000175000017500000001413510623427336031333 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; // $Id: HandlerChainsObjectFactory.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import org.jboss.logging.Logger; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; /** * A JBossXB factory for jsr181 the HandlerChain annotation * * @author Thomas.Diesler@jboss.org * @since 15-Oct-2005 */ public class HandlerChainsObjectFactory implements ObjectModelFactory { // provide logging private static final Logger log = Logger.getLogger(HandlerChainsObjectFactory.class); public HandlerChainsObjectFactory() { } /** * This method is called on the factory by the object model builder when the parsing starts. * * @return the root of the object model. */ public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { UnifiedHandlerChainsMetaData handlerConfigMetaData = new UnifiedHandlerChainsMetaData(HandlerType.ENDPOINT); return handlerConfigMetaData; } public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name) { return root; } /** * Called when parsing of a new element started. */ public Object newChild(UnifiedHandlerChainsMetaData handlerConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("handler-chain".equals(localName)) return new UnifiedHandlerChainMetaData(handlerConfig); else return null; } /** * Called when parsing character is complete. */ public void addChild(UnifiedHandlerChainsMetaData handlerConfig, UnifiedHandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName) { handlerConfig.addHandlerChain(handlerChain); } /** * Called when parsing of a new element started. */ public Object newChild(UnifiedHandlerChainMetaData chainConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("handler".equals(localName)) return new UnifiedHandlerMetaData(chainConfig); else return null; } /** * Called when parsing character is complete. */ public void addChild(UnifiedHandlerChainMetaData handlerConfig, UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName) { handlerConfig.addHandler(handler); } /** * Called when parsing of a new element started. */ public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("init-param".equals(localName)) return new UnifiedInitParamMetaData(); else return null; } /** * Called when parsing character is complete. */ public void addChild(UnifiedHandlerMetaData handler, UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName) { handler.addInitParam(param); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(UnifiedHandlerChainMetaData handlerChain, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("UnifiedHandlerChainMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("protocol-bindings")) handlerChain.setProtocolBindings(value); else if (localName.equals("service-name-pattern")) handlerChain.setServiceNamePattern(navigator.resolveQName(value)); else if (localName.equals("port-name-pattern")) handlerChain.setPortNamePattern(navigator.resolveQName(value)); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("handler-name")) handler.setHandlerName(value); else if (localName.equals("handler-class")) handler.setHandlerClass(value); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("param-name")) param.setParamName(value); else if (localName.equals("param-value")) param.setParamValue(value); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/U0000644000175000017500000001045610654274232031351 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; // $Id: UnifiedHandlerMetaData.java 4072 2007-08-02 06:24:26Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.namespace.QName; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.serviceref.ServiceRefElement; import org.w3c.dom.Element; /** * The unified metdata data for a handler element * * @author Thomas.Diesler@jboss.org */ public class UnifiedHandlerMetaData extends ServiceRefElement { public enum HandlerType { PRE, ENDPOINT, POST, ALL } private UnifiedHandlerChainMetaData handlerChain; // The required element private String handlerName; // The required element private String handlerClass; // The optional elements private List initParams = new ArrayList(); // The optional elements private Set soapHeaders = new HashSet(); // The optional elements private Set soapRoles = new HashSet(); // The optional elements, these only apply to webserve clients private Set portNames = new HashSet(); public UnifiedHandlerMetaData(UnifiedHandlerChainMetaData handlerChain) { this.handlerChain = handlerChain; } public UnifiedHandlerMetaData() { } public UnifiedHandlerChainMetaData getHandlerChain() { return handlerChain; } public void setHandlerName(String value) { this.handlerName = value; } public String getHandlerName() { return handlerName; } public void setHandlerClass(String handlerClass) { this.handlerClass = handlerClass; } public String getHandlerClass() { return handlerClass; } public void addInitParam(UnifiedInitParamMetaData param) { initParams.add(param); } public List getInitParams() { return initParams; } public void addSoapHeader(QName qName) { soapHeaders.add(qName); } public Set getSoapHeaders() { return soapHeaders; } public void addSoapRole(String value) { soapRoles.add(value); } public Set getSoapRoles() { return soapRoles; } public Set getPortNames() { return portNames; } public void addPortName(String value) { portNames.add(value); } public void importStandardXml(Element root) { SPIProvider provider = SPIProviderResolver.getInstance().getProvider(); ServiceRefMetaDataParserFactory factory = provider.getSPI(ServiceRefMetaDataParserFactory.class); factory.getServiceRefMetaDataParser().importStandardXml(root, this); } public String toString() { StringBuilder str = new StringBuilder(); str.append("\nUnifiedHandlerMetaData"); str.append("\n handlerName=" + handlerName); str.append("\n handlerClass=" + handlerClass); str.append("\n soapHeaders=" + soapHeaders); str.append("\n soapRoles=" + soapRoles); str.append("\n portNames=" + portNames); str.append("\n initParams=" + initParams); return str.toString(); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/U0000644000175000017500000000366610654066746031367 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; // $Id$ import java.util.ArrayList; import java.util.List; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import org.jboss.wsf.spi.serviceref.ServiceRefElement; /** The unified metdata data for a handler chains element * * @author Thomas.Diesler@jboss.org */ public class UnifiedHandlerChainsMetaData extends ServiceRefElement { private HandlerType handlerType; private List handlerChains = new ArrayList(); public UnifiedHandlerChainsMetaData(HandlerType endpoint) { this.handlerType = handlerType; } public UnifiedHandlerChainsMetaData() { } public List getHandlerChains() { return handlerChains; } public void addHandlerChain(UnifiedHandlerChainMetaData handlerChain) { handlerChains.add(handlerChain); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedCallPropertyMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/U0000644000175000017500000000372310654066746031361 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; //$Id$ import org.jboss.wsf.spi.serviceref.ServiceRefElement; /** * @author Thomas.Diesler@jboss.org * @since 06-May-2004 */ public class UnifiedCallPropertyMetaData extends ServiceRefElement { // The required element private String propName; // The required element private String propValue; public UnifiedCallPropertyMetaData(String propName, String propValue) { this.propName = propName; this.propValue = propValue; } public UnifiedCallPropertyMetaData() { } public String getPropName() { return propName; } public void setPropName(String paramName) { this.propName = paramName; } public String getPropValue() { return propValue; } public void setPropValue(String paramValue) { this.propValue = paramValue; } public String toString() { return "[name=" + propName + ",value=" + propValue + "]"; } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/U0000644000175000017500000000517710654066746031366 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; // $Id$ import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import javax.xml.ws.handler.PortInfo; import org.jboss.wsf.spi.serviceref.ServiceRefElement; /** The unified metdata data for a handler chain element * * @author Thomas.Diesler@jboss.org */ public class UnifiedHandlerChainMetaData extends ServiceRefElement { private UnifiedHandlerChainsMetaData handlerChains; private QName serviceNamePattern; private QName portNamePattern; private String protocolBindings; private List handlers = new ArrayList(); private PortInfo portInfo; public UnifiedHandlerChainMetaData(UnifiedHandlerChainsMetaData handlerChains) { this.handlerChains = handlerChains; } public UnifiedHandlerChainMetaData() { } public QName getPortNamePattern() { return portNamePattern; } public void setPortNamePattern(QName portNamePattern) { this.portNamePattern = portNamePattern; } public QName getServiceNamePattern() { return serviceNamePattern; } public void setServiceNamePattern(QName serviceNamePattern) { this.serviceNamePattern = serviceNamePattern; } public String getProtocolBindings() { return protocolBindings; } public void setProtocolBindings(String protocolBindings) { this.protocolBindings = protocolBindings; } public List getHandlers() { return handlers; } public void addHandler(UnifiedHandlerMetaData handler) { handlers.add(handler); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/U0000644000175000017500000000341310654066746031355 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; import org.jboss.wsf.spi.serviceref.ServiceRefElement; // $Id$ /** * @author Thomas.Diesler@jboss.org * @since 06-May-2004 */ public class UnifiedStubPropertyMetaData extends ServiceRefElement { // The required element private String propName; // The required element private String propValue; public String getPropName() { return propName; } public void setPropName(String paramName) { this.propName = paramName; } public String getPropValue() { return propValue; } public void setPropValue(String paramValue) { this.propValue = paramValue; } public String toString() { return "[name=" + propName + ",value=" + propValue + "]"; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedInitParamMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/U0000644000175000017500000000410710654066746031356 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; //$Id: UnifiedInitParamMetaData.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import org.jboss.wsf.spi.serviceref.ServiceRefElement; /** * @author Thomas.Diesler@jboss.org * @since 06-May-2004 */ public class UnifiedInitParamMetaData extends ServiceRefElement { // The required element private String paramName; // The required element private String paramValue; public UnifiedInitParamMetaData(String paramName, String paramValue) { this.paramName = paramName; this.paramValue = paramValue; } public UnifiedInitParamMetaData() { } public String getParamName() { return paramName; } public void setParamName(String paramName) { this.paramName = paramName; } public String getParamValue() { return paramValue; } public void setParamValue(String paramValue) { this.paramValue = paramValue; } public String toString() { return "[name=" + paramName + ",value=" + paramValue + "]"; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/ServiceRefMetaDataParser.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/S0000644000175000017500000000340310654274232031341 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; // $Id: ServiceRefMetaDataParser.java 4072 2007-08-02 06:24:26Z thomas.diesler@jboss.com $ import org.w3c.dom.Element; /** * The metdata data from service-ref element in web.xml, ejb-jar.xml, and * application-client.xml. * * @author Thomas.Diesler@jboss.org */ public interface ServiceRefMetaDataParser { public void importStandardXml(Element root, UnifiedServiceRefMetaData sref); public void importJBossXml(Element root, UnifiedServiceRefMetaData sref); public void importStandardXml(Element root, UnifiedPortComponentRefMetaData pcref); public void importJBossXml(Element root, UnifiedPortComponentRefMetaData pcref); public void importStandardXml(Element root, UnifiedHandlerMetaData href); } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/serviceref/U0000644000175000017500000001564610654274232031357 0ustar godgod/* * 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.wsf.spi.metadata.j2ee.serviceref; // $Id: UnifiedPortComponentRefMetaData.java 4072 2007-08-02 06:24:26Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.serviceref.ServiceRefElement; import org.w3c.dom.Element; /** The metdata data from service-ref/port-component-ref element in web.xml, ejb-jar.xml, and application-client.xml. * * @author Thomas.Diesler@jboss.org */ public class UnifiedPortComponentRefMetaData extends ServiceRefElement { // The parent service-ref private UnifiedServiceRefMetaData serviceRefMetaData; // The required element private String serviceEndpointInterface; // The optional element private Boolean enableMTOM = Boolean.FALSE; // The optional element private String portComponentLink; // The optional element private QName portQName; // Arbitrary proxy properties given by private List callProperties = new ArrayList(); // Arbitrary proxy properties given by private List stubProperties = new ArrayList(); // The optional JBossWS config-name private String configName; // The optional JBossWS config-file private String configFile; public UnifiedPortComponentRefMetaData(UnifiedServiceRefMetaData serviceRefMetaData) { this.serviceRefMetaData = serviceRefMetaData; } public void merge(UnifiedPortComponentRefMetaData pcref) { portQName = pcref.portQName; configName = pcref.configName; configFile = pcref.configFile; callProperties = pcref.callProperties; stubProperties = pcref.stubProperties; } public UnifiedServiceRefMetaData getServiceRefMetaData() { return serviceRefMetaData; } public Boolean getEnableMTOM() { return enableMTOM; } public void setEnableMTOM(Boolean enableMTOM) { this.enableMTOM = enableMTOM; } /** * The port-component-link element links a port-component-ref * to a specific port-component required to be made available * by a service reference. * * The value of a port-component-link must be the * port-component-name of a port-component in the same module * or another module in the same application unit. The syntax * for specification follows the syntax defined for ejb-link * in the EJB 2.0 specification. */ public String getPortComponentLink() { return portComponentLink; } public void setPortComponentLink(String portComponentLink) { this.portComponentLink = portComponentLink; } public String getServiceEndpointInterface() { return serviceEndpointInterface; } public void setServiceEndpointInterface(String serviceEndpointInterface) { this.serviceEndpointInterface = serviceEndpointInterface; } public QName getPortQName() { return portQName; } public void setPortQName(QName portQName) { this.portQName = portQName; } public List getCallProperties() { return callProperties; } public void setCallProperties(List callProps) { callProperties = callProps; } public void addCallProperty(UnifiedCallPropertyMetaData callProp) { callProperties.add(callProp); } public List getStubProperties() { return stubProperties; } public void setStubProperties(List stubProps) { stubProperties = stubProps; } public void addStubProperty(UnifiedStubPropertyMetaData stubProp) { stubProperties.add(stubProp); } public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } public String getConfigName() { return configName; } public void setConfigName(String configName) { this.configName = configName; } public void importStandardXml(Element root) { SPIProvider provider = SPIProviderResolver.getInstance().getProvider(); ServiceRefMetaDataParserFactory factory = provider.getSPI(ServiceRefMetaDataParserFactory.class); factory.getServiceRefMetaDataParser().importStandardXml(root, this); } public void importJBossXml(Element root) { SPIProvider provider = SPIProviderResolver.getInstance().getProvider(); ServiceRefMetaDataParserFactory factory = provider.getSPI(ServiceRefMetaDataParserFactory.class); factory.getServiceRefMetaDataParser().importJBossXml(root, this); } public boolean matches(String seiName, QName portName) { if (seiName == null && portName == null) throw new IllegalArgumentException("Cannot match against seiName=null && portName=null."); boolean match = false; // match against portName first if (portName != null) match = portName.equals(getPortQName()); // if it fails try seiName if (match == false) match = seiName.equals(getServiceEndpointInterface()); return match; } public String toString() { StringBuilder str = new StringBuilder(); str.append("\nUnifiedPortComponentRef"); str.append("\n serviceEndpointInterface=" + serviceEndpointInterface); str.append("\n portQName=" + portQName); str.append("\n enableMTOM=" + enableMTOM); str.append("\n portComponentLink=" + portComponentLink); str.append("\n callProperties=" + callProperties); str.append("\n stubProperties=" + stubProperties); str.append("\n configName=" + configName); str.append("\n configFile=" + configFile); return str.toString(); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/EJBArchiveMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/EJBArchiveMe0000644000175000017500000000715310652273353031175 0ustar godgod/* * 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.wsf.spi.metadata.j2ee; //$Id: EJBArchiveMetaData.java 4014 2007-07-27 04:39:07Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * The container independent top level meta data from the jboss.xml and ejb-jar.xml descriptor. * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public class EJBArchiveMetaData { /** ArrayList for the ejbs */ private List beans = new ArrayList(); /** The optional JBossWS config-name */ private String configName; /** The optional JBossWS config-file */ private String configFile; /** The web context root to use for web services */ private String webServiceContextRoot; /** The security-domain value assigned to the application */ private String securityDomain; /** A HashMap for webservice description publish locations */ private PublishLocationAdapter publishLocationAdapter; public EJBMetaData getBeanByEjbName(String ejbName) { for (EJBMetaData beanMetaData : beans) { if (beanMetaData.getEjbName().equals(ejbName)) { return beanMetaData; } } return null; } public Iterator getEnterpriseBeans() { return beans.iterator(); } public void setEnterpriseBeans(List beans) { this.beans = beans; } public String getConfigName() { return configName; } public void setConfigName(String configName) { this.configName = configName; } public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } public String getWebServiceContextRoot() { return webServiceContextRoot; } public void setWebServiceContextRoot(String contextRoot) { this.webServiceContextRoot = contextRoot; } public String getSecurityDomain() { return securityDomain; } public void setSecurityDomain(String securityDomain) { this.securityDomain = securityDomain; } public void setPublishLocationAdapter(PublishLocationAdapter publishLocationAdapter) { this.publishLocationAdapter = publishLocationAdapter; } public String getWsdlPublishLocationByName(String name) { String publishLocation = (publishLocationAdapter != null ? publishLocationAdapter.getWsdlPublishLocationByName(name) : null); return publishLocation; } public interface PublishLocationAdapter { String getWsdlPublishLocationByName(String name); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/EJBSecurityMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/EJBSecurityM0000644000175000017500000000372010652273240031245 0ustar godgod/* * 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.wsf.spi.metadata.j2ee; //$Id: UnifiedBeanMetaData.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * The container independent EJB security meta data class * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public class EJBSecurityMetaData { private String authMethod; private String transportGuarantee; private boolean secureWSDLAccess; public String getAuthMethod() { return authMethod; } public void setAuthMethod(String authMethod) { this.authMethod = authMethod; } public String getTransportGuarantee() { return transportGuarantee; } public void setTransportGuarantee(String transportGuarantee) { this.transportGuarantee = transportGuarantee; } public boolean getSecureWSDLAccess() { return secureWSDLAccess; } public void setSecureWSDLAccess(Boolean access) { if (access != null) this.secureWSDLAccess = access; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/JSEArchiveMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/JSEArchiveMe0000644000175000017500000001011010652273353031201 0ustar godgod/* * 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.wsf.spi.metadata.j2ee; //$Id: JSEArchiveMetaData.java 4014 2007-07-27 04:39:07Z thomas.diesler@jboss.com $ import java.util.HashMap; import java.util.List; import java.util.Map; /** * The container independent representation of the web.xml and jboss-web.xml deployment descriptors * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public class JSEArchiveMetaData { // The war context root as specified at the jboss-web.xml descriptor level. private String contextRoot; // The servlet-mapping private Map servletMappings = new HashMap(); // The servlet private Map servletClassNames = new HashMap(); // The optional JBossWS config-name private String configName; // The optional JBossWS config-file private String configFile; // The security-domain value assigned to the application private String securityDomain; // A HashMap for webservice description publish locations private PublishLocationAdapter publishLocationAdapter; // web.xml security-constraints private List securityMetaData; public String getContextRoot() { return contextRoot; } public void setContextRoot(String contextRoot) { this.contextRoot = contextRoot; } public Map getServletMappings() { return servletMappings; } public void setServletMappings(Map servletMappings) { this.servletMappings = servletMappings; } public Map getServletClassNames() { return servletClassNames; } public void setServletClassNames(Map servletClassNames) { this.servletClassNames = servletClassNames; } public String getConfigName() { return configName; } public void setConfigName(String configName) { this.configName = configName; } public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } public String getSecurityDomain() { return securityDomain; } public void setSecurityDomain(String securityDomain) { this.securityDomain = securityDomain; } public List getSecurityMetaData() { return securityMetaData; } public void setSecurityMetaData(List securityMetaData) { this.securityMetaData = securityMetaData; } public void setPublishLocationAdapter(PublishLocationAdapter publishLocationAdapter) { this.publishLocationAdapter = publishLocationAdapter; } public String getWsdlPublishLocationByName(String name) { String publishLocation = null; if (publishLocationAdapter != null) publishLocation = publishLocationAdapter.getWsdlPublishLocationByName(name); return publishLocation; } public interface PublishLocationAdapter { String getWsdlPublishLocationByName(String name); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/JSESecurityMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/metadata/j2ee/JSESecurityM0000644000175000017500000000515510652273240031272 0ustar godgod/* * 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.wsf.spi.metadata.j2ee; // $Id: JSESecurityMetaData.java 4013 2007-07-27 04:37:52Z thomas.diesler@jboss.com $ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; /** * * @author darran.lofthouse@jboss.com * @since Oct 22, 2006 */ public class JSESecurityMetaData { // The optional security-constraint/user-data-constraint/transport-guarantee private String transportGuarantee; // The HashMap for the security-constraint/web-resource-collection elements. private HashMap webResources = new HashMap(); public JSEResourceCollection addWebResource(final String name) { JSEResourceCollection wrc = new JSEResourceCollection(name); webResources.put(name, wrc); return wrc; } public Collection getWebResources() { return webResources.values(); } public String getTransportGuarantee() { return transportGuarantee; } public void setTransportGuarantee(String transportGuarantee) { this.transportGuarantee = transportGuarantee; } public static class JSEResourceCollection { private String name; private HashSet urlPatterns = new HashSet(); public JSEResourceCollection(final String name) { this.name = name; } public String getName() { return name; } public void addPattern(String pattern) { urlPatterns.add(pattern); } public HashSet getUrlPatterns() { return urlPatterns; } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/0000755000175000017500000000000010755000237025604 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/ant/0000755000175000017500000000000010755000237026366 5ustar godgod././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/ant/WSProvideTask.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/ant/WSProvideTask.ja0000644000175000017500000002254410654604745031432 0ustar godgod/* * 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.wsf.spi.tools.ant; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.ExecuteJava; import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; import org.jboss.wsf.spi.tools.WSContractProvider; import java.io.File; import java.io.PrintStream; import java.net.URLClassLoader; import java.net.URL; import java.net.MalformedURLException; import java.util.StringTokenizer; import java.util.List; import java.util.ArrayList; /** * Ant task which invokes provides a Web Service contract and portable JAX-WS wrapper classes. * * * * * * * * * * * * *
      AttributeDescriptionDefault
      forkWhether or not to run the generation task in a separate VM.true
      keepKeep/Enable Java source code generation.false
      destdirThe output directory for generated artifacts."output"
      resourcedestdirThe output directory for resource artifacts (WSDL/XSD).value of destdir
      sourcedestdirThe output directory for Java source.value of destdir
      genwsdlWhether or not to generate WSDL.false
      verboseEnables more informational output about cmd progress.false
      sei*Service Endpoint Implementation.
      classpathThe classpath that contains the service endpoint implementation.""
      * * = required. * *

      Example: * *

       *  <target name="test-wsproivde" depends="init">
       *    <taskdef name="WSProvideTask" classname="org.jboss.wsf.spi.tools.ant.WSProvideTask">
       *      <classpath refid="core.classpath"/>
       *    </taskdef>
       *    <WSProvideTask
       *      fork="false"
       *      keep="true"
       *      destdir="out"
       *      resourcedestdir="out-resource"
       *      sourcedestdir="out-source"
       *      genwsdl="true" 
       *      verbose="true"
       *      sei="org.jboss.test.ws.jaxws.jsr181.soapbinding.DocWrappedServiceImpl">
       *      <classpath>
       *        <pathelement path="${tests.output.dir}/classes"/>
       *      </classpath>
       *    </WSProvideTask>
       *  </target>
       * 
      * * @author Jason T. Greene * @version $Revision: 4153 $ */ public class WSProvideTask extends Task { private Path classpath = new Path(getProject()); private CommandlineJava command = new CommandlineJava(); private String sei = null; private File destdir = null; private File resourcedestdir = null; private File sourcedestdir = null; private boolean keep = false; private boolean genwsdl = false; private boolean verbose = false; private boolean fork = false; private boolean debug = false; // Not actually used right now public void setDebug(boolean debug) { this.debug = debug; } public Commandline.Argument createJvmarg() { return command.createVmArgument(); } public void setClasspath(Path classpath) { this.classpath = classpath; } public void setClasspathRef(Reference ref) { createClasspath().setRefid(ref); } public Path createClasspath() { return classpath; } public void setDestdir(File destdir) { this.destdir = destdir; } public void setKeep(boolean keep) { this.keep = keep; } public void setSei(String sei) { this.sei = sei; } public void setFork(boolean fork) { this.fork = fork; } public void setResourcedestdir(File resourcedestdir) { this.resourcedestdir = resourcedestdir; } public void setSourcedestdir(File sourcedestdir) { this.sourcedestdir = sourcedestdir; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public void setGenwsdl(boolean genwsdl) { this.genwsdl = genwsdl; } private ClassLoader getClasspathLoader(ClassLoader parent) { AntClassLoader antLoader = new AntClassLoader(parent, getProject(), classpath, false); // It's necessary to wrap it into an URLLoader in order to extract that information // within the actual provider impl. // See SunRIProviderImpl for instance List urls = new ArrayList(); StringTokenizer tok = new StringTokenizer(antLoader.getClasspath(), File.separator); while(tok.hasMoreTokens()) { try { String path = tok.nextToken(); if(!path.startsWith("file://")) path = "file://"+path; urls.add(new URL(path)); } catch (MalformedURLException e) { throw new IllegalArgumentException("Failed to wrap classloader", e); } } ClassLoader wrapper = new URLClassLoader(urls.toArray(new URL[0]), antLoader); return wrapper; } public void executeNonForked() { ClassLoader prevCL = Thread.currentThread().getContextClassLoader(); ClassLoader antLoader = this.getClass().getClassLoader(); Thread.currentThread().setContextClassLoader(antLoader); try { WSContractProvider gen = WSContractProvider.newInstance( getClasspathLoader(antLoader) ); if (verbose) gen.setMessageStream(new PrintStream(new LogOutputStream(this, Project.MSG_INFO))); gen.setGenerateSource(keep); gen.setGenerateWsdl(genwsdl); if (destdir != null) gen.setOutputDirectory(destdir); if (resourcedestdir != null) gen.setResourceDirectory(resourcedestdir); if (sourcedestdir != null) gen.setSourceDirectory(sourcedestdir); log("Generating from endpoint: " + sei, Project.MSG_INFO); gen.provide(sei); } finally { Thread.currentThread().setContextClassLoader(prevCL); } } public void execute() throws BuildException { if (sei == null) throw new BuildException("The sei attribute must be specified!", getLocation()); if (fork) executeForked(); else executeNonForked(); } private Path getTaskClassPath() { // Why is everything in the Ant API a big hack??? ClassLoader cl = this.getClass().getClassLoader(); if (cl instanceof AntClassLoader) { return new Path(getProject(), ((AntClassLoader)cl).getClasspath()); } return new Path(getProject()); } private void executeForked() throws BuildException { command.setClassname(org.jboss.wsf.spi.tools.cmd.WSProvide.class.getName()); Path path = command.createClasspath(getProject()); path.append(getTaskClassPath()); path.append(classpath); if (keep) command.createArgument().setValue("-k"); if (genwsdl) command.createArgument().setValue("-w"); if (destdir != null) { command.createArgument().setValue("-o"); command.createArgument().setFile(destdir); } if (resourcedestdir != null) { command.createArgument().setValue("-r"); command.createArgument().setFile(resourcedestdir); } if (sourcedestdir != null) { command.createArgument().setValue("-s"); command.createArgument().setFile(sourcedestdir); } if (!verbose) command.createArgument().setValue("-q"); // Always dump traces command.createArgument().setValue("-t"); command.createArgument().setValue(sei); if (verbose) log("Command invoked: " + command.getJavaCommand().toString()); ExecuteJava execute = new ExecuteJava(); execute.setClasspath(path); execute.setJavaCommand(command.getJavaCommand()); if (execute.fork(this) != 0) throw new BuildException("Could not invoke WSProvideTask", getLocation()); } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/ant/WSConsumeTask.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/ant/WSConsumeTask.ja0000644000175000017500000002332510650145103031411 0ustar godgod/* * 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.wsf.spi.tools.ant; import java.io.File; import java.io.PrintStream; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.ExecuteJava; import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import org.jboss.wsf.spi.tools.WSContractConsumer; /** * Ant task which consumes a Web Service contract. * * * * * * * * * * * * * * *
      AttributeDescriptionDefault
      forkWhether or not to run the generation task in a separate VM.true
      keepKeep/Enable Java source code generation.false
      catalog Oasis XML Catalog file for entity resolutionnone
      package The target Java package for generated code.generated
      bindingA JAX-WS or JAXB binding filenone
      wsdlLocationValue to use for @@WebService.wsdlLocationgenerated
      destdirThe output directory for generated artifacts."output"
      sourcedestdirThe output directory for Java source.value of destdir
      targetThe JAX-WS specification target2.0 | 2.1
      verboseEnables more informational output about cmd progress.false
      wsdl*The WSDL file or URLn/a
      * * = required. * *

      Example: * *

       * <WSConsumeTask
       *   fork="true"
       *   verbose="true"
       *   destdir="output"
       *   sourcedestdir="gen-src"
       *   keep="true"
       *   wsdllocation="handEdited.wsdl"
       *   wsdl="foo.wsdl">
       *   <binding dir="binding-files" includes="*.xml" excludes="bad.xml"/>
       * </wsimport>
       * 
      * * @author Jason T. Greene * @version $Revision: 3959 $ */ public class WSConsumeTask extends Task { private CommandlineJava command = new CommandlineJava(); private String wsdl; private File destdir; private File sourcedestdir; private List bindingFiles = new ArrayList(); private File catalog; private String wsdlLocation; private String targetPackage; private boolean keep; private boolean verbose; private boolean fork; private boolean debug; private String target; // Not actually used right now public void setDebug(boolean debug) { this.debug = debug; } public Commandline.Argument createJvmarg() { return command.createVmArgument(); } public void setBinding(File bindingFile) { bindingFiles.add(bindingFile); } public void setCatalog(File catalog) { this.catalog = catalog; } public void setDestdir(File destdir) { this.destdir = destdir; } public void setFork(boolean fork) { this.fork = fork; } public void setKeep(boolean keep) { this.keep = keep; } public void setSourcedestdir(File sourcedestdir) { this.sourcedestdir = sourcedestdir; } public void setTarget(String target) { this.target = target; } public void setPackage(String targetPackage) { this.targetPackage = targetPackage; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public void setWsdl(String wsdl) { this.wsdl = wsdl; } public void setWsdlLocation(String wsdlLocation) { this.wsdlLocation = wsdlLocation; } public void addConfiguredBinding(FileSet fs) { DirectoryScanner ds = fs.getDirectoryScanner(getProject()); File baseDir = ds.getBasedir(); for (String file : ds.getIncludedFiles()) { bindingFiles.add(new File(baseDir, file)); } } public void executeNonForked() { ClassLoader prevCL = Thread.currentThread().getContextClassLoader(); ClassLoader antLoader = this.getClass().getClassLoader(); Thread.currentThread().setContextClassLoader(antLoader); try { WSContractConsumer importer = WSContractConsumer.newInstance(); importer.setGenerateSource(keep); if (destdir != null) importer.setOutputDirectory(destdir); if (sourcedestdir != null) importer.setSourceDirectory(sourcedestdir); if (targetPackage != null) importer.setTargetPackage(targetPackage); if (wsdlLocation != null) importer.setWsdlLocation(wsdlLocation); if (catalog != null) importer.setCatalog(catalog); if (bindingFiles != null && bindingFiles.size() > 0) importer.setBindingFiles(bindingFiles); if (target != null) importer.setTarget(target); log("Consuming wsdl: " + wsdl, Project.MSG_INFO); if (verbose) { importer.setMessageStream(new PrintStream(new LogOutputStream(this, Project.MSG_INFO))); } try { importer.setAdditionalCompilerClassPath(getTaskClassPathStrings()); importer.consume(wsdl); } catch (MalformedURLException e) { throw new BuildException(e, getLocation()); } } finally { Thread.currentThread().setContextClassLoader(prevCL); } } public void execute() throws BuildException { if (wsdl == null) throw new BuildException("The wsdl attribute must be specified!", getLocation()); if (fork) executeForked(); else executeNonForked(); } private Path getTaskClassPath() { // Why is everything in the Ant API a big hack??? ClassLoader cl = this.getClass().getClassLoader(); if (cl instanceof AntClassLoader) { return new Path(getProject(), ((AntClassLoader)cl).getClasspath()); } return new Path(getProject()); } private List getTaskClassPathStrings() { // Why is everything in the Ant API a big hack??? List strings = new ArrayList(); ClassLoader cl = this.getClass().getClassLoader(); if (cl instanceof AntClassLoader) { for (String string : ((AntClassLoader)cl).getClasspath().split(File.pathSeparator)) strings.add(string); } return strings; } private void executeForked() throws BuildException { command.setClassname(org.jboss.wsf.spi.tools.cmd.WSConsume.class.getName()); Path path = command.createClasspath(getProject()); path.append(getTaskClassPath()); if (keep) command.createArgument().setValue("-k"); for (File file : bindingFiles) { command.createArgument().setValue("-b"); command.createArgument().setFile(file); } if (catalog != null) { command.createArgument().setValue("-c"); command.createArgument().setFile(catalog); } if (targetPackage != null) { command.createArgument().setValue("-p"); command.createArgument().setValue(targetPackage); } if (wsdlLocation != null) { command.createArgument().setValue("-w"); command.createArgument().setValue(wsdlLocation); } if (destdir != null) { command.createArgument().setValue("-o"); command.createArgument().setFile(destdir); } if (sourcedestdir != null) { command.createArgument().setValue("-s"); command.createArgument().setFile(sourcedestdir); } if (target != null) { command.createArgument().setValue("-t"); command.createArgument().setValue(target); } if (verbose) command.createArgument().setValue("-v"); command.createArgument().setValue(wsdl); log("Consuming wsdl: " + wsdl, Project.MSG_INFO); if (verbose) log("Command invoked: " + command.getJavaCommand().toString()); ExecuteJava execute = new ExecuteJava(); execute.setClasspath(path); execute.setJavaCommand(command.getJavaCommand()); if (execute.fork(this) != 0) throw new BuildException("Could not invoke WSConsumeTask", getLocation()); } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/cmd/0000755000175000017500000000000010755000237026347 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/cmd/WSProvide.java0000644000175000017500000002061710654326561031113 0ustar godgod/* * 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.wsf.spi.tools.cmd; import gnu.getopt.Getopt; import gnu.getopt.LongOpt; import java.io.File; import java.io.PrintStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; import org.jboss.wsf.spi.tools.WSContractProvider; /** * WSProvideTask is a cmd line tool that generates portable JAX-WS artifacts * for a service endpoint implementation. * *
       *  usage: WSProvideTask [options] <endpoint class name>
       *  options: 
       *  -h, --help                  Show this help message
       *  -k, --keep                  Keep/Generate Java source
       *  -w, --wsdl                  Enable WSDL file generation
       *  -c, --classpath=<path<      The classpath that contains the endpoint
       *  -o, --output=<directory>    The directory to put generated artifacts
       *  -r, --resource=<directory>  The directory to put resource artifacts
       *  -s, --source=<directory>    The directory to put Java source
       *  -q, --quiet                 Be somewhat more quiet
       *  -t, --show-traces           Show full exception stack traces
       *  -l, --load-provider           Load the provider and exit (debug utility)
       * 
      * * @author Jason T. Greene * @version $Revision: 4086 $ */ public class WSProvide { private boolean generateSource = false; private boolean generateWsdl = false; private boolean quiet = false; private boolean showTraces = false; private boolean loadProvider = false; private ClassLoader loader = Thread.currentThread().getContextClassLoader(); private File outputDir = new File("output"); private File resourceDir = null; private File sourceDir = null; public static String PROGRAM_NAME = System.getProperty("program.name", WSProvide.class.getSimpleName()); public static void main(String[] args) { WSProvide generate = new WSProvide(); String endpoint = generate.parseArguments(args); System.exit(generate.generate(endpoint)); } private String parseArguments(String[] args) { String shortOpts = "hwko:r:s:c:qtl"; LongOpt[] longOpts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'), new LongOpt("wsdl", LongOpt.NO_ARGUMENT, null, 'w'), new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'), new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'), new LongOpt("resource", LongOpt.REQUIRED_ARGUMENT, null, 'r'), new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'), new LongOpt("classpath", LongOpt.REQUIRED_ARGUMENT, null, 'c'), new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'), new LongOpt("show-traces", LongOpt.NO_ARGUMENT, null, 't'), new LongOpt("load-provider", LongOpt.NO_ARGUMENT, null, 'l'), }; Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts); int c; while ((c = getopt.getopt()) != -1) { switch (c) { case 'k': generateSource = true; break; case 's': sourceDir = new File(getopt.getOptarg()); break; case 'r': resourceDir = new File(getopt.getOptarg()); break; case 'w': generateWsdl = true; break; case 't': showTraces = true; break; case 'o': outputDir = new File(getopt.getOptarg()); break; case 'q': quiet = true; break; case 'c': processClassPath(getopt.getOptarg()); break; case 'l': loadProvider = true; break; case 'h': printHelp(); System.exit(0); case '?': System.exit(1); } } // debug output if(loadProvider) { WSContractProvider gen = WSContractProvider.newInstance(loader); System.out.println("WSContractProvider instance: " + gen.getClass().getCanonicalName()); System.exit(0); } int endpointPos = getopt.getOptind(); if (endpointPos >= args.length) { System.err.println("Error: endpoint implementation was not specified!"); printHelp(); System.exit(1); } return args[endpointPos]; } private int generate(String endpoint) { try { loader.loadClass(endpoint); } catch (ClassNotFoundException e) { System.err.println("Error: Could not load class [" + endpoint + "]. Did you specify a valid --classpath?"); return 1; } WSContractProvider gen = WSContractProvider.newInstance(loader); gen.setGenerateWsdl(generateWsdl); gen.setGenerateSource(generateSource); gen.setOutputDirectory(outputDir); if (resourceDir != null) gen.setResourceDirectory(resourceDir); if (sourceDir != null) gen.setSourceDirectory(sourceDir); if (! quiet) gen.setMessageStream(System.out); try { gen.provide(endpoint); return 0; } catch (Throwable t) { System.err.println("Error: Could not generate. (use --show-traces to see full traces)"); if (!showTraces) { String message = t.getMessage(); if (message == null) message = t.getClass().getSimpleName(); System.err.println("Error: " + message); } else { t.printStackTrace(System.err); } } return 1; } private void processClassPath(String classPath) { String[] entries = classPath.split(File.pathSeparator); List urls= new ArrayList(entries.length); for (String entry : entries) { try { urls.add(new File(entry).toURL()); } catch (MalformedURLException e) { System.err.println("Error: a classpath entry was malformed: " + entry); } } loader = new URLClassLoader(urls.toArray(new URL[0]), loader); } private static void printHelp() { PrintStream out = System.out; out.println("WSProvideTask generates portable JAX-WS artifacts for an endpoint implementation.\n"); out.println("usage: " + PROGRAM_NAME + " [options] \n"); out.println("options: "); out.println(" -h, --help Show this help message"); out.println(" -k, --keep Keep/Generate Java source"); out.println(" -w, --wsdl Enable WSDL file generation"); out.println(" -c, --classpath= The classpath that contains the endpoint"); out.println(" -o, --output= The directory to put generated artifacts"); out.println(" -r, --resource= The directory to put resource artifacts"); out.println(" -s, --source= The directory to put Java source"); out.println(" -q, --quiet Be somewhat more quiet"); out.println(" -t, --show-traces Show full exception stack traces"); out.println(" -l, --load-provider Load the provider and exit (debug utility)"); out.flush(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/cmd/WSConsume.java0000644000175000017500000002163710650145103031102 0ustar godgod/* * 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.wsf.spi.tools.cmd; import gnu.getopt.Getopt; import gnu.getopt.LongOpt; import org.jboss.wsf.spi.tools.WSContractConsumer; import java.io.File; import java.io.PrintStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; /** * WSConsumeTask is a cmd line tool that generates portable JAX-WS artifacts * from a WSDL file. * *
       *  usage: WSConsumeTask [options] <wsdl-url>
       *  options:
       *  -h, --help                     Show this help message
       *  -b, --binding=<file>     One or more JAX-WS or JAXB binding files
       *  -k, --keep                     Keep/Generate Java source
       *  -c  --catalog=<file>     Oasis XML Catalog file for entity resolution
       *  -p  --package=<name>     The target package for generated source
       *  -w  --wsdlLocation=<loc> Value to use for @@WebService.wsdlLocation
       *  -o, --output=<directory> The directory to put generated artifacts
       *  -s, --source=<directory> The directory to put Java source
       *  -t, --target=<2.0|2.1>   The target specification target
       *  -q, --quiet                    Be somewhat more quiet
       *  -v, --verbose                  Show full exception stack traces
       *  -l, --load-consumer            Load the consumer and exit (debug utility)
       * 
      * * @author Jason T. Greene * @version $Revision: 3959 $ */ public class WSConsume { private List bindingFiles = new ArrayList(); private boolean generateSource = false; private File catalog = null; private String targetPackage = null; private String wsdlLocation = null; private boolean quiet = false; private boolean verbose = false; private boolean loadConsumer = false; private File outputDir = new File("output"); private File sourceDir = null; private String target = null; public static String PROGRAM_NAME = System.getProperty("program.name", WSConsume.class.getName()); public static void main(String[] args) { WSConsume importer = new WSConsume(); URL wsdl = importer.parseArguments(args); System.exit(importer.importServices(wsdl)); } private URL parseArguments(String[] args) { String shortOpts = "b:c:p:w:o:s:t:khqvl"; LongOpt[] longOpts = { new LongOpt("binding", LongOpt.REQUIRED_ARGUMENT, null, 'b'), new LongOpt("catalog", LongOpt.REQUIRED_ARGUMENT, null, 'c'), new LongOpt("package", LongOpt.REQUIRED_ARGUMENT, null, 'p'), new LongOpt("wsdlLocation", LongOpt.REQUIRED_ARGUMENT, null, 'w'), new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'), new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'), new LongOpt("target", LongOpt.REQUIRED_ARGUMENT, null, 't'), new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'), new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'), new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'), new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v'), new LongOpt("load-consumer", LongOpt.NO_ARGUMENT, null, 'l'), }; Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts); int c; while ((c = getopt.getopt()) != -1) { switch (c) { case 'b': bindingFiles.add(new File(getopt.getOptarg())); break; case 'k': generateSource = true; break; case 'c': catalog = new File(getopt.getOptarg()); break; case 'p': targetPackage = getopt.getOptarg(); break; case 'w': wsdlLocation = getopt.getOptarg(); break; case 'o': outputDir = new File(getopt.getOptarg()); break; case 's': sourceDir = new File(getopt.getOptarg()); break; case 't': target = getopt.getOptarg(); break; case 'q': quiet = true; break; case 'v': verbose = true; break; case 'l': loadConsumer = true; break; case 'h': printHelp(); System.exit(0); case '?': System.exit(1); } } // debug output if(loadConsumer) { WSContractConsumer importer = WSContractConsumer.newInstance(); System.out.println("WSContractConsumer instance: " + importer.getClass().getCanonicalName()); System.exit(0); } int wsdlPos = getopt.getOptind(); if (wsdlPos >= args.length) { System.err.println("Error: WSDL URL was not specified!"); printHelp(); System.exit(1); } URL url = null; try { try { url = new URL(args[wsdlPos]); } catch (MalformedURLException e) { File file = new File(args[wsdlPos]); url = file.toURL(); } } catch (MalformedURLException e) { System.err.println("Error: Invalid URI: " + args[wsdlPos]); System.exit(1); } return url; } private int importServices(URL wsdl) { WSContractConsumer importer = WSContractConsumer.newInstance(); importer.setGenerateSource(generateSource); importer.setOutputDirectory(outputDir); if (sourceDir != null) importer.setSourceDirectory(sourceDir); if (! quiet) importer.setMessageStream(System.out); if (catalog != null) importer.setCatalog(catalog); if (targetPackage != null) importer.setTargetPackage(targetPackage); if (wsdlLocation != null) importer.setWsdlLocation(wsdlLocation); if (bindingFiles != null && bindingFiles.size() > 0) importer.setBindingFiles(bindingFiles); if(target!=null) importer.setTarget(target); try { importer.consume(wsdl); return 0; } catch (Throwable t) { System.err.println("Error: Could not import. (use --verbose to see full traces)"); if (!verbose) { String message = t.getMessage(); if (message == null) message = t.getClass().getSimpleName(); System.err.println("Error: " + message); } else { t.printStackTrace(System.err); } } return 1; } private static void printHelp() { PrintStream out = System.out; out.println("WSConsumeTask is a cmd line tool that generates portable JAX-WS artifacts from a WSDL file.\n"); out.println("usage: " + PROGRAM_NAME + " [options] \n"); out.println("options: "); out.println(" -h, --help Show this help message"); out.println(" -b, --binding= One or more JAX-WS or JAXB binding files "); out.println(" -k, --keep Keep/Generate Java source"); out.println(" -c --catalog= Oasis XML Catalog file for entity resolution"); out.println(" -p --package= The target package for generated source"); out.println(" -w --wsdlLocation= Value to use for @WebService.wsdlLocation"); out.println(" -o, --output= The directory to put generated artifacts"); out.println(" -s, --source= The directory to put Java source"); out.println(" -t, --target=<2.0|2.1> The JAX-WS specification target"); out.println(" -q, --quiet Be somewhat more quiet"); out.println(" -v, --verbose Show full exception stack traces"); out.println(" -l, --load-consumer Load the consumer and exit (debug utility)"); out.flush(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/package.html0000644000175000017500000000277310650145103030072 0ustar godgod A stack indepedent SPI that's provides entry points to command line tools and ANT tasks that generate JAX-WS artefacts from WSDL or wrapper beans and WSDL from existing sources.

      Service provider responsibilities

      A service provider needs to implement both the factory and the actual WSContractConsumer or WSContractProvider. The ANT tasks and the command line tools offer static client interfaces and rely on a standard WSF service factory mechanism that allows pluggability of different implementations:
      • See org.jboss.ws.integration.FactoryLoader

      ANT tasks

      • {@link org.jboss.wsf.spi.tools.ant.WSConsumeTask}
      • {@link org.jboss.wsf.spi.tools.ant.WSProvideTask}

      Command line interfaces and shell scripts

      The shell scripts are installed with the JBossAS installation and can be found in the JBOSS_HOME/bin directory.

      They delegate to the following command line implementations:

      • {@link org.jboss.wsf.spi.tools.cmd.WSConsume}
      • {@link org.jboss.wsf.spi.tools.cmd.WSProvide}

      Related Documentation

      • {@link org.jboss.ws.integration.FactoryLoader}
      For overviews, tutorials, examples, guides, and tool documentation, please see:
      @since JBossWS 2.1 ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/WSContractProvider.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/WSContractProvider.j0000644000175000017500000001232610654274232031533 0ustar godgodpackage org.jboss.wsf.spi.tools; import java.io.File; import java.io.PrintStream; import org.jboss.wsf.spi.util.ServiceLoader; /** * WSContractProvider is responsible for generating the required portable * JAX-WS artifacts for a service endpoint implementation. This includes class * files for wrapper types and fault beans. WSDL may be optionally generated as * well using this API. * *

      The following example generates class files, source files and WSDL for an * endpoint:

      *
       * WSContractProvider provider = WSContractProvider.newInstance();
       * provider.setGenerateSource(true);
       * provider.setGenerateWsdl(true);
       * provider.setOutputDirectory(new File("output"));
       * provider.setMessageStream(System.out);
       * provider.provide(TestMe.class);
       * 
      * *

      Thread-Safety:

      * This class expects to be thread-confined, so it can not be shared between threads. * * @author Jason T. Greene */ public abstract class WSContractProvider { private static String DEFAULT_PROVIDER = "org.jboss.ws.tools.jaxws.impl.JBossWSProviderFactoryImpl"; public static final String PROVIDER_PROPERTY = "org.jboss.wsf.spi.tools.ProviderFactoryImpl"; protected WSContractProvider() { } /** * Obtain a new instance of a WSContractProvider. This will use the current * thread's context class loader to locate the WSContractProviderFactory * implementation. * * @return a new WSContractProvider */ public static WSContractProvider newInstance() { return newInstance(Thread.currentThread().getContextClassLoader()); } /** * Obtain a new instance of a WSContractProvider. The specified ClassLoader will be used to * locate the WSContractProviderFactory implementation * * @param loader the ClassLoader to use * @return a new WSContractProvider */ public static WSContractProvider newInstance(ClassLoader loader) { ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(loader); WSContractProviderFactory factory = (WSContractProviderFactory) ServiceLoader.loadService(PROVIDER_PROPERTY, DEFAULT_PROVIDER); return factory.createProvider(loader); } finally { Thread.currentThread().setContextClassLoader(oldLoader); } } /** * Enables/Disables WSDL generation. * * @param generateWsdl whether or not to generate WSDL */ public abstract void setGenerateWsdl(boolean generateWsdl); /** * Enables/Disables Java source generation. * * @param generateSource whether or not to generate Java source. */ public abstract void setGenerateSource(boolean generateSource); /** * Sets the main output directory. If the directory does not exist, it will be created. * * @param directory the root directory for generated files */ public abstract void setOutputDirectory(File directory); /** * Sets the resource directory. This directory will contain any generated * WSDL and XSD files. If the directory does not exist, it will be created. * If not specified, the output directory will be used instead. * * @param directory the root directory for generated resource files */ public abstract void setResourceDirectory(File directory); /** * Sets the source directory. This directory will contain any generated Java source. * If the directory does not exist, it will be created. If not specified, * the output directory will be used instead. * * @param directory the root directory for generated source code */ public abstract void setSourceDirectory(File directory); /** * Sets the ClassLoader used to discover types. This defaults to the one used * in instantiation. * * @param loader the ClassLoader to use */ public abstract void setClassLoader(ClassLoader loader); /** * Generates artifacts using the current settings. This method may be invoked * more than once (e.g. multiple endpoints). * * @param endpointClass the name of the endpoint implementation bean * @throws RuntimeException if any error occurs during processing, or the class is not found */ public abstract void provide(String endpointClass); /** * Generates artifacts using the current settings. This method may be invoked * more than once (e.g. multiple endpoints). * * @param endpointClass the endpoint implementation bean * @throws RuntimeException if any error occurs during processing */ public abstract void provide(Class endpointClass); /** * Sets the PrintStream to use for status feedback. The simplest example * would be to use System.out. * *

      Example output:

      *
          * Generating WSDL: 
          * TestMeService.wsdl 
          * Writing Source:
          * org/jboss/ws/tools/jaxws/TestMe.java
          * org/jboss/ws/tools/jaxws/TestMeResponse.java 
          * Writing Classes:
          * org/jboss/ws/tools/jaxws/TestMe.class
          * org/jboss/ws/tools/jaxws/TestMeResponse.class
          * 
      * @param messageStream the stream to use for status messages: */ public abstract void setMessageStream(PrintStream messageStream); } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/WSContractProviderFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/WSContractProviderFa0000644000175000017500000000331610650145103031537 0ustar godgod/* * 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.wsf.spi.tools; import org.jboss.wsf.spi.tools.WSContractProvider; /** * Creates WSContractProvider implementations. * * @author Jason T. Greene */ public interface WSContractProviderFactory { /** * Create a new WSContractProvider. There are no restrictions on how this * should be performed. The passed ClassLoader is the one used in * {@link WSContractProvider#newInstance(ClassLoader)}. This loader * should be made available to the generated WSContractProvider. * * @param loader the ClassLoader for type discovery * @return a new WSContractProvider */ public WSContractProvider createProvider(ClassLoader loader); } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/WSContractConsumer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/WSContractConsumer.j0000644000175000017500000001533410654274232031536 0ustar godgod/* * 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.wsf.spi.tools; import java.io.File; import java.io.PrintStream; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import org.jboss.wsf.spi.util.ServiceLoader; /** * WSContractConsumer is responsible for generating JAX-WS client and server * artifacts from the specified WSDL file. To implement a client, one would use * the generated ___Service.java file. For a server, one only needs to provide * an implementation class that implements the generated service endpoint * interface. * * @author Jason T. Greene * @version $Revision: 4072 $ */ public abstract class WSContractConsumer { private static String DEFAULT_PROVIDER = "org.jboss.ws.tools.jaxws.impl.SunRIConsumerFactoryImpl"; public static final String PROVIDER_PROPERTY = "org.jboss.wsf.spi.tools.ConsumerFactoryImpl"; /** * Obtain a new instance of a WSContractProvider. This will use the current * thread's context class loader to locate the WSContractProviderFactory * implementation. * * @return a new WSContractProvider */ public static WSContractConsumer newInstance() { return newInstance(Thread.currentThread().getContextClassLoader()); } /** * Obtain a new instance of a WSContractConsumer. The specified ClassLoader will be used to * locate the WebServiceImporterProvide implementation * * @param loader the ClassLoader to use * @return a new WSContractConsumer */ public static WSContractConsumer newInstance(ClassLoader loader) { ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(loader); WSContractConsumerFactory factory = (WSContractConsumerFactory) ServiceLoader.loadService(PROVIDER_PROPERTY, DEFAULT_PROVIDER); return factory.createConsumer(); } finally { Thread.currentThread().setContextClassLoader(oldLoader); } } /** * Specifies the JAX-WS and JAXB binding files to use on import operations. * * @param bindingFiles list of JAX-WS or JAXB binding files */ public abstract void setBindingFiles(List bindingFiles); /** * Sets the OASIS XML Catalog file to use for entity resolution. * * @param catalog the OASIS XML Catalog file */ public abstract void setCatalog(File catalog); /** * Sets the main output directory. If the directory does not exist, it will be created. * * @param directory the root directory for generated files */ public abstract void setOutputDirectory(File directory); /** * Sets the source directory. This directory will contain any generated Java source. * If the directory does not exist, it will be created. If not specified, * the output directory will be used instead. * * @param directory the root directory for generated source code */ public abstract void setSourceDirectory(File directory); /** * Enables/Disables Java source generation. * * @param generateSource whether or not to generate Java source. */ public abstract void setGenerateSource(boolean generateSource); /** * Sets the target package for generated source. If not specified the default * is based off of the XML namespace. * * @param targetPackage the target package for generated source */ public abstract void setTargetPackage(String targetPackage); /** * Sets the @@WebService.wsdlLocation and @@WebServiceClient.wsdlLocation attributes to a custom value. * * @param wsdlLocation the custom WSDL location to use in generated source */ public abstract void setWsdlLocation(String wsdlLocation); /** * Sets the PrintStream to use for status feedback. The simplest example * would be to use System.out. * * @param messageStream the stream to use for status messages: */ public abstract void setMessageStream(PrintStream messageStream); /** * Sets the additional classpath to use if/when invoking the Java compiler. * Typically an implementation will use the system java.class.path * property. So for most normal applications this method is not needed. However, * if this API is being used from an isolated classloader, then it needs to * be called in order to reference all jars that are required by the * implementation. * * @param classPath a list of strings where each entry references a * single jar or directory */ public abstract void setAdditionalCompilerClassPath(List classPath); /** * Set the target JAX-WS specification target. Defaults to 2.0 * @param target the JAX-WS specification version. Allowed values are 2.0, 2.1 */ public abstract void setTarget(String target); /** * Generate the required artifacts using the specified WSDL URL. This method * may be called more than once, although this is probably not desireable * * @param wsdl the URL of the WSDL */ public abstract void consume(URL wsdl); /** * Generate the required artifacts using the specified WSDL. This method * may be called more than once, although this is probably not desireable. * The passed string is expect to either be a valid URL, or a local file path. * * @param wsdl a URL or local file path * @throws MalformedURLException if wsdl is not a legal URL or local file */ public void consume(String wsdl) throws MalformedURLException { URL url = null; try { url = new URL(wsdl); } catch (MalformedURLException e) { File file = new File(wsdl); url = file.toURL(); } consume(url); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/WSContractConsumerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/tools/WSContractConsumerFa0000644000175000017500000000272110650145103031537 0ustar godgod/* * 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.wsf.spi.tools; import org.jboss.wsf.spi.tools.WSContractConsumer; /** * Creates WSContractConsumer implementations. * * @author Jason T. Greene */ public interface WSContractConsumerFactory { /** * Create a new WSContractConsumer. There are no restrictions on how this * should be performed. * * @return a new WSContractConsumer */ public WSContractConsumer createConsumer(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/0000755000175000017500000000000010755000240026607 5ustar godgod././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/EndpointAssociation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/EndpointAssocia0000644000175000017500000000322310651377713031636 0ustar godgod/* * 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.wsf.spi.invocation; import org.jboss.wsf.spi.deployment.Endpoint; // $Id: EndpointAssociation.java 3974 2007-07-24 13:34:03Z heiko.braun@jboss.com $ /** * Associates the endpoint meta data with the current thead. * * @author Thomas.Diesler@jboss.org * @since 10-May-2007 */ public final class EndpointAssociation { private static final ThreadLocal endpoint = new ThreadLocal(); public static void setEndpoint(Endpoint ep) { endpoint.set(ep); } public static Endpoint getEndpoint() { return endpoint.get(); } public static void removeEndpoint() { endpoint.remove(); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/InvocationType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/InvocationType.0000644000175000017500000000242110741243340031567 0ustar godgod/* * 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.wsf.spi.invocation; /** * Known invocation types. * * @author Heiko.Braun@jboss.com * Created: Jul 19, 2007 */ public enum InvocationType { JAXRPC_JSE, JAXRPC_EJB21, JAXRPC_MDB21, JAXWS_JSE, JAXWS_EJB3, JAXWS_MDB3, @Deprecated JAXWS_EJB21; } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/Invocation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/Invocation.java0000644000175000017500000000413210650145103031565 0ustar godgod/* * 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.wsf.spi.invocation; import java.lang.reflect.Method; /** * A general endpoint invocation. * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public class Invocation { private InvocationContext invocationContext; private Method javaMethod; private Object[] args; private Object returnValue; public Invocation() { this.invocationContext = new InvocationContext(); } public InvocationContext getInvocationContext() { return invocationContext; } public void setInvocationContext(InvocationContext invocationContext) { this.invocationContext = invocationContext; } public Method getJavaMethod() { return javaMethod; } public void setJavaMethod(Method javaMethod) { this.javaMethod = javaMethod; } public Object[] getArgs() { return args; } public void setArgs(Object[] args) { this.args = args; } public Object getReturnValue() { return returnValue; } public void setReturnValue(Object returnValue) { this.returnValue = returnValue; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/InvocationHandlerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/InvocationHandl0000644000175000017500000000251410741234144031623 0ustar godgod/* * 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.wsf.spi.invocation; import org.jboss.wsf.spi.SPIView; /** * Creates invocation related artefacts. * * @author Heiko.Braun@jboss.com * Created: Jul 19, 2007 */ public abstract class InvocationHandlerFactory implements SPIView { public abstract InvocationHandler newInvocationHandler(InvocationType type); } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/WebServiceContextJSE.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/WebServiceConte0000644000175000017500000000424410654357356031612 0ustar godgod/* * 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.wsf.spi.invocation; // $Id: WebServiceContextJSE.java 4100 2007-08-02 13:41:02Z thomas.diesler@jboss.com $ import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext; import java.security.Principal; import javax.servlet.http.HttpServletRequest; import javax.xml.ws.handler.MessageContext; /** * A WebServiceContext implementation that delegates to the HttpServletRequest. * * @author Thomas.Diesler@jboss.org * @since 23-Jan-2007 */ public class WebServiceContextJSE extends ExtensibleWebServiceContext { private HttpServletRequest httpRequest; public WebServiceContextJSE(MessageContext msgContext) { super(msgContext); httpRequest = (HttpServletRequest)msgContext.get(MessageContext.SERVLET_REQUEST); if (httpRequest == null) throw new IllegalStateException("Cannot obtain HTTPServletRequest from message context"); } @Override public Principal getUserPrincipal() { Principal principal = httpRequest.getUserPrincipal(); return principal; } @Override public boolean isUserInRole(String role) { boolean isUserInRole = httpRequest.isUserInRole(role); return isUserInRole; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/InvocationHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/InvocationHandl0000644000175000017500000000406010660277026031627 0ustar godgod/* * 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.wsf.spi.invocation; import java.lang.reflect.UndeclaredThrowableException; import javax.management.MBeanException; import org.jboss.wsf.spi.deployment.Endpoint; /** * Handles invocations on endpoints. * * @author Thomas.Diesler@jboss.org * @author Heiko.Braun@jboss.com * @since 25-Apr-2007 */ public abstract class InvocationHandler { /** Create a container specific invocation **/ public abstract Invocation createInvocation(); /** Invoke the the service endpoint */ public abstract void invoke(Endpoint ep, Invocation inv) throws Exception; /** Initilize the invocation handler **/ public abstract void init(Endpoint ep); protected void handleInvocationException(Throwable th) throws Exception { if (th instanceof MBeanException) { throw ((MBeanException)th).getTargetException(); } if (th instanceof Exception) { throw (Exception)th; } if (th instanceof Error) { throw (Error)th; } throw new UndeclaredThrowableException(th); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/SecurityAdaptorFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/SecurityAdaptor0000644000175000017500000000266210652566276031710 0ustar godgod/* * 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.wsf.spi.invocation; // $Id: SecurityAdaptorFactory.java 4023 2007-07-28 07:14:06Z thomas.diesler@jboss.com $ import org.jboss.wsf.spi.SPIView; /** * A container idependent SecurityAdaptorFactory * * @author Thomas.Diesler@jboss.org * @author Heiko.Braun@jboss.com * * @since 10-May-2005 */ public abstract class SecurityAdaptorFactory implements SPIView { public abstract SecurityAdaptor newSecurityAdapter(); } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/ExtensibleWebServiceContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/ExtensibleWebSe0000644000175000017500000000464010654357356031613 0ustar godgod/* * 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.wsf.spi.invocation; import java.security.Principal; import javax.xml.ws.EndpointReference; import javax.xml.ws.WebServiceContext; import javax.xml.ws.handler.MessageContext; import org.jboss.wsf.spi.deployment.AbstractExtensible; import org.w3c.dom.Element; /** * A WebServiceContext makes it possible for a web service endpoint implementation * class to access message context and security information relative to a request * being served. Typically a WebServiceContext is injected into an endpoint implementation * class using the Resource annotation. * * @author Thomas.Diesler@jboss.com * @since 03-May-2006 */ public abstract class ExtensibleWebServiceContext extends AbstractExtensible implements WebServiceContext { private MessageContext messageContext; public ExtensibleWebServiceContext(MessageContext messageContext) { this.messageContext = messageContext; } public MessageContext getMessageContext() { return messageContext; } public abstract Principal getUserPrincipal(); public abstract boolean isUserInRole(String role); public EndpointReference getEndpointReference(Element... referenceParameters) { throw new IllegalArgumentException("Not implemented"); } public T getEndpointReference(Class clazz, Element... referenceParameters) { throw new IllegalArgumentException("Not implemented"); } }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/ResourceInjectorFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/ResourceInjecto0000644000175000017500000000241210652566276031662 0ustar godgod/* * 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.wsf.spi.invocation; import org.jboss.wsf.spi.SPIView; /** * @author Heiko.Braun@jboss.com * Created: Jul 19, 2007 */ public abstract class ResourceInjectorFactory implements SPIView { public abstract ResourceInjector newResourceInjector(); } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/RequestHandlerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/RequestHandlerF0000644000175000017500000000240410652566276031614 0ustar godgod/* * 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.wsf.spi.invocation; import org.jboss.wsf.spi.SPIView; /** * @author Heiko.Braun@jboss.com * Created: Jul 23, 2007 */ public abstract class RequestHandlerFactory implements SPIView { public abstract RequestHandler newRequestHandler(); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/InvocationContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/InvocationConte0000644000175000017500000000342210650145103031637 0ustar godgod/* * 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.wsf.spi.invocation; import java.util.Map; import java.util.HashMap; /** * A basic invocation context. * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public class InvocationContext { private Object targetBean; private Map attachments = new HashMap(); public Object getTargetBean() { return targetBean; } public void setTargetBean(Object targetBean) { this.targetBean = targetBean; } public T addAttachment(Class key, Object value) { return (T)attachments.put(key, value); } public T getAttachment(Class key) { return (T)attachments.get(key); } public T removeAttachment(Class key) { return (T)attachments.get(key); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/SecurityAdaptor.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/SecurityAdaptor0000644000175000017500000000264310624642466031702 0ustar godgod/* * 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.wsf.spi.invocation; // $Id: SecurityAdaptor.java 3195 2007-05-22 19:32:06Z thomas.diesler@jboss.com $ import java.security.Principal; /** * A container idependent security adaptor * * @author Thomas.Diesler@jboss.org * @since 10-May-2005 */ public interface SecurityAdaptor { Principal getPrincipal(); void setPrincipal(Principal pricipal); Object getCredential(); void setCredential(Object credential); } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/WebServiceContextEJB.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/WebServiceConte0000644000175000017500000000375310654357356031616 0ustar godgod/* * 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.wsf.spi.invocation; // $Id: WebServiceContextEJB.java 4100 2007-08-02 13:41:02Z thomas.diesler@jboss.com $ import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext; import java.security.Principal; import javax.ejb.EJBContext; import javax.xml.ws.handler.MessageContext; /** * A WebServiceContext implementation that delegates to the EJBContext. * * @author Thomas.Diesler@jboss.org * @since 23-Jan-2007 */ public class WebServiceContextEJB extends ExtensibleWebServiceContext { public WebServiceContextEJB(MessageContext msgContext) { super(msgContext); } public Principal getUserPrincipal() { EJBContext ejbContext = getAttachment(EJBContext.class); Principal principal = ejbContext.getCallerPrincipal(); return principal; } public boolean isUserInRole(String role) { EJBContext ejbContext = getAttachment(EJBContext.class); boolean isUserInRole = ejbContext.isCallerInRole(role); return isUserInRole; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/ResourceInjector.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/ResourceInjecto0000644000175000017500000000245110650145103031641 0ustar godgod/* * 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.wsf.spi.invocation; import org.jboss.wsf.spi.SPIView; import javax.xml.ws.WebServiceContext; /** * @author Heiko.Braun@jboss.com * Created: Jul 19, 2007 */ public abstract class ResourceInjector { public abstract void inject(Object instance, WebServiceContext context); } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/RequestHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/RequestHandler.0000644000175000017500000000410610623427336031554 0ustar godgod/* * 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.wsf.spi.invocation; // $Id: RequestHandler.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.jboss.wsf.spi.deployment.Endpoint; /** * A general JAXWS request handler. * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public interface RequestHandler { /** Handle a web service http request */ void handleHttpRequest(Endpoint endpoint, HttpServletRequest req, HttpServletResponse res, ServletContext context) throws ServletException, IOException; /** Handle a web service request */ void handleRequest(Endpoint endpoint, InputStream inputStream, OutputStream outputStream, InvocationContext context) throws IOException; /** Handle a wsdl request */ void handleWSDLRequest(Endpoint endpoint, OutputStream output, InvocationContext context) throws IOException; } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/HandlerCallback.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/HandlerCallback0000644000175000017500000000347510634204450031542 0ustar godgod/* * 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.wsf.spi.invocation; // $Id: HandlerCallback.java 3576 2007-06-14 09:23:52Z thomas.diesler@jboss.com $ import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * A handler callback for the EJB21 Invoker * * @author Thomas.Diesler@jboss.org * @since 26-Apr-2007 */ public interface HandlerCallback { /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ boolean callRequestHandlerChain(Invocation wsInv, HandlerType type); /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ boolean callResponseHandlerChain(Invocation wsInv, HandlerType type); /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ boolean callFaultHandlerChain(Invocation wsInv, HandlerType type, Exception ex); }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/WebServiceContextFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/invocation/WebServiceConte0000644000175000017500000000256610654357356031617 0ustar godgod/* * 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.wsf.spi.invocation; import org.jboss.wsf.spi.SPIView; import javax.xml.ws.handler.MessageContext; /** * @author Heiko.Braun@jboss.com * Created: Jul 25, 2007 */ public abstract class WebServiceContextFactory implements SPIView { public abstract ExtensibleWebServiceContext newWebServiceContext(InvocationType type, MessageContext messageContext); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/annotation/0000755000175000017500000000000010755000240026610 5ustar godgod././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/annotation/WebContextImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/annotation/WebContextImpl.0000644000175000017500000001124210743731037031531 0ustar godgod/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.annotation; import java.lang.annotation.Annotation; /** * Represents a {@link org.jboss.wsf.spi.annotation.WebContext} annotation * and reflects the annotation defult values.
      * This implementation is used to provide a meta data representation (descriptor overrides) for the jboss EJB3 project. * * @author Heiko.Braun@jboss.com */ public class WebContextImpl implements WebContext { private String contextRoot = ""; private String authmethod = ""; private String[] virtualHosts = new String[] {}; private String urlpattern = ""; private String transportGuarantee = ""; private boolean securedWsdl = false; /** * The contextRoot element specifies the context root that the web service endpoint is deployed to. * If it is not specified it will be derived from the deployment short name. * * Applies to server side port components only. */ public String contextRoot() { return this.contextRoot; }; public void setContextRoot(String contextRoot) { this.contextRoot = contextRoot; } /** * The virtual hosts that the web service endpoint is deployed to. * * Applies to server side port components only. */ public String[] virtualHosts(){ return virtualHosts; }; public void setVirtualHosts(String[] virtualHosts) { this.virtualHosts = virtualHosts; } /** * Relative path that is appended to the contextRoot to form fully qualified * endpoint address for the web service endpoint. * * Applies to server side port components only. */ public String urlPattern() { return urlpattern; }; public void setUrlpattern(String urlpattern) { this.urlpattern = urlpattern; } /** * The authMethod is used to configure the authentication mechanism for the web service. * As a prerequisite to gaining access to any web service which are protected by an authorization * constraint, a user must have authenticated using the configured mechanism. * * Legal values for this element are "BASIC", or "CLIENT-CERT". */ public String authMethod() { return authmethod; }; public void setAuthmethod(String authmethod) { this.authmethod = authmethod; } /** * The transportGuarantee specifies that the communication * between client and server should be NONE, INTEGRAL, or * CONFIDENTIAL. NONE means that the application does not require any * transport guarantees. A value of INTEGRAL means that the application * requires that the data sent between the client and server be sent in * such a way that it can't be changed in transit. CONFIDENTIAL means * that the application requires that the data be transmitted in a * fashion that prevents other entities from observing the contents of * the transmission. In most cases, the presence of the INTEGRAL or * CONFIDENTIAL flag will indicate that the use of SSL is required. */ public String transportGuarantee() { return transportGuarantee; }; public void setTransportGuarantee(String transportGuarantee) { this.transportGuarantee = transportGuarantee; } /** * A secure endpoint does not secure wsdl access by default. * Explicitly setting secureWSDLAccess overrides this behaviour. * * Protect access to WSDL. See http://jira.jboss.org/jira/browse/JBWS-723 */ public boolean secureWSDLAccess() { return securedWsdl; }; public void setSecuredWsdl(boolean securedWsdl) { this.securedWsdl = securedWsdl; } public Class annotationType() { return WebContext.class; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/annotation/WebContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/annotation/WebContext.java0000644000175000017500000000717010650145103031544 0ustar godgod/* * 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.wsf.spi.annotation; // $Id: WebContext.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Provides web context specific meta data to EJB based web service endpoints. * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.TYPE }) public @interface WebContext { /** * The contextRoot element specifies the context root that the web service endpoint is deployed to. * If it is not specified it will be derived from the deployment short name. * * Applies to server side port components only. */ String contextRoot() default ""; /** * The virtual hosts that the web service endpoint is deployed to. * * Applies to server side port components only. */ String[] virtualHosts() default {}; /** * Relative path that is appended to the contextRoot to form fully qualified * endpoint address for the web service endpoint. * * Applies to server side port components only. */ String urlPattern() default ""; /** * The authMethod is used to configure the authentication mechanism for the web service. * As a prerequisite to gaining access to any web service which are protected by an authorization * constraint, a user must have authenticated using the configured mechanism. * * Legal values for this element are "BASIC", or "CLIENT-CERT". */ String authMethod() default ""; /** * The transportGuarantee specifies that the communication * between client and server should be NONE, INTEGRAL, or * CONFIDENTIAL. NONE means that the application does not require any * transport guarantees. A value of INTEGRAL means that the application * requires that the data sent between the client and server be sent in * such a way that it can't be changed in transit. CONFIDENTIAL means * that the application requires that the data be transmitted in a * fashion that prevents other entities from observing the contents of * the transmission. In most cases, the presence of the INTEGRAL or * CONFIDENTIAL flag will indicate that the use of SSL is required. */ String transportGuarantee() default ""; /** * A secure endpoint does not secure wsdl access by default. * Explicitly setting secureWSDLAccess overrides this behaviour. * * Protect access to WSDL. See http://jira.jboss.org/jira/browse/JBWS-723 */ boolean secureWSDLAccess() default false; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/binding/0000755000175000017500000000000010755000240026050 5ustar godgod././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/binding/BindingCustomization.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/binding/BindingCustomizati0000644000175000017500000000275110652261524031620 0ustar godgod/* * 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.wsf.spi.binding; import java.util.HashMap; /** * Allows introduction of arbitrary binding customization properties.

      * This may be different between stacks and addresses meta data binding * (i.e JSR-181 to UnifiedMetaData) as well as JAVA to XML binding operations. *

      * Supported properties need to be documented in subclasses. * * * @author Heiko.Braun@jboss.com * Created: Jun 28, 2007 */ public abstract class BindingCustomization extends HashMap { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/SPIProvider.java0000644000175000017500000000242610650145103027455 0ustar godgod/* * 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.wsf.spi; /** * Gives access to the SPI implementation. * * @author Heiko.Braun@jboss.com * Created: Jul 18, 2007 */ public abstract class SPIProvider { /* * Gets the specified SPI. */ public abstract T getSPI(java.lang.Class spiType); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/SPIView.java0000644000175000017500000000240210651123354026574 0ustar godgod/* * 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.wsf.spi; /** * Marks a specific subset onto the overall SPI.
      * An SPIView can be passed to the {@link SPIProvider} to get an implementation. * * @author Heiko.Braun@jboss.com * Created: Jul 18, 2007 */ public interface SPIView { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/0000755000175000017500000000000010755000240026552 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/0000755000175000017500000000000010755000240030526 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/RecordProcessor.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/Recor0000644000175000017500000000457510743476717031565 0ustar godgod/* * 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 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 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.wsf.spi.management.recording; //$Id: RecordProcessor.java 5483 2008-01-16 21:57:35Z thomas.diesler@jboss.com $ import java.util.List; /** * Processes a record. A RecordProcessor may have filters to allow processing * of records matching given criteria. It also gives users fine management of * record's attributes to processed. * * @author alessio.soldano@jboss.com * @since 8-Dec-2007 */ public interface RecordProcessor extends Cloneable { String getName(); void setName(String name); boolean isRecording(); void setRecording(boolean value); void processRecord(Record record); List getFilters(); void addFilter(RecordFilter filter); void setFilters(List filters); boolean isProcessSourceHost(); void setProcessSourceHost(boolean value); boolean isProcessDestinationHost(); void setProcessDestinationHost(boolean value); boolean isProcessMessageType(); void setProcessMessageType(boolean value); boolean isProcessEnvelope(); void setProcessEnvelope(boolean value); boolean isProcessHeaders(); void setProcessHeaders(boolean value); boolean isProcessOperation(); void setProcessOperation(boolean value); boolean isProcessDate(); void setProcessDate(boolean value); /** * RecordFilters must override Object.clone() */ Object clone() throws CloneNotSupportedException; } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/RecordFilter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/Recor0000644000175000017500000000274510743476717031562 0ustar godgod/* * 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.wsf.spi.management.recording; //$Id: RecordFilter.java 5483 2008-01-16 21:57:35Z thomas.diesler@jboss.com $ /** * A record filter * * @author alessio.soldano@jboss.com * @since 8-Dec-2007 */ public interface RecordFilter extends Cloneable { /** * Returns true if the filter matches the given record. */ boolean match(Record record); /** * RecordFilters must override Object.clone() */ Object clone() throws CloneNotSupportedException; } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/Record.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/Recor0000644000175000017500000000564010732533146031543 0ustar godgod/* * 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.wsf.spi.management.recording; //$Id: Record.java 5379 2007-12-20 18:37:26Z alessio.soldano@jboss.com $ import java.util.Date; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; /** * * @author alessio.soldano@jboss.com * @since 8-Dec-2007 */ public interface Record { public enum MessageType {INBOUND, OUTBOUND}; /** * Gets the group ID corresponding to the current message exchange flow * * @return */ public String getGroupID(); public void setGroupID(String groupID); /** * Gets the date of this record * * @return */ public Date getDate(); public void setDate(Date date); /** * Gets the source (message sender) host. The result format conforms to RFC2732 * * @return source host */ public String getSourceHost(); public void setSourceHost(String host); /** * Gets the source (message sender) host. The result format conforms to RFC2732 * * @return the source host */ public String getDestinationHost(); public void setDestinationHost(String host); /** * Gets the message type, i.e. MessageType.INBOUND or MessageType.OUTBOUND * * @return the message type */ public MessageType getMessageType(); public void setMessageType(MessageType type); /** * Gets the SOAP message envelope * * @return */ public String getEnvelope(); public void setEnvelope(String envelope); /** * Gets the HTTP headers * * @return the headers */ public Map> getHeaders(); public void addHeaders(String key, List value); public void setHeaders(Map> headers); /** * Gets the invoked operation * * @return the operation */ public QName getOperation(); public void setOperation(QName operation); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/RecordGroupAssociation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/recording/Recor0000644000175000017500000000521310732533146031537 0ustar godgod/* * 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.wsf.spi.management.recording; import java.util.Stack; import org.jboss.logging.Logger; //$Id: RecordGroupAssociation.java 5379 2007-12-20 18:37:26Z alessio.soldano@jboss.com $ /** * Associates the record group ID with the current thread. * * @author alessio.soldano@jboss.com * @since 8-Dec-2007 */ public class RecordGroupAssociation { private static ThreadLocal> groupIDAssoc = new ThreadLocal>(); // provide logging private static Logger log = Logger.getLogger(RecordGroupAssociation.class); public static void pushGroupID(String groupID) { if(log.isDebugEnabled()) log.debug("pushGroupID: " + groupID + " (Thread " +Thread.currentThread().getName()+ ")"); Stack stack = groupIDAssoc.get(); if (stack == null) { stack = new Stack(); groupIDAssoc.set(stack); } stack.push(groupID); } public static String peekGroupID() { String groupID = null; Stack stack = groupIDAssoc.get(); if (stack != null && stack.isEmpty() == false) { groupID = stack.peek(); } if(log.isDebugEnabled()) log.debug("peekGroupID: " + groupID + " (Thread " +Thread.currentThread().getName()+ ")"); return groupID; } public static String popGroupID() { String groupID = null; Stack stack = groupIDAssoc.get(); if (stack != null && stack.isEmpty() == false) { groupID = stack.pop(); } if(log.isDebugEnabled()) log.debug("popGroupID: " + groupID +" (Thread " +Thread.currentThread().getName()+ ")"); return groupID; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointMetricsFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointMetrics0000644000175000017500000000234510656330342031621 0ustar godgod/* * 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.wsf.spi.management; //$Id: EndpointMetricsDeploymentAspect.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ public abstract class EndpointMetricsFactory { public abstract EndpointMetrics newEndpointMetrics(); }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointRegistryFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointRegistr0000644000175000017500000000247410652566276031652 0ustar godgod/* * 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.wsf.spi.management; //$Id$ import org.jboss.wsf.spi.SPIView; /** * Get the endpoint registry from the kernel * * @author Thomas.Diesler@jboss.com * @since 20-Apr-2007 */ public abstract class EndpointRegistryFactory implements SPIView { public abstract EndpointRegistry getEndpointRegistry(); } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/ServerConfigFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/ServerConfigFac0000644000175000017500000000246010663300271031512 0ustar godgod/* * 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.wsf.spi.management; //$Id: $ import org.jboss.wsf.spi.SPIView; /** * Factory to container independent config * * @author Thomas.Diesler@jboss.org * @since 08-May-2006 */ public abstract class ServerConfigFactory implements SPIView { public abstract ServerConfig getServerConfig(); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointResolve0000644000175000017500000000241410651370327031631 0ustar godgod/* * 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.wsf.spi.management; import org.jboss.wsf.spi.deployment.Endpoint; import java.util.Iterator; /** * @author Heiko.Braun@jboss.com * Created: Jul 23, 2007 */ public interface EndpointResolver { Endpoint query(Iterator endpoints); } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointMetrics.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointMetrics0000644000175000017500000000333710656330342031623 0ustar godgod/* * 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.wsf.spi.management; //$Id: EndpointMetricsDeploymentAspect.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.util.Date; import org.jboss.wsf.spi.deployment.Endpoint; public interface EndpointMetrics { Endpoint getEndpoint(); void setEndpoint(Endpoint endpoint); void start(); void stop(); long processRequestMessage(); void processResponseMessage(long beginTime); void processFaultMessage(long beginTime); Date getStartTime(); Date getStopTime(); long getMinProcessingTime(); long getMaxProcessingTime(); long getAverageProcessingTime(); long getTotalProcessingTime(); long getRequestCount(); long getFaultCount(); long getResponseCount(); }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointRegistry.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/EndpointRegistr0000644000175000017500000000375610653357134031646 0ustar godgod/* * 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.wsf.spi.management; // $Id: EndpointRegistry.java 4025 2007-07-30 12:49:32Z thomas.diesler@jboss.com $ import java.util.Set; import javax.management.ObjectName; import org.jboss.wsf.spi.deployment.Endpoint; /** * A general endpoint registry. * * @author Thomas.Diesler@jboss.com * @author Heiko.Braun@jboss.com * * @since 20-Apr-2007 */ public interface EndpointRegistry { /** The bean name in the kernel registry */ String BEAN_NAME = "WSEndpointRegistry"; /** Get the list of registered endpoints */ Set getEndpoints(); /** Get the registered endpoint */ Endpoint getEndpoint(ObjectName epName); /** Resolve endpoints thrrough a resolve instance **/ Endpoint resolve(EndpointResolver resolver); /** True is an endpoint for that name is registered */ boolean isRegistered(ObjectName epName); /** Register an endpoint */ void register(Endpoint endpoint); /** Unregister an endpoint */ void unregister(Endpoint endpoint); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/ServerConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/management/ServerConfig.ja0000644000175000017500000000375510656374256031521 0ustar godgod/* * 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.wsf.spi.management; // $Id: ServerConfig.java 4265 2007-08-08 17:09:02Z thomas.diesler@jboss.com $ import java.io.File; import java.net.UnknownHostException; /** * Interface to container independent config * * @author Thomas.Diesler@jboss.org * @since 08-May-2006 */ public interface ServerConfig { /** The default bean name */ String BEAN_NAME = "WSServerConfig"; /** The host name that is returned if there is no other defined */ String UNDEFINED_HOSTNAME = "jbossws.undefined.host"; String getImplementationTitle(); String getImplementationVersion(); File getServerTempDir(); File getServerDataDir(); String getWebServiceHost(); void setWebServiceHost(String host) throws UnknownHostException; int getWebServicePort(); void setWebServicePort(int port); int getWebServiceSecurePort(); void setWebServiceSecurePort(int port); boolean isModifySOAPAddress(); void setModifySOAPAddress(boolean flag); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/0000755000175000017500000000000010755000240026573 5ustar godgod././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefBinderFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefBinde0000644000175000017500000000240510654122123031521 0ustar godgod/* * 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.wsf.spi.serviceref; import org.jboss.wsf.spi.SPIView; /** * @author Thomas.Diesler@jboss.com * @since 01-Aug-2007 */ public interface ServiceRefBinderFactory extends SPIView { ServiceRefBinder newServiceRefBinder(ServiceRefHandler.Type type); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefBinder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefBinde0000644000175000017500000000326710654112427031536 0ustar godgod/* * 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.wsf.spi.serviceref; import java.lang.reflect.AnnotatedElement; import javax.naming.Context; import javax.naming.NamingException; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; /** * Creates a ServiceReferenceable and binds it to JNDI. * * @author Heiko.Braun@jboss.com * Created: Jul 11, 2007 */ public interface ServiceRefBinder { final static String BEAN_NAME_JAXRPC = "WSServiceRefBinderJAXRPC"; final static String BEAN_NAME_JAXWS = "WSServiceRefBinderJAXWS"; void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader) throws NamingException; } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefElement.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefEleme0000644000175000017500000000251510654066746031553 0ustar godgod/* * 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.wsf.spi.serviceref; // $Id: ServiceRefElement.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import java.io.Serializable; /** * A marker for all related objects. * * @author Thomas.Diesler@jboss.org * @since 08-Mar-2007 */ public abstract class ServiceRefElement implements Serializable { } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefHandlerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefHandl0000644000175000017500000000240310654122123031524 0ustar godgod/* * 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.wsf.spi.serviceref; import org.jboss.wsf.spi.SPIView; //$Id: ServiceRefHandlerFactory.java 4060 2007-08-01 15:18:43Z heiko.braun@jboss.com $ public interface ServiceRefHandlerFactory extends SPIView { ServiceRefHandler getServiceRefHandler(); }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefMetaD0000644000175000017500000000373610743346427031520 0ustar godgod/* * 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.wsf.spi.serviceref; // $Id: ServiceRefMetaData.java 5474 2008-01-16 09:23:35Z heiko.braun@jboss.com $ import org.w3c.dom.Element; import java.io.Serializable; import java.util.List; /** * An abstract service-ref meta data object. * * @author Thomas.Diesler@jboss.org * @since 08-Mar-2007 */ public abstract class ServiceRefMetaData extends ServiceRefElement implements Serializable { public abstract String getServiceRefName(); public abstract void setServiceRefName(String name); public abstract Object getAnnotatedElement(); public abstract void setAnnotatedElement(Object anElement); public abstract boolean isProcessed(); public abstract void setProcessed(boolean flag); public abstract List getInjectionTargets(); @Deprecated public abstract void importStandardXml(Element element); @Deprecated public abstract void importJBossXml(Element element); public abstract void merge(ServiceRefMetaData targetRef); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/serviceref/ServiceRefHandl0000644000175000017500000000411710710104201031516 0ustar godgod/* * 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.wsf.spi.serviceref; // $Id: ServiceRefHandler.java 4888 2007-10-25 12:13:53Z thomas.diesler@jboss.com $ import javax.naming.Context; import javax.naming.NamingException; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; /** * An implementation of this interface handles all service-ref binding concerns * * @author Thomas.Diesler@jboss.org * @since 05-May-2004 */ public interface ServiceRefHandler { final String BEAN_NAME = "WSServiceRefHandler"; enum Type {JAXRPC, JAXWS}; @Deprecated ServiceRefMetaData newServiceRefMetaData(); @Deprecated Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs); @Deprecated void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value); void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot, ClassLoader loader, ServiceRefMetaData sref) throws NamingException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/SPIProviderResolver.java0000644000175000017500000000315010660054674031207 0ustar godgod/* * 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.wsf.spi; import org.jboss.wsf.spi.util.ServiceLoader; /** * Locates an SPIProvider. * * @author Heiko.Braun@jboss.com * Created: Jul 18, 2007 */ public abstract class SPIProviderResolver { public final static String DEFAULT_SPI_PROVIDER_RESOLVER = "org.jboss.wsf.framework.DefaultSPIProviderResolver"; public static SPIProviderResolver getInstance() { SPIProviderResolver resolver = (SPIProviderResolver)ServiceLoader.loadService(SPIProviderResolver.class.getName(), DEFAULT_SPI_PROVIDER_RESOLVER); return resolver; } public abstract SPIProvider getProvider(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/util/0000755000175000017500000000000010755000241025414 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/util/KernelLocator.java0000644000175000017500000000274510654274232031046 0ustar godgod/* * 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.wsf.spi.util; //$Id: KernelLocator.java 3137 2007-05-18 13:41:57Z thomas.diesler@jboss.com $ import org.jboss.kernel.Kernel; /** * Locate the single instance of the kernel * * @author Thomas.Diesler@jboss.org * @since 12-May-2006 */ public class KernelLocator { private static Kernel kernel; public static Kernel getKernel() { return KernelLocator.kernel; } public void setKernel(Kernel kernel) { KernelLocator.kernel = kernel; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/util/ServiceLoader.java0000644000175000017500000002104610654274232031024 0ustar godgod/* * 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.wsf.spi.util; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Properties; // $Id: ServiceLoader.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ /** * Load a service class using this ordered lookup procedure * * @author Thomas.Diesler@jboss.com * @since 14-Dec-2006 */ public abstract class ServiceLoader { /** * This method uses the algorithm below using the JAXWS Provider as an example. * * 1. If a resource with the name of META-INF/services/javax.xml.ws.spi.Provider exists, then * its first line, if present, is used as the UTF-8 encoded name of the implementation class. * * 2. If the ${java.home}/lib/jaxws.properties file exists and it is readable by the * java.util.Properties.load(InputStream) method and it contains an entry whose key is * javax.xml.ws.spi.Provider, then the value of that entry is used as the name of the implementation class. * * 3. If a system property with the name javax.xml.ws.spi.Provider is defined, then its value is used * as the name of the implementation class. * * 4. Finally, a default implementation class name is used. */ public static Object loadService(String propertyName, String defaultFactory) { Object factory = loadFromServices(propertyName, null); if (factory == null) { factory = loadFromPropertiesFile(propertyName, null); } if (factory == null) { factory = loadFromSystemProperty(propertyName, defaultFactory); } return factory; } /** Use the Services API (as detailed in the JAR specification), if available, to determine the classname. */ public static Object loadFromServices(String propertyName, String defaultFactory) { Object factory = null; String factoryName = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); // Use the Services API (as detailed in the JAR specification), if available, to determine the classname. String filename = "META-INF/services/" + propertyName; InputStream inStream = loader.getResourceAsStream(filename); if (inStream != null) { try { BufferedReader br = new BufferedReader(new InputStreamReader(inStream, "UTF-8")); factoryName = br.readLine(); br.close(); if (factoryName != null) { Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } // Use the default factory implementation class. if (factory == null && defaultFactory != null) { factory = loadDefault(defaultFactory); } return factory; } /** Use the system property */ public static Object loadFromSystemProperty(String propertyName, String defaultFactory) { Object factory = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); PrivilegedAction action = new PropertyAccessAction(propertyName); String factoryName = (String)AccessController.doPrivileged(action); if (factoryName != null) { try { //if(log.isDebugEnabled()) log.debug("Load from system property: " + factoryName); Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } // Use the default factory implementation class. if (factory == null && defaultFactory != null) { factory = loadDefault(defaultFactory); } return factory; } /** * Use the properties file "${java.home}/lib/jaxws.properties" in the JRE directory. * This configuration file is in standard java.util.Properties format and contains the * fully qualified name of the implementation class with the key being the system property defined above. */ public static Object loadFromPropertiesFile(String propertyName, String defaultFactory) { Object factory = null; String factoryName = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); // Use the properties file "lib/jaxm.properties" in the JRE directory. // This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. PrivilegedAction action = new PropertyAccessAction("java.home"); String javaHome = (String)AccessController.doPrivileged(action); File jaxmFile = new File(javaHome + "/lib/jaxws.properties"); if (jaxmFile.exists()) { try { action = new PropertyFileAccessAction(jaxmFile.getCanonicalPath()); Properties jaxmProperties = (Properties)AccessController.doPrivileged(action); factoryName = jaxmProperties.getProperty(propertyName); if (factoryName != null) { //if(log.isDebugEnabled()) log.debug("Load from " + jaxmFile + ": " + factoryName); Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } // Use the default factory implementation class. if (factory == null && defaultFactory != null) { factory = loadDefault(defaultFactory); } return factory; } private static Object loadDefault(String defaultFactory) { Object factory = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); // Use the default factory implementation class. if (defaultFactory != null) { try { //if(log.isDebugEnabled()) log.debug("Load from default: " + factoryName); Class factoryClass = loader.loadClass(defaultFactory); factory = factoryClass.newInstance(); } catch (Throwable t) { throw new IllegalStateException("Failed to load: " + defaultFactory, t); } } return factory; } private static class PropertyAccessAction implements PrivilegedAction { private String name; PropertyAccessAction(String name) { this.name = name; } public Object run() { return System.getProperty(name); } } private static class PropertyFileAccessAction implements PrivilegedAction { private String filename; PropertyFileAccessAction(String filename) { this.filename = filename; } public Object run() { try { InputStream inStream = new FileInputStream(filename); Properties props = new Properties(); props.load(inStream); return props; } catch (IOException ex) { throw new SecurityException("Cannot load properties: " + filename, ex); } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-spi/org/jboss/wsf/spi/WSFException.java0000644000175000017500000000342110645664024027635 0ustar godgod/* * 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.wsf.spi; /** * @author Heiko.Braun@jboss.com * Created: Jul 11, 2007 */ public class WSFException extends RuntimeException { public WSFException() { super(); } public WSFException(String message) { super(message); } public WSFException(String message, Throwable cause) { super(message, cause); } public WSFException(Throwable cause) { super(cause); } public static void rethrow(String string, Throwable th) { if (th instanceof WSFException) throw (WSFException)th; throw new WSFException(string, th); } public static void rethrow(Throwable th) { if (th instanceof WSFException) throw (WSFException)th; throw new WSFException(th); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/0000755000175000017500000000000010755000270021633 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/0000755000175000017500000000000010755000250022420 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/0000755000175000017500000000000010755000270023542 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/0000755000175000017500000000000010755000250024337 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/0000755000175000017500000000000010755000250025444 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/0000755000175000017500000000000010755000251026412 5ustar godgod././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/PublishContractDeploymentAspect.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/PublishContractD0000644000175000017500000000406010652256117031557 0ustar godgod/* * 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.wsf.stack.jbws; //$Id: PublishContractDeployer.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.io.IOException; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.DeploymentAspect; import org.jboss.wsf.spi.deployment.WSFDeploymentException; /** * A deployer that publishes the wsdl * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class PublishContractDeploymentAspect extends DeploymentAspect { @Override public void create(Deployment dep) { UnifiedMetaData umd = dep.getAttachment(UnifiedMetaData.class); if (umd == null) throw new IllegalStateException("Cannot obtain unified meta data"); try { WSDLFilePublisher publisher = new WSDLFilePublisher((ArchiveDeployment)dep); publisher.publishWsdlFiles(umd); } catch (IOException ex) { throw new WSFDeploymentException(ex); } } }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/EventingDeploymentAspect.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/EventingDeployme0000644000175000017500000000774610645716517031652 0ustar godgod/* * 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.wsf.stack.jbws; //$Id: EventingDeployer.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import org.jboss.ws.extensions.eventing.EventingConstants; import org.jboss.ws.extensions.eventing.deployment.EventingEndpointDeployment; import org.jboss.ws.extensions.eventing.metadata.EventingEpMetaExt; import org.jboss.ws.extensions.eventing.mgmt.SubscriptionManagerFactory; import org.jboss.ws.extensions.eventing.mgmt.SubscriptionManagerMBean; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.spi.deployment.DeploymentAspect; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.Endpoint; /** * A deployer that creates event sources and register them with the * subscripion manager when a service endpoint is created. * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class EventingDeploymentAspect extends DeploymentAspect { @Override public void create(Deployment dep) { for (Endpoint ep : dep.getService().getEndpoints()) { ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data"); EventingEpMetaExt ext = (EventingEpMetaExt)sepMetaData.getExtension(EventingConstants.NS_EVENTING); if (ext != null) { // Currently several endpoints may belong to an event source deployment. // Therefore we have to avoid duplicate registrations // Actually there should be a 1:n mapping of event source NS to endpoints. // See also http://jira.jboss.org/jira/browse/JBWS-770 // create pending incomplete event source EventingEndpointDeployment desc = new EventingEndpointDeployment(ext.getEventSourceNS(), ext.getNotificationSchema(), ext.getNotificationRootElementNS()); desc.setEndpointAddress(sepMetaData.getEndpointAddress()); desc.setPortName(sepMetaData.getPortName()); SubscriptionManagerFactory factory = SubscriptionManagerFactory.getInstance(); SubscriptionManagerMBean manager = factory.getSubscriptionManager(); manager.registerEventSource(desc); } } } @Override public void destroy(Deployment dep) { for (Endpoint ep : dep.getService().getEndpoints()) { ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data"); EventingEpMetaExt ext = (EventingEpMetaExt)sepMetaData.getExtension(EventingConstants.NS_EVENTING); if (ext != null) { SubscriptionManagerFactory factory = SubscriptionManagerFactory.getInstance(); SubscriptionManagerMBean manager = factory.getSubscriptionManager(); manager.removeEventSource(ext.getEventSourceURI()); } } } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/EndpointRegistryFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/EndpointRegistry0000644000175000017500000000323210652566276031672 0ustar godgod/* * 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.wsf.stack.jbws; import org.jboss.wsf.spi.management.EndpointRegistryFactory; import org.jboss.wsf.spi.management.EndpointRegistry; import org.jboss.wsf.common.KernelAwareSPIFactory; /** * An EndpointRegistryFactory implementation that retrieves * the registry from MC kernel. * * @see EndpointRegistry.BEAN_NAME * * @author Heiko.Braun@jboss.com * Created: Jul 23, 2007 */ public class EndpointRegistryFactoryImpl extends EndpointRegistryFactory { public EndpointRegistry getEndpointRegistry() { return new KernelAwareSPIFactory().getKernelProvidedSPI( EndpointRegistry.BEAN_NAME, EndpointRegistry.class ); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/RequestHandlerFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/RequestHandlerFa0000644000175000017500000000257310652566276031565 0ustar godgod/* * 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.wsf.stack.jbws; import org.jboss.wsf.spi.invocation.RequestHandlerFactory; import org.jboss.wsf.spi.invocation.RequestHandler; /** * @author Heiko.Braun@jboss.com * Created: Jul 23, 2007 */ public class RequestHandlerFactoryImpl extends RequestHandlerFactory { public RequestHandler newRequestHandler() { return new RequestHandlerImpl(); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/WebAppResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/WebAppResolver.j0000644000175000017500000000441610651377713031511 0ustar godgod/* * 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.wsf.stack.jbws; import org.jboss.wsf.spi.management.EndpointResolver; import org.jboss.wsf.spi.deployment.Endpoint; import javax.management.ObjectName; import java.util.Iterator; /** * Resolves Endpoints by Servlet name and web context path. * * @author Heiko.Braun@jboss.com * Created: Jul 24, 2007 */ public class WebAppResolver implements EndpointResolver { private String contextPath; private String servletName; public WebAppResolver(String contextPath, String servletName) { this.contextPath = contextPath; this.servletName = servletName; } public Endpoint query(Iterator endpoints) { Endpoint endpoint = null; if (contextPath.startsWith("/")) contextPath = contextPath.substring(1); while(endpoints.hasNext()) { Endpoint auxEndpoint = endpoints.next(); ObjectName sepId = auxEndpoint.getName(); String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT); String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT); if (servletName.equals(propEndpoint) && contextPath.equals(propContext)) { endpoint = auxEndpoint; break; } } return endpoint; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/EndpointServlet.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/EndpointServlet.0000644000175000017500000001231210705632334031547 0ustar godgod/* * 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.wsf.stack.jbws; // $Id: EndpointServlet.java 4786 2007-10-18 10:26:36Z heiko.braun@jboss.com $ import org.jboss.logging.Logger; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.wsf.common.ObjectNameFactory; import org.jboss.wsf.spi.invocation.EndpointAssociation; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.invocation.RequestHandler; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.Deployment.DeploymentType; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.deployment.Endpoint.EndpointState; import org.jboss.wsf.spi.management.EndpointRegistry; import org.jboss.wsf.spi.management.EndpointRegistryFactory; import javax.management.ObjectName; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.ws.WebServiceException; import java.io.IOException; /** * A servlet that is installed for every web service endpoint. * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class EndpointServlet extends HttpServlet { // provide logging private static final Logger log = Logger.getLogger(EndpointServlet.class); protected Endpoint endpoint; protected EndpointRegistry epRegistry; public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry(); } public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { if (endpoint == null) { String contextPath = req.getContextPath(); initServiceEndpoint(contextPath); } try { EndpointAssociation.setEndpoint(endpoint); RequestHandler requestHandler = endpoint.getRequestHandler(); requestHandler.handleHttpRequest(endpoint, req, res, getServletContext()); } finally { EndpointAssociation.removeEndpoint(); } } /** Initialize the service endpoint */ protected void initServiceEndpoint(String contextPath) { initEndpoint(contextPath, getServletName()); initEndpointConfig(); startEndpoint(); } private void startEndpoint() { // Start the endpoint Deployment dep = endpoint.getService().getDeployment(); if (dep.getType() == DeploymentType.JAXRPC_JSE || dep.getType() == DeploymentType.JAXWS_JSE) { if (endpoint.getState() == EndpointState.CREATED) endpoint.getLifecycleHandler().start(endpoint); } } private void initEndpointConfig() { // read the config name/file from web.xml ServletContext ctx = getServletContext(); String configName = ctx.getInitParameter("jbossws-config-name"); String configFile = ctx.getInitParameter("jbossws-config-file"); if (configName != null || configFile != null) { ServerEndpointMetaData epMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); if (epMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data"); log.debug("Updating service endpoint config\n config-name: " + configName + "\n config-file: " + configFile); epMetaData.setConfigName(configName, configFile); } } private void initEndpoint(String contextPath, String servletName) { WebAppResolver resolver = new WebAppResolver(contextPath, servletName); this.endpoint = epRegistry.resolve(resolver); if (this.endpoint == null) { ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath + "," + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + getServletName() ); throw new WebServiceException("Cannot obtain endpoint for: " + oname); } } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/ServiceEndpointInvokerDeploymentAspect.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/ServiceEndpointI0000644000175000017500000000455410651643273031573 0ustar godgod/* * 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.wsf.stack.jbws; //$Id: ServiceEndpointInvokerDeployer.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import org.jboss.ws.core.server.ServiceEndpointInvoker; import org.jboss.ws.core.server.ServiceEndpointInvokerEJB21; import org.jboss.wsf.spi.deployment.DeploymentAspect; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.deployment.Deployment.DeploymentType; /** * A deployer that associates the ServiceEndpointInvoker with the endpoint * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class ServiceEndpointInvokerDeploymentAspect extends DeploymentAspect { @Override public void create(Deployment dep) { for (Endpoint ep : dep.getService().getEndpoints()) { ServiceEndpointInvoker epInvoker = ep.getAttachment(ServiceEndpointInvoker.class); if (epInvoker == null) { DeploymentType depType = ep.getService().getDeployment().getType(); if (depType == DeploymentType.JAXRPC_EJB21) { epInvoker = new ServiceEndpointInvokerEJB21(); } else { epInvoker = new ServiceEndpointInvoker(); } ep.addAttachment(ServiceEndpointInvoker.class, epInvoker); epInvoker.init(ep); } } } }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/JAXBIntroDeploym0000644000175000017500000000731210674273130031442 0ustar godgod/* * 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.wsf.stack.jbws; import com.sun.xml.bind.api.JAXBRIContext; import org.jboss.jaxb.intros.IntroductionsAnnotationReader; import org.jboss.jaxb.intros.IntroductionsConfigParser; import org.jboss.jaxb.intros.configmodel.JaxbIntros; import org.jboss.logging.Logger; import org.jboss.ws.core.jaxws.JAXBBindingCustomization; import org.jboss.wsf.spi.binding.BindingCustomization; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.DeploymentAspect; import org.jboss.wsf.spi.deployment.Endpoint; import java.io.IOException; import java.io.InputStream; /** * @author Heiko.Braun@jboss.com * @version $Revision: 4594 $ */ public class JAXBIntroDeploymentAspect extends DeploymentAspect { private static Logger logger = Logger.getLogger(JAXBIntroDeploymentAspect.class); public void create(Deployment deployment) { InputStream introsConfigStream = null; try { // META-INF first ClassLoader classLoader = deployment.getRuntimeClassLoader(); introsConfigStream = classLoader.getResource("META-INF/jaxb-intros.xml").openStream(); } catch (Exception e) {} if(null == introsConfigStream) { try { // WEB-INF second ClassLoader classLoader = deployment.getRuntimeClassLoader(); introsConfigStream = classLoader.getResource("WEB-INF/jaxb-intros.xml").openStream(); } catch (Exception e) { return; } } try { if(introsConfigStream != null) { JaxbIntros jaxbIntros = IntroductionsConfigParser.parseConfig(introsConfigStream); IntroductionsAnnotationReader annotationReader = new IntroductionsAnnotationReader(jaxbIntros); String defaultNamespace = jaxbIntros.getDefaultNamespace(); BindingCustomization jaxbCustomizations = new JAXBBindingCustomization(); jaxbCustomizations.put(JAXBRIContext.ANNOTATION_READER, annotationReader); if(defaultNamespace != null) { jaxbCustomizations.put(JAXBRIContext.DEFAULT_NAMESPACE_REMAP, defaultNamespace); } // ServerEndpointMetaData#getBindingCustomization becomes the consumer later on for(Endpoint endpoint : deployment.getService().getEndpoints()) { endpoint.addAttachment(BindingCustomization.class, jaxbCustomizations); } } } finally { if(introsConfigStream != null) { try { introsConfigStream.close(); } catch (IOException e) { logger.error("[" + deployment.getService().getContextRoot() + "] Error closing JAXB Introductions Configurations stream ", e); } } } } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/NativeServerConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/NativeServerConf0000644000175000017500000000360510655066037031601 0ustar godgod/* * 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.wsf.stack.jbws; //$Id: DefaultServerConfig.java 4023 2007-07-28 07:14:06Z thomas.diesler@jboss.com $ import org.jboss.logging.Logger; import org.jboss.wsf.common.management.AbstractServerConfig; /** * Basic implementation of a ServerConfig * * @author Thomas.Diesler@jboss.org * @since 08-May-2006 */ public class NativeServerConfig extends AbstractServerConfig implements NativeServerConfigMBean { private static final Logger log = Logger.getLogger(NativeServerConfig.class); public String getImplementationTitle() { return getClass().getPackage().getImplementationTitle(); } public String getImplementationVersion() { return getClass().getPackage().getImplementationVersion(); } public void create() throws Exception { log.info(getImplementationTitle()); log.info(getImplementationVersion()); super.create(); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/UnifiedMetaDataDeploymentAspect.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/UnifiedMetaDataD0000644000175000017500000001073310652256117031443 0ustar godgod/* * 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.wsf.stack.jbws; //$Id: UnifiedMetaDataDeployer.java 3186 2007-05-22 15:39:58Z thomas.diesler@jboss.com $ import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder; import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderEJB3; import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.DeploymentAspect; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.deployment.Deployment.DeploymentType; /** * A deployer that builds the UnifiedDeploymentInfo * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class UnifiedMetaDataDeploymentAspect extends DeploymentAspect { @Override public void create(Deployment dep) { UnifiedMetaData umd = dep.getAttachment(UnifiedMetaData.class); if (umd == null) { if (dep.getType() == DeploymentType.JAXRPC_JSE) { JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder(); umd = builder.buildMetaData((ArchiveDeployment)dep); } else if (dep.getType() == DeploymentType.JAXRPC_EJB21) { JAXRPCServerMetaDataBuilder builder = new JAXRPCServerMetaDataBuilder(); umd = builder.buildMetaData((ArchiveDeployment)dep); } else if (dep.getType() == DeploymentType.JAXWS_JSE) { JAXWSMetaDataBuilderJSE builder = new JAXWSMetaDataBuilderJSE(); umd = builder.buildMetaData((ArchiveDeployment)dep); } else if (dep.getType() == DeploymentType.JAXWS_EJB3) { JAXWSMetaDataBuilderEJB3 builder = new JAXWSMetaDataBuilderEJB3(); umd = builder.buildMetaData((ArchiveDeployment)dep); } else { throw new IllegalStateException("Invalid type: " + dep.getType()); } dep.addAttachment(UnifiedMetaData.class, umd); } for (Endpoint ep : dep.getService().getEndpoints()) { ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) { sepMetaData = getEndpointMetaData(umd, ep); sepMetaData.setEndpoint(ep); ep.addAttachment(ServerEndpointMetaData.class, sepMetaData); String targetBean = ep.getTargetBeanName(); if (targetBean != null) sepMetaData.setServiceEndpointImplName(targetBean); } } } private ServerEndpointMetaData getEndpointMetaData(UnifiedMetaData umd, Endpoint ep) { String epName = ep.getShortName(); ServerEndpointMetaData epMetaData = null; for (ServiceMetaData serviceMetaData : umd.getServices()) { for (EndpointMetaData aux : serviceMetaData.getEndpoints()) { String linkName = ((ServerEndpointMetaData)aux).getLinkName(); if (epName.equals(linkName)) { epMetaData = (ServerEndpointMetaData)aux; break; } } } if (epMetaData == null) throw new IllegalStateException("Cannot find endpoint meta data for: " + epName); return epMetaData; } }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/EagerInitializeDeploymentAspect.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/EagerInitializeD0000644000175000017500000000367310656142514031530 0ustar godgod/* * 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.wsf.stack.jbws; //$Id: EagerInitializeDeployer.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.wsf.spi.deployment.DeploymentAspect; import org.jboss.wsf.spi.deployment.Deployment; /** * A deployer that initializes the UMDM * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class EagerInitializeDeploymentAspect extends DeploymentAspect { @Override public void create(Deployment dep) { UnifiedMetaData umd = dep.getAttachment(UnifiedMetaData.class); if (umd == null) throw new IllegalStateException("Cannot obtain unified meta data"); ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader(); if(null == runtimeClassLoader) throw new IllegalArgumentException("Runtime classloader may not be null"); umd.setClassLoader(runtimeClassLoader); umd.eagerInitialize(); } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/NativeServerConfigMBean.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/NativeServerConf0000644000175000017500000000267410655066037031606 0ustar godgod/* * 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.wsf.stack.jbws; //$Id: DefaultServerConfig.java 4023 2007-07-28 07:14:06Z thomas.diesler@jboss.com $ import org.jboss.wsf.common.management.AbstractServerConfigMBean; /** * Basic implementation of a ServerConfig * * @author Thomas.Diesler@jboss.org * @since 08-May-2006 */ public interface NativeServerConfigMBean extends AbstractServerConfigMBean { String getImplementationTitle(); String getImplementationVersion(); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/RequestHandlerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/RequestHandlerIm0000644000175000017500000005175610730542057031577 0ustar godgod/* * 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.wsf.stack.jbws; //$Id: RequestHandlerImpl.java 5322 2007-12-14 17:58:07Z richard.opalka@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.URL; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.activation.DataHandler; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.http.HTTPBinding; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonBinding; import org.jboss.ws.core.CommonBindingProvider; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.CommonSOAPFaultException; import org.jboss.ws.core.HTTPMessageImpl; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.MessageTrace; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC; import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC; import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS; import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS; import org.jboss.ws.core.server.MimeHeaderSource; import org.jboss.ws.core.server.ServiceEndpointInvoker; import org.jboss.ws.core.server.ServletHeaderSource; import org.jboss.ws.core.server.ServletRequestContext; import org.jboss.ws.core.server.WSDLRequestHandler; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.MessageFactoryImpl; import org.jboss.ws.core.soap.SOAPConnectionImpl; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.utils.ThreadLocalAssociation; import org.jboss.ws.extensions.addressing.AddressingConstantsImpl; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.deployment.Endpoint.EndpointState; import org.jboss.wsf.spi.invocation.InvocationContext; import org.jboss.wsf.spi.invocation.RequestHandler; import org.jboss.wsf.spi.management.EndpointMetrics; import org.jboss.wsf.spi.management.ServerConfig; import org.jboss.wsf.spi.management.ServerConfigFactory; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.common.DOMWriter; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Document; /** * A request handler * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class RequestHandlerImpl implements RequestHandler { // provide logging private static final Logger log = Logger.getLogger(RequestHandlerImpl.class); private ServerConfig serverConfig; private MessageFactoryImpl msgFactory; RequestHandlerImpl() { SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig(); msgFactory = new MessageFactoryImpl(); } public void handleHttpRequest(Endpoint endpoint, HttpServletRequest req, HttpServletResponse res, ServletContext context) throws ServletException, IOException { String method = req.getMethod(); if (method.equals("POST")) { doPost(endpoint, req, res, context); } else if (method.equals("GET")) { doGet(endpoint, req, res, context); } else { throw new WSException("Unsupported method: " + method); } } private void doGet(Endpoint endpoint, HttpServletRequest req, HttpServletResponse res, ServletContext context) throws ServletException, IOException { // Process a WSDL request if (req.getParameter("wsdl") != null || req.getParameter("WSDL") != null) { res.setContentType("text/xml"); ServletOutputStream out = res.getOutputStream(); try { ServletRequestContext reqContext = new ServletRequestContext(context, req, res); handleWSDLRequest(endpoint, out, reqContext); } catch (Exception ex) { handleException(ex); } finally { try { out.close(); } catch (IOException ioex) { log.error("Cannot close output stream"); } } } else { res.setStatus(405); res.setContentType("text/plain"); Writer out = res.getWriter(); out.write("HTTP GET not supported"); out.close(); } } private void doPost(Endpoint endpoint, HttpServletRequest req, HttpServletResponse res, ServletContext context) throws ServletException, IOException { log.debug("doPost: " + req.getRequestURI()); ServletInputStream in = req.getInputStream(); ServletOutputStream out = res.getOutputStream(); ClassLoader classLoader = endpoint.getService().getDeployment().getRuntimeClassLoader(); if (classLoader == null) throw new IllegalStateException("Deployment has no classloader associated"); // Set the thread context class loader ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); try { ServletRequestContext reqContext = new ServletRequestContext(context, req, res); handleRequest(endpoint, in, out, reqContext); } catch (Exception ex) { handleException(ex); } finally { // Reset the thread context class loader Thread.currentThread().setContextClassLoader(ctxClassLoader); try { out.close(); } catch (IOException ioex) { log.error("Cannot close output stream"); } } } public void handleRequest(Endpoint endpoint, InputStream inStream, OutputStream outStream, InvocationContext invContext) { log.debug("handleRequest: " + endpoint.getName()); ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data"); Type type = sepMetaData.getType(); // Build the message context CommonMessageContext msgContext; if (type == EndpointMetaData.Type.JAXRPC) { msgContext = new SOAPMessageContextJAXRPC(); invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext); } else { msgContext = new SOAPMessageContextJAXWS(); msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false)); msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap()); invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext); } // Set servlet specific properties HttpServletResponse httpResponse = null; ServletHeaderSource headerSource = null; if (invContext instanceof ServletRequestContext) { ServletRequestContext reqContext = (ServletRequestContext)invContext; ServletContext servletContext = reqContext.getServletContext(); HttpServletRequest httpRequest = reqContext.getHttpServletRequest(); httpResponse = reqContext.getHttpServletResponse(); headerSource = new ServletHeaderSource(httpRequest, httpResponse); if (type == EndpointMetaData.Type.JAXRPC) { msgContext.put(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext); msgContext.put(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest); msgContext.put(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse); } else { msgContext.put(MessageContextJAXWS.HTTP_REQUEST_HEADERS, headerSource.getHeaderMap()); msgContext.put(MessageContextJAXWS.HTTP_REQUEST_METHOD, httpRequest.getMethod()); msgContext.put(MessageContextJAXWS.QUERY_STRING, httpRequest.getQueryString()); msgContext.put(MessageContextJAXWS.PATH_INFO, httpRequest.getPathInfo()); msgContext.put(MessageContextJAXWS.SERVLET_CONTEXT, servletContext); msgContext.put(MessageContextJAXWS.SERVLET_REQUEST, httpRequest); msgContext.put(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse); } } // Associate a message context with the current thread MessageContextAssociation.pushMessageContext(msgContext); msgContext.setEndpointMetaData(sepMetaData); try { MessageAbstraction resMessage = processRequest(endpoint, headerSource, invContext, inStream); // Replace the message context with the response context msgContext = MessageContextAssociation.peekMessageContext(); Map> headers = (Map>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS); if (headerSource != null && headers != null) headerSource.setHeaderMap(headers); Integer code = (Integer)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_CODE); if (httpResponse != null && code != null) httpResponse.setStatus(code.intValue()); boolean isFault = false; if (resMessage instanceof SOAPMessage) { SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart(); if (part == null) throw new SOAPException("Cannot obtain SOAPPart from response message"); // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP status code // if the response envelope is a Fault. // // Also, a one-way operation must show up as empty content, and can be detected // by a null envelope. SOAPEnvelope soapEnv = part.getEnvelope(); isFault = soapEnv != null && soapEnv.getBody().hasFault(); if (httpResponse != null && isFault) { httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } Map rmResCtx = (Map)msgContext.get(RMConstant.RESPONSE_CONTEXT); boolean isWsrmMessage = rmResCtx != null; boolean isWsrmOneWay = isWsrmMessage && (Boolean)rmResCtx.get(RMConstant.ONE_WAY_OPERATION); if ((outStream != null) && (isWsrmOneWay == false)) // RM hack sendResponse(outStream, msgContext, isFault); } catch (Exception ex) { WSException.rethrow(ex); } finally { // Cleanup outbound attachments CommonMessageContext.cleanupAttachments( MessageContextAssociation.peekMessageContext() ); // Reset the message context association MessageContextAssociation.popMessageContext(); // clear thread local storage ThreadLocalAssociation.clear(); DOMUtils.clearThreadLocals(); } } private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext, boolean isFault) throws SOAPException, IOException { MessageAbstraction resMessage = msgContext.getMessageAbstraction(); String wsaTo = null; // Get the destination from the AddressingProperties AddressingProperties outProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND); if (outProps != null && outProps.getTo() != null) { AddressingConstantsImpl ADDR = new AddressingConstantsImpl(); wsaTo = outProps.getTo().getURI().toString(); if (wsaTo.equals(ADDR.getAnonymousURI())) wsaTo = null; } if (wsaTo != null) { log.debug("Sending response to addressing destination: " + wsaTo); new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo); } else { resMessage.writeTo(outputStream); } } /** * Handle a request to this web service endpoint */ private MessageAbstraction processRequest(Endpoint ep, MimeHeaderSource headerSource, InvocationContext reqContext, InputStream inputStream) throws BindingException { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data"); long beginProcessing = 0; ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader(); try { EndpointState state = ep.getState(); if (state != EndpointState.STARTED) { QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER; String faultString = "Endpoint cannot handle requests in state: " + state; throw new CommonSOAPFaultException(faultCode, faultString); } log.debug("BEGIN handleRequest: " + ep.getName()); beginProcessing = initRequestMetrics(ep); MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null); MessageAbstraction reqMessage; String bindingID = sepMetaData.getBindingId(); if (HTTPBinding.HTTP_BINDING.equals(bindingID)) { reqMessage = new HTTPMessageImpl(headers, inputStream); } else { msgFactory.setServiceMode(sepMetaData.getServiceMode()); msgFactory.setStyle(sepMetaData.getStyle()); reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream); } // Associate current message with message context msgContext.setMessageAbstraction(reqMessage); // debug the incomming message MessageTrace.traceMessage("Incoming Request Message", reqMessage); // Set the thread context class loader ClassLoader classLoader = sepMetaData.getClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); // Get the Invoker ServiceEndpointInvoker epInvoker = ep.getAttachment(ServiceEndpointInvoker.class); if (epInvoker == null) throw new IllegalStateException("Cannot obtain ServiceEndpointInvoker"); // Invoke the service endpoint epInvoker.invoke(reqContext); // Get the response message context msgContext = MessageContextAssociation.peekMessageContext(); // Get the response message MessageAbstraction resMessage = msgContext.getMessageAbstraction(); if (resMessage != null) postProcessResponse(headerSource, resMessage); return resMessage; } catch (Exception ex) { MessageAbstraction resMessage = msgContext.getMessageAbstraction(); // In case we have an exception before the invoker is called // we create the fault message here. if (resMessage == null || resMessage.isFaultMessage() == false) { CommonBindingProvider bindingProvider = new CommonBindingProvider(sepMetaData); CommonBinding binding = bindingProvider.getCommonBinding(); resMessage = binding.bindFaultMessage(ex); } if (resMessage != null) postProcessResponse(headerSource, resMessage); return resMessage; } finally { try { MessageAbstraction resMessage = msgContext.getMessageAbstraction(); if (resMessage != null) { if (resMessage.isFaultMessage()) { processFaultMetrics(ep, beginProcessing); } else { processResponseMetrics(ep, beginProcessing); } } } catch (Exception ex) { log.error("Cannot process metrics", ex); } // Reset the thread context class loader Thread.currentThread().setContextClassLoader(ctxClassLoader); log.debug("END handleRequest: " + ep.getName()); } } private long initRequestMetrics(Endpoint endpoint) { long beginTime = 0; EndpointMetrics metrics = endpoint.getEndpointMetrics(); if (metrics != null) beginTime = metrics.processRequestMessage(); return beginTime; } private void processResponseMetrics(Endpoint endpoint, long beginTime) { EndpointMetrics metrics = endpoint.getEndpointMetrics(); if (metrics != null) metrics.processResponseMessage(beginTime); } private void processFaultMetrics(Endpoint endpoint, long beginTime) { EndpointMetrics metrics = endpoint.getEndpointMetrics(); if (metrics != null) metrics.processFaultMessage(beginTime); } /** Set response mime headers */ private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction resMessage) { try { // Set the outbound headers if (headerSource != null && resMessage instanceof SOAPMessage) { XOPContext.eagerlyCreateAttachments(); ((SOAPMessage)resMessage).saveChanges(); headerSource.setMimeHeaders(resMessage.getMimeHeaders()); } // debug the outgoing message MessageTrace.traceMessage("Outgoing Response Message", resMessage); } catch (Exception ex) { WSException.rethrow("Faild to post process response message", ex); } } public void handleWSDLRequest(Endpoint endpoint, OutputStream outputStream, InvocationContext context) { log.debug("handleWSDLRequest: " + endpoint.getName()); ServerEndpointMetaData epMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); if (epMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data"); ServletRequestContext reqContext = (ServletRequestContext)context; HttpServletRequest req = reqContext.getHttpServletRequest(); try { // For the base document the resourcePath should be null String resPath = (String)req.getParameter("resource"); URL reqURL = new URL(req.getRequestURL().toString()); String wsdlHost = reqURL.getProtocol() + "://" + reqURL.getHost(); if (reqURL.getPort() != -1) wsdlHost += ":" + reqURL.getPort(); if (ServerConfig.UNDEFINED_HOSTNAME.equals(serverConfig.getWebServiceHost()) == false) wsdlHost = serverConfig.getWebServiceHost(); log.debug("WSDL request, using host: " + wsdlHost); WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData); Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath); OutputStreamWriter writer = new OutputStreamWriter(outputStream); new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement()); } catch (RuntimeException rte) { throw rte; } catch (IOException ex) { throw new WSException(ex); } } private void handleException(Exception ex) throws ServletException { log.error("Error processing web service request", ex); if (ex instanceof JAXRPCException) throw (JAXRPCException)ex; throw new ServletException(ex); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/WSDLFilePublisher.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/wsf/stack/jbws/WSDLFilePublishe0000644000175000017500000003141110703167524031414 0ustar godgod/* * 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.wsf.stack.jbws; // $Id: WSDLFilePublisher.java 4728 2007-10-10 15:27:16Z richard.opalka@jboss.com $ import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.Writer; import java.net.MalformedURLException; import java.net.URL; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.wsdl.Definition; import javax.wsdl.Import; import javax.wsdl.factory.WSDLFactory; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.utils.ResourceURL; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.tools.wsdl.WSDLWriter; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.IOUtils; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.management.ServerConfig; import org.jboss.wsf.spi.management.ServerConfigFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; /** A helper class that publishes the wsdl files and their imports to the server/data/wsdl directory. * * @author Thomas.Diesler@jboss.org * @since 02-June-2004 */ public class WSDLFilePublisher { // provide logging private static final Logger log = Logger.getLogger(WSDLFilePublisher.class); // The deployment info for the web service archive private ArchiveDeployment dep; // The expected wsdl location in the deployment private String expLocation; // The server config private ServerConfig serverConfig; public WSDLFilePublisher(ArchiveDeployment dep) { this.dep = dep; SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig(); if (dep.getType().toString().endsWith("JSE")) { expLocation = "WEB-INF/wsdl/"; } else { expLocation = "META-INF/wsdl/"; } } /** Publish the deployed wsdl file to the data directory */ public void publishWsdlFiles(UnifiedMetaData wsMetaData) throws IOException { String deploymentName = dep.getCanonicalName(); // For each service for (ServiceMetaData serviceMetaData : wsMetaData.getServices()) { File wsdlFile = getPublishLocation(deploymentName, serviceMetaData); wsdlFile.getParentFile().mkdirs(); // Get the wsdl definition and write it to the wsdl publish location try { Writer fWriter = IOUtils.getCharsetFileWriter(wsdlFile, Constants.DEFAULT_XML_CHARSET); WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions(); new WSDLWriter(wsdlDefinitions).write(fWriter, Constants.DEFAULT_XML_CHARSET); URL wsdlPublishURL = wsdlFile.toURL(); log.info("WSDL published to: " + wsdlPublishURL); // udpate the wsdl file location serviceMetaData.setWsdlLocation(wsdlFile.toURL()); // Process the wsdl imports Definition wsdl11Definition = wsdlDefinitions.getWsdlOneOneDefinition(); if (wsdl11Definition != null) { List published = new LinkedList(); publishWsdlImports(wsdlFile.toURL(), wsdl11Definition, published); // Publish XMLSchema imports Document document = wsdlDefinitions.getWsdlDocument(); publishSchemaImports(wsdlFile.toURL(), document.getDocumentElement(), published); } else { throw new NotImplementedException("WSDL-2.0 imports"); } } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new WSException("Cannot publish wsdl to: " + wsdlFile, e); } } } /** Publish the wsdl imports for a given wsdl definition */ private void publishWsdlImports(URL parentURL, Definition parentDefinition, List published) throws Exception { String baseURI = parentURL.toExternalForm(); Iterator it = parentDefinition.getImports().values().iterator(); while (it.hasNext()) { for (Import wsdlImport : (List)it.next()) { String locationURI = wsdlImport.getLocationURI(); Definition subdef = wsdlImport.getDefinition(); // its an external import, don't publish locally if (locationURI.startsWith("http://") == false) { // infinity loops prevention if (published.contains(locationURI)) { return; } else { published.add(locationURI); } URL targetURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + locationURI); File targetFile = new File(targetURL.getPath()); targetFile.getParentFile().mkdirs(); WSDLFactory wsdlFactory = WSDLFactory.newInstance(); javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); FileWriter fw = new FileWriter(targetFile); wsdlWriter.writeWSDL(subdef, fw); fw.close(); if (log.isDebugEnabled()) log.debug("WSDL import published to: " + targetURL); // recursively publish imports publishWsdlImports(targetURL, subdef, published); // Publish XMLSchema imports Element subdoc = DOMUtils.parse(targetURL.openStream()); publishSchemaImports(targetURL, subdoc, published); } } } } /** Publish the schema imports for a given wsdl definition */ private void publishSchemaImports(URL parentURL, Element element, List published) throws Exception { String baseURI = parentURL.toExternalForm(); Iterator it = DOMUtils.getChildElements(element); while (it.hasNext()) { Element childElement = (Element)it.next(); if ("import".equals(childElement.getLocalName()) || "include".equals(childElement.getLocalName())) { String schemaLocation = childElement.getAttribute("schemaLocation"); if (schemaLocation.length() > 0) { if (schemaLocation.startsWith("http://") == false) { // infinity loops prevention if (published.contains(schemaLocation)) { return; } else { published.add(schemaLocation); } URL xsdURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + schemaLocation); File targetFile = new File(xsdURL.getPath()); targetFile.getParentFile().mkdirs(); String deploymentName = dep.getCanonicalName(); // get the resource path int index = baseURI.indexOf(deploymentName); String resourcePath = baseURI.substring(index + deploymentName.length()); resourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/")); if (resourcePath.length() > 0) resourcePath = resourcePath + "/"; resourcePath = expLocation + resourcePath + schemaLocation; URL resourceURL = dep.getMetaDataFileURL(resourcePath); InputStream is = new ResourceURL(resourceURL).openStream(); if (is == null) throw new IllegalArgumentException("Cannot find schema import in deployment: " + resourcePath); FileOutputStream fos = new FileOutputStream(targetFile); IOUtils.copyStream(fos, is); fos.close(); is.close(); if (log.isDebugEnabled()) log.debug("XMLSchema import published to: " + xsdURL); // recursivly publish imports Element subdoc = DOMUtils.parse(xsdURL.openStream()); publishSchemaImports(xsdURL, subdoc, published); } } } else { publishSchemaImports(parentURL, childElement, published); } } } /** * Delete the published wsdl */ public void unpublishWsdlFiles() throws IOException { String deploymentDir = (dep.getParent() != null ? dep.getParent().getSimpleName() : dep.getSimpleName()); File serviceDir = new File(serverConfig.getServerDataDir().getCanonicalPath() + "/wsdl/" + deploymentDir); deleteWsdlPublishDirectory(serviceDir); } /** * Delete the published wsdl document, traversing down the dir structure */ private void deleteWsdlPublishDirectory(File dir) throws IOException { String[] files = dir.list(); for (int i = 0; files != null && i < files.length; i++) { String fileName = files[i]; File file = new File(dir + "/" + fileName); if (file.isDirectory()) { deleteWsdlPublishDirectory(file); } else { if (file.delete() == false) log.warn("Cannot delete published wsdl document: " + file.toURL()); } } // delete the directory as well dir.delete(); } /** * Get the file publish location */ private File getPublishLocation(String archiveName, ServiceMetaData serviceMetaData) throws IOException { String wsdlLocation = null; if (serviceMetaData.getWsdlLocation() != null) wsdlLocation = serviceMetaData.getWsdlLocation().toExternalForm(); else if (serviceMetaData.getWsdlFile() != null) wsdlLocation = serviceMetaData.getWsdlFile(); if (wsdlLocation == null) throw new IllegalStateException("Cannot obtain wsdl location for: " + serviceMetaData.getServiceName()); if (log.isDebugEnabled()) log.debug("Publish WSDL file: " + wsdlLocation); // Only file URLs are supported in String publishLocation = serviceMetaData.getWsdlPublishLocation(); boolean predefinedLocation = publishLocation != null && publishLocation.startsWith("file:"); File locationFile = null; if (predefinedLocation == false) { locationFile = new File(serverConfig.getServerDataDir().getCanonicalPath() + "/wsdl/" + archiveName); } else { try { locationFile = new File(new URL(publishLocation).getPath()); } catch (MalformedURLException e) { throw new IllegalArgumentException("Invalid publish location: " + e.getMessage()); } } File wsdlFile; if (wsdlLocation.indexOf(expLocation) >= 0) { wsdlLocation = wsdlLocation.substring(wsdlLocation.indexOf(expLocation) + expLocation.length()); wsdlFile = new File(locationFile + "/" + wsdlLocation); } else if (wsdlLocation.startsWith("vfsfile:") || wsdlLocation.startsWith("file:") || wsdlLocation.startsWith("jar:")) { wsdlLocation = wsdlLocation.substring(wsdlLocation.lastIndexOf("/") + 1); wsdlFile = new File(locationFile + "/" + wsdlLocation); } else { throw new WSException("Invalid wsdlFile '" + wsdlLocation + "', expected in: " + expLocation); } return wsdlFile; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/0000755000175000017500000000000010755000270024173 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/0000755000175000017500000000000010755000256026376 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/0000755000175000017500000000000010755000252030211 5ustar godgod././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/deployment/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/deployme0000755000175000017500000000000010755000251031747 5ustar godgod././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/deployment/EventingEndpointDeployment.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/deployme0000644000175000017500000000265410620400241031752 0ustar godgodpackage org.jboss.ws.extensions.eventing.deployment; import javax.xml.namespace.QName; /** * Eventsource endpoint deployment info. * * @author Heiko Braun, * @since 18-Jan-2006 */ public class EventingEndpointDeployment { /* event source URI */ private String name; private QName portName; // event source endpoint address private String endpointAddress; /* notification schema */ private String[] schema; private String notificationRootElementNS; public EventingEndpointDeployment(String name, String[] schema, String notificationRootElementNS) { this.name = name; this.schema = schema; this.notificationRootElementNS = notificationRootElementNS; } public QName getPortName() { return portName; } public void setPortName(QName portName) { this.portName = portName; } public String getName() { return name; } public String[] getSchema() { return schema; } public String getEndpointAddress() { return endpointAddress; } public void setEndpointAddress(String endpointAddress) { this.endpointAddress = endpointAddress; } public String getNotificationRootElementNS() { return notificationRootElementNS; } public void setNotificationRootElementNS(String notificationRootElementNS) { this.notificationRootElementNS = notificationRootElementNS; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/0000755000175000017500000000000010755000252031155 5ustar godgod././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/DispatchJob.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Dis0000644000175000017500000000405410542776150031635 0ustar godgod/* * 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.eventing.mgmt; // $Id: DispatchJob.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.net.URI; import java.util.List; import java.util.concurrent.ConcurrentMap; import org.w3c.dom.Element; /** * Event dispatch job implementation. */ public final class DispatchJob implements Runnable { public Element event; public URI eventSourceNS; public ConcurrentMap> mapping; public DispatchJob(URI eventSourceNS, Element event, ConcurrentMap> mapping) { this.event = event; this.eventSourceNS = eventSourceNS; this.mapping = mapping; } public void run() { List subscriptions = mapping.get(eventSourceNS); for (Subscription s : subscriptions) // iterator is a snapshot { if (s.accepts(event) && !s.isExpired()) s.notify(event); } } public String toString() { return "DispatchJob {" + "source=" + eventSourceNS + ", event=" + event + "}"; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Filter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Fil0000644000175000017500000000331710553667012031627 0ustar godgod/* * 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.eventing.mgmt; // $Id: Filter.java 1994 2007-01-18 12:54:34Z heiko.braun@jboss.com $ import java.net.URI; /** * A local filter representation. * * * @author Heiko Braun, * @since 08-Dec-2005 */ public final class Filter { private URI dialect; private String expression; public Filter(URI dialect, String expression) { this.dialect = dialect; this.expression = expression; } public URI getDialect() { return dialect; } public String getExpression() { return expression; } public String toString() { return "Filter{dialect='" + dialect + "', expr='" + expression + "'}"; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManager.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Sub0000644000175000017500000005367410650145103031647 0ustar godgod/* * 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.eventing.mgmt; // $Id: SubscriptionManager.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.net.InetAddress; import java.net.URI; import java.net.URISyntaxException; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.xml.bind.JAXBElement; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.xml.utils.DefaultErrorHandler; import org.jboss.logging.Logger; import org.jboss.util.naming.Util; import org.jboss.ws.WSException; import org.jboss.ws.core.utils.UUIDGenerator; import org.jboss.ws.extensions.eventing.EventingConstants; import org.jboss.ws.extensions.eventing.deployment.EventingEndpointDeployment; import org.jboss.ws.extensions.eventing.jaxws.AttributedURIType; import org.jboss.ws.extensions.eventing.jaxws.EndpointReferenceType; import org.jboss.ws.extensions.eventing.jaxws.ReferenceParametersType; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; /** * The SubscriptionManagerEndpoint maintains event sources and subscriptions.
      * It is interfaced through the EventSourceEndpoint and SubscriptionManagerEndpoint SOAP endpoints. *

      * Applications can use the EventDispatcher interface to dispatch * event messages to subscribers. The current implementation is backed by a ThreadPoolExecutor, * that asynchronously delivers messages to event sink endpoints. * It can be configurd through the following attributes: *

        *
      • corePoolSize - average number of idle threads *
      • maximumPoolSize - maximum number of threads *
      • eventKeepAlive - keep alive before an undelivered event message is discarded. *
      * Event filtering is supported on subscription level based on XPath expressions. * For further information see http://www.w3.org/TR/xpath#predicates. *

      * Currently only event push is supported. * * @see org.jboss.ws.extensions.eventing.jaxws.EventSourceEndpoint * @see org.jboss.ws.extensions.eventing.jaxws.SubscriptionManagerEndpoint * @see org.jboss.ws.extensions.eventing.jaxws.FilterType * * @author Heiko Braun, * @since 02-Dec-2005 */ public class SubscriptionManager implements SubscriptionManagerMBean, EventDispatcher { private static final Logger log = Logger.getLogger(SubscriptionManager.class); // Maps event source namespaces to event source instances. private ConcurrentMap eventSourceMapping = new ConcurrentHashMap(); // Maps subscriptions to event sources private ConcurrentMap> subscriptionMapping = new ConcurrentHashMap>(); // Buffers notifications. FIFO ordering. private BlockingQueue eventQueue = new LinkedBlockingQueue(); // Event dispatcher thread pool. private ThreadPoolExecutor threadPool; // True force validation of every notification message against its schema private boolean validateNotifications = false; // subscription watchdog that maintains expirations private WatchDog watchDog; // True if dispatcher is bound to JNDI private boolean isDispatcherBound = false; // List containing all errors occured during notification since service startup // TODO: save this list and made possible to resend failed notification using jms instead of list private List notificationFailures = new ArrayList(); // The host that the dispatcher is bound to private String bindAddress; private static EventingBuilder builder = EventingBuilder.createEventingBuilder(); public String getBindAddress() { if (bindAddress == null) { try { InetAddress localHost = InetAddress.getLocalHost(); log.debug("BindAddress not set, using host: " + localHost.getHostName()); bindAddress = localHost.getHostName(); } catch (UnknownHostException e) { log.debug("BindAddress not set, using: 'localhost'"); bindAddress = "localhost"; } } return bindAddress; } public void setBindAddress(String bindAddress) { this.bindAddress = bindAddress; } public void create() throws Exception { MBeanServer server = getJMXServer(); if (server != null) { log.debug("Create subscription manager"); server.registerMBean(this, OBJECT_NAME); } } public void destroy() throws Exception { MBeanServer server = getJMXServer(); if (server != null) { log.debug("Destroy subscription manager"); server.unregisterMBean(OBJECT_NAME); } } public void start() throws Exception { log.debug("Start subscription manager"); // setup thread pool threadPool = new ThreadPoolExecutor(5, 15, // core/max num threads 5000, TimeUnit.MILLISECONDS, // 5 seconds keepalive eventQueue); // start the subscription watchdog watchDog = new WatchDog(subscriptionMapping); watchDog.startup(); } public void stop() { log.debug("Stop subscription manager"); try { // remove event dispatcher Util.unbind(new InitialContext(), EventingConstants.DISPATCHER_JNDI_NAME); // stop thread pool threadPool.shutdown(); // stop the watchdog watchDog.shutdown(); for (URI eventSourceNS : eventSourceMapping.keySet()) { removeEventSource(eventSourceNS); } } catch (NamingException e) { // ignore } } private static URI generateSubscriptionID() { try { return new URI("urn:jbwse:" + UUIDGenerator.generateRandomUUIDString()); } catch (URISyntaxException e) { throw new WSException(e.getMessage()); } } /** * A two phase deployment process. */ public void registerEventSource(EventingEndpointDeployment deploymentInfo) { // workaround for JBWS-1006 lazyBindEventDispatcher(); EventSource eventSource = builder.newEventSource(deploymentInfo); if (eventSourceMapping.containsKey(eventSource.getNameSpace()) == false) { eventSourceMapping.put(eventSource.getNameSpace(), eventSource); updateManagerAddress(deploymentInfo, eventSource); eventSource.setState(EventSource.State.CREATED); log.debug("Created: " + eventSource); } else { eventSource = eventSourceMapping.get(eventSource.getNameSpace()); updateManagerAddress(deploymentInfo, eventSource); subscriptionMapping.put(eventSource.getNameSpace(), new CopyOnWriteArrayList()); eventSource.setState(EventSource.State.STARTED); log.debug("Started: " + eventSource); } } private void lazyBindEventDispatcher() { if (!isDispatcherBound) { try { // bind dispatcher to JNDI Util.rebind(new InitialContext(), EventingConstants.DISPATCHER_JNDI_NAME, new DispatcherDelegate(getBindAddress())); log.info("Bound event dispatcher to java:/" + EventingConstants.DISPATCHER_JNDI_NAME); isDispatcherBound = true; } catch (NamingException e) { throw new WSException("Unable to bind EventDispatcher ", e); } } } /** * When both the EventSourcePort and the SubscriptionManagerPort are registered * we finally know the real SubscriptionManager EPR and update the endpoint adress. * @param deploymentInfo * @param eventSource */ private static void updateManagerAddress(EventingEndpointDeployment deploymentInfo, EventSource eventSource) { String addr = null; if (deploymentInfo.getPortName().getLocalPart().equals("SubscriptionManagerPort")) addr = deploymentInfo.getEndpointAddress(); if (addr != null) eventSource.setManagerAddress(addr); } public void removeEventSource(URI eventSourceNS) { if (eventSourceMapping.containsKey(eventSourceNS)) { List subscriptions = subscriptionMapping.get(eventSourceNS); for (Subscription s : subscriptions) // iterator is a snapshot { s.end(EventingConstants.SOURCE_SHUTTING_DOWN); } subscriptions.clear(); eventSourceMapping.remove(eventSourceNS); log.debug("Event source " + eventSourceNS + " removed"); } } /** * Subscribe to an event source. */ public SubscriptionTicket subscribe(URI eventSourceNS, EndpointReferenceType notifyTo, EndpointReferenceType endTo, Date expires, Filter filter) throws SubscriptionError { log.debug("Subscription request for " + eventSourceNS); EventSource eventSource = eventSourceMapping.get(eventSourceNS); if (null == eventSource) throw new SubscriptionError(EventingConstants.CODE_UNABLE_TO_PROCESS, "EventSource '" + eventSourceNS + "' not registered"); // expiry constraints if (expires != null) { assertLeaseConstraints(expires); } else { expires = new Date((System.currentTimeMillis() + EventingConstants.DEFAULT_LEASE)); } // filter constraints if (filter != null) { if (eventSource.getSupportedFilterDialects().isEmpty()) throw new SubscriptionError(EventingConstants.CODE_FILTER_NOT_SUPPORTED, "Filtering is not supported."); else { boolean filterAvailable = false; for (URI supportedDialect : eventSource.getSupportedFilterDialects()) { if (filter.getDialect().equals(supportedDialect)) { filterAvailable = true; break; } } if (!filterAvailable) throw new SubscriptionError(EventingConstants.CODE_REQUESTED_FILTER_UNAVAILABLE, "The requested filter dialect is not supported."); } } // create subscription EndpointReferenceType epr = new EndpointReferenceType(); AttributedURIType attrURI = new AttributedURIType(); attrURI.setValue(eventSource.getManagerAddress().toString()); epr.setAddress(attrURI); ReferenceParametersType refParam = new ReferenceParametersType(); JAXBElement idqn = new JAXBElement(new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier"), String.class, generateSubscriptionID().toString()); refParam.getAny().add(idqn); epr.setReferenceParameters(refParam); Subscription subscription = new Subscription(eventSource.getNameSpace(), epr, notifyTo, endTo, expires, filter); subscriptionMapping.get(eventSourceNS).add(subscription); log.debug("Registered subscription " + subscription.getIdentifier()); return new SubscriptionTicket(epr, subscription.getExpires()); } private void assertLeaseConstraints(Date expireDate) throws SubscriptionError { long expires = expireDate.getTime() - System.currentTimeMillis(); if (expires < 0 || EventingConstants.MAX_LEASE_TIME < expires) throw new SubscriptionError(EventingConstants.CODE_INVALID_EXPIRATION_TIME, "The expiration time requested is invalid: " + expires + "ms"); } /** * Renew a subscription. * * @param identifier * @param lease * @return the new lease date * @throws SubscriptionError */ public Date renew(URI identifier, Date lease) throws SubscriptionError { Subscription subscription = subscriberForID(identifier); if (null == subscription) throw new SubscriptionError(EventingConstants.CODE_UNABLE_TO_RENEW, "Subscription " + identifier + " does not exist"); if (lease != null) assertLeaseConstraints(lease); else lease = new Date((System.currentTimeMillis() + EventingConstants.DEFAULT_LEASE)); subscription.setExpires(lease); return lease; } /** * Get status for subscription. * * @param identifier * @return the actual lease date. * @throws SubscriptionError when the subscriber does not exist */ public final Date getStatus(URI identifier) throws SubscriptionError { Subscription subscription = subscriberForID(identifier); if (null == subscription) throw new SubscriptionError(EventingConstants.CODE_UNABLE_TO_PROCESS, "Subscription " + identifier + " does not exist"); return subscription.getExpires(); } /** * Release a subscription. * * @param identifier * @throws SubscriptionError when the subscriber does not exist */ public void unsubscribe(URI identifier) throws SubscriptionError { for (List subscriptions : subscriptionMapping.values()) { for (Subscription s : subscriptions) { if (identifier.equals(s.getIdentifier())) { subscriptions.remove(s); log.debug("Removed subscription " + s); break; } } } } public String showEventsourceTable() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println("

      Deployed Eventsources

      "); pw.println(""); pw.println(""); for (EventSource source : eventSourceMapping.values()) { pw.println(""); } pw.println("
      NameNS
      " + source.getName() + "" + source.getNameSpace() + "
      "); pw.close(); return sw.toString(); } public String showSubscriptionTable() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println("

      Registered Subscriptions

      "); pw.println(""); pw.println(""); for (List subscriptions : subscriptionMapping.values()) { for (Subscription s : subscriptions) { pw.println(""); } } pw.println("
      IdentifierExpiresFilter
      " + s.getIdentifier() + "" + s.getExpires() + "" + s.getFilter().getExpression() + "
      "); pw.close(); return sw.toString(); } private Subscription subscriberForID(URI id) { Subscription subscription = null; for (List subscriptions : subscriptionMapping.values()) { for (Subscription s : subscriptions) { if (id.equals(s.getIdentifier())) { subscription = s; break; } } } return subscription; } public void dispatch(URI eventSourceNS, Element payload) { DispatchJob dispatchJob = new DispatchJob(eventSourceNS, payload, subscriptionMapping); if (validateNotifications && !this.validateMessage(DOMWriter.printNode(payload, false), eventSourceNS)) { throw new DispatchException("Notification message validation failed!"); } threadPool.execute(dispatchJob); } public void addNotificationFailure(NotificationFailure failure) { notificationFailures.add(failure); } public List showNotificationFailures() { return notificationFailures; } private boolean validateMessage(String msg, URI eventSourceNS) { try { EventSource es = eventSourceMapping.get(eventSourceNS); log.info(new StringBuffer("Validating message: \n\n").append(msg).append("\n\nagainst the following schema(s): \n").toString()); for (int i = 0; i < es.getNotificationSchema().length; i++) { log.info(es.getNotificationSchema()[i]); } Element rootElement = DOMUtils.parse(msg); if (!es.getNotificationRootElementNS().equalsIgnoreCase(rootElement.getNamespaceURI())) { log.error("Root element expected namespace: " + es.getNotificationRootElementNS()); return false; } DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(true); factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); String[] notificationSchemas = es.getNotificationSchema(); InputSource[] is = new InputSource[notificationSchemas.length]; for (int i = 0; i < notificationSchemas.length; i++) { is[i] = new InputSource(new StringReader(notificationSchemas[notificationSchemas.length - 1 - i])); //is[i] = new InputSource(new StringReader(notificationSchemas[i])); } factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", is); DocumentBuilder docBuilder = factory.newDocumentBuilder(); DefaultErrorHandler errorHandler = new Validator(); docBuilder.setErrorHandler(errorHandler); docBuilder.parse(new InputSource(new StringReader(msg))); log.info("Document validated!"); return true; } catch (Exception e) { log.error(e); log.info("Cannot validate and/or parse the document!"); return false; } } // ---------------------------------------------------------------------- // MBean support public int getCorePoolSize() { return threadPool.getCorePoolSize(); } public int getMaximumPoolSize() { return threadPool.getMaximumPoolSize(); } public int getLargestPoolSize() { return threadPool.getLargestPoolSize(); } public int getActiveCount() { return threadPool.getActiveCount(); } public long getCompletedTaskCount() { return threadPool.getCompletedTaskCount(); } public void setCorePoolSize(int corePoolSize) { threadPool.setCorePoolSize(corePoolSize); } public void setMaxPoolSize(int maxPoolSize) { threadPool.setMaximumPoolSize(maxPoolSize); } public void setEventKeepAlive(long millies) { threadPool.setKeepAliveTime(millies, TimeUnit.MILLISECONDS); } public boolean isValidateNotifications() { return this.validateNotifications; } public void setValidateNotifications(boolean validateNotifications) { this.validateNotifications = validateNotifications; } private MBeanServer getJMXServer() { MBeanServer server = null; ArrayList servers = MBeanServerFactory.findMBeanServer(null); if (servers.size() > 0) { server = (MBeanServer)servers.get(0); } return server; } /** * The watchdog maintains subscription expirations. */ private class WatchDog implements Runnable { private ConcurrentMap> subscriptions; private boolean active = true; private Thread worker; public WatchDog(ConcurrentMap> subscriptions) { this.subscriptions = subscriptions; } public void run() { while (active) { for (List subscriptions : subscriptionMapping.values()) { for (Subscription s : subscriptions) { if (s.isExpired()) { s.end(EventingConstants.SOURCE_CANCELING); subscriptions.remove(s); } } } try { Thread.sleep(1000 * 60); } catch (InterruptedException e) { log.error(e); } } } public void startup() { worker = new Thread(this, "SubscriptionWatchDog"); worker.start(); } public void shutdown() { this.active = false; } } private class Validator extends DefaultErrorHandler { public void error(SAXParseException exception) throws SAXException { throw new SAXException(exception); } public void fatalError(SAXParseException exception) throws SAXException { throw new SAXException(exception); } public void warning(SAXParseException exception) throws SAXException { } } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/DispatcherDelegate.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Dis0000644000175000017500000000475210627622222031634 0ustar godgodpackage org.jboss.ws.extensions.eventing.mgmt; import java.net.URI; import javax.management.MBeanServerConnection; import javax.management.MBeanServerInvocationHandler; import javax.management.ObjectName; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.naming.Reference; import javax.naming.Referenceable; import javax.naming.StringRefAddr; import org.jboss.ws.WSException; import org.w3c.dom.Element; /** * Event dispatching delegate that will be bound to JNDI. * * @see DispatcherFactory * * @author Heiko Braun, * @since 11-Jan-2006 */ public class DispatcherDelegate implements EventDispatcher, Referenceable { private String hostname; public final static String MANAGER_HOSTNAME = "manager.hostname"; private SubscriptionManagerMBean subscriptionManager = null; public DispatcherDelegate() { } public DispatcherDelegate(String hostname) { setHostname(hostname); } public void dispatch(URI eventSourceNS, Element payload) { getSubscriptionManager().dispatch(eventSourceNS, payload); } public Reference getReference() throws NamingException { Reference myRef = new Reference(DispatcherDelegate.class.getName(), DispatcherFactory.class.getName(), null); // let the delegate now where to find the subscription manager myRef.add(new StringRefAddr(MANAGER_HOSTNAME, hostname)); return myRef; } private SubscriptionManagerMBean getSubscriptionManager() { if (null == subscriptionManager) { try { ObjectName objectName = SubscriptionManager.OBJECT_NAME; subscriptionManager = (SubscriptionManagerMBean)MBeanServerInvocationHandler.newProxyInstance(getServer(), objectName, SubscriptionManagerMBean.class, false); } catch (Exception e) { throw new WSException("Failed to access subscription manager: " + e.getMessage()); } } return subscriptionManager; } private MBeanServerConnection getServer() throws NamingException { // todo: bypass rmi adapter when used locally InitialContext iniCtx = new InitialContext(); MBeanServerConnection server = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor"); return server; } void setHostname(String hostname) { if (null == hostname) throw new IllegalArgumentException("Hostname may not be null"); this.hostname = hostname; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/EventSource.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Eve0000644000175000017500000000724210642000211031612 0ustar godgod/* * 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.eventing.mgmt; // $Id: EventSource.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; /** * @author Heiko Braun, * @since 02-Dec-2005 */ class EventSource implements java.io.Serializable { enum State { CREATED, STARTED, STOPPED, DESTROYED } private State state; private long maxExpirationTime = -1; private String name; private URI nameSpace; private URI managerAddress; private List supportedFilter = new ArrayList(); private String[] notificationSchema; private String notificationRootElementNS; public EventSource(String name, URI nameSpace) { this.name = name; this.nameSpace = nameSpace; this.state = State.CREATED; } public EventSource(String name, URI nameSpace, String[] schema, String notificationRootElementNS) { this.name = name; this.nameSpace = nameSpace; this.notificationSchema = schema; this.notificationRootElementNS = notificationRootElementNS; this.state = State.CREATED; } State getState() { return state; } void setState(State state) { if(state == EventSource.State.STARTED) { assertConfiguration(); } this.state = state; } private void assertConfiguration() { if(this.getManagerAddress() == null) throw new IllegalArgumentException("SubscriptionManager address unknown. Unable to start event source."); } long getMaxExpirationTime() { return maxExpirationTime; } void setMaxExpirationTime(long maxExpirationTime) { this.maxExpirationTime = maxExpirationTime; } public List getSupportedFilterDialects() { return supportedFilter; } public String[] getNotificationSchema() { return notificationSchema; } public String getName() { return name; } public URI getNameSpace() { return nameSpace; } public URI getManagerAddress() { return managerAddress; } public String getNotificationRootElementNS() { return notificationRootElementNS; } public void setManagerAddress(String managerAddress) { try { if(managerAddress!=null) this.managerAddress = new URI(managerAddress); } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal subscription manager endpoint address: " + e.getMessage()); } } public String toString() { return "EventSource {" + "nameSpace=" + nameSpace + ", state=" + state + "}"; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Subscription.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Sub0000644000175000017500000001737210666752201031654 0ustar godgod/* * 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.eventing.mgmt; // $Id: Subscription.java 4510 2007-09-03 09:31:45Z heiko.braun@jboss.com $ import java.io.ByteArrayInputStream; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.Date; import javax.xml.bind.JAXBElement; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPMessage; import javax.xml.transform.TransformerException; import org.apache.xpath.XPathAPI; import org.apache.xpath.objects.XObject; import org.jboss.logging.Logger; import org.jboss.ws.core.soap.SOAPConnectionImpl; import org.jboss.ws.extensions.eventing.EventingConstants; import org.jboss.ws.extensions.eventing.jaxws.AttributedURIType; import org.jboss.ws.extensions.eventing.jaxws.EndpointReferenceType; import org.jboss.ws.Constants; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * Represents a subscription. * * @author Heiko Braun, * @since 05-Jan-2006 */ class Subscription { final private static Logger log = Logger.getLogger(Subscription.class); final private EndpointReferenceType notifyTo; final private EndpointReferenceType endTo; private Date expires; final private Filter filter; final private EndpointReferenceType endpointReference; final private URI eventSourceNS; private SubscriptionManagerFactory factory = SubscriptionManagerFactory.getInstance(); public Subscription(URI eventSourceNS, EndpointReferenceType epr, EndpointReferenceType notifyTo, EndpointReferenceType endTo, Date expires, Filter filter) { this.eventSourceNS = eventSourceNS; this.notifyTo = notifyTo; this.endTo = endTo; // is optional, can be null this.expires = expires; this.filter = filter; this.endpointReference = epr; } public void notify(Element event) { if(log.isDebugEnabled()) log.debug(getIdentifier() + " dispatching " + event); try { String eventXML = DOMWriter.printNode(event, false); MessageFactory msgFactory = MessageFactory.newInstance(); // notification elements need to declare their namespace locally StringBuilder sb = new StringBuilder(); sb.append(""); sb.append(""); sb.append("").append(getNotificationAction()).append(""); // todo: add reference parameters when wildcards are supported sb.append("").append(notifyTo.getAddress().toString()).append(""); sb.append(""); sb.append(""); sb.append(eventXML); sb.append(""); sb.append(""); SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(sb.toString().getBytes())); URL epURL = new URL(notifyTo.getAddress().getValue()); new SOAPConnectionImpl().callOneWay(reqMsg, epURL); } catch (Exception e) { SubscriptionManagerMBean manager = factory.getSubscriptionManager(); AttributedURIType address = this.endTo.getAddress(); NotificationFailure failure = new NotificationFailure(address.getValue(), event, e); manager.addNotificationFailure(failure); log.error("Failed to send notification message", e); } } public boolean accepts(Element event) { boolean b = true; if (filter != null) { try { XObject o = XPathAPI.eval(event, filter.getExpression()); b = o.bool(); } catch (TransformerException e) { log.error("Failed to evalute xpath expression", e); } } return b; } public void end(String status) { if (null == endTo) // it's an optional field. return; if(log.isDebugEnabled()) log.debug("Ending subscription " + getIdentifier()); StringBuffer sb = new StringBuffer(); sb.append(""); sb.append(""); sb.append("").append(EventingConstants.SUBSCRIPTION_END_ACTION).append(""); sb.append("").append(endTo.getAddress().toString()).append(""); sb.append(""); sb.append(""); sb.append(""); sb.append(""); sb.append(""); sb.append(endpointReference.getAddress().toString()); sb.append(""); sb.append(""); sb.append(""); sb.append(getIdentifier().toString()); sb.append(""); sb.append(""); sb.append(""); sb.append("").append(status).append(""); sb.append(""); sb.append(""); sb.append(""); sb.append(""); try { MessageFactory msgFactory = MessageFactory.newInstance(); SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(sb.toString().getBytes())); URL epURL = new URL(endTo.getAddress().getValue()); new SOAPConnectionImpl().callOneWay(reqMsg, epURL); } catch (Exception e) { log.warn("Failed to send subscription end message to: " + this.endTo + "("+e.getMessage()+")"); } } private String getNotificationAction() { return this.eventSourceNS.toString() + "/Notification"; } public boolean isExpired() { return System.currentTimeMillis() > expires.getTime(); } public EndpointReferenceType getNotifyTo() { return notifyTo; } public EndpointReferenceType getEndTo() { return endTo; } public Date getExpires() { return expires; } public Filter getFilter() { return filter; } public EndpointReferenceType getEndpointReferenceType() { return endpointReference; } public URI getIdentifier() { try { JAXBElement jaxbElement = (JAXBElement)endpointReference.getReferenceParameters().getAny().get(0); return new URI(jaxbElement.getValue()); } catch (URISyntaxException e) { throw new RuntimeException(e); } } public void setExpires(Date expires) { this.expires = expires; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManagerMBean.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Sub0000644000175000017500000000666710650145103031647 0ustar godgod/* * 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.eventing.mgmt; // $Id: SubscriptionManagerMBean.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.net.URI; import java.util.Date; import java.util.List; import javax.management.ObjectName; import org.jboss.ws.extensions.eventing.deployment.EventingEndpointDeployment; import org.jboss.ws.extensions.eventing.jaxws.EndpointReferenceType; import org.jboss.wsf.common.ObjectNameFactory; import org.w3c.dom.Element; /** * @author Heiko Braun, * @since 12-Dec-2005 */ public interface SubscriptionManagerMBean { static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=SubscriptionManager,module=eventing"); static final String BEAN_NAME = "WSSubscriptionManager"; String getBindAddress(); void setBindAddress(String bindAddress); /** * Returns the core number of threads. */ int getCorePoolSize(); /** * Returns the maximum allowed number of threads. */ int getMaximumPoolSize(); /** * Returns the largest number of threads that have ever simultaneously been in the pool. */ int getLargestPoolSize(); /** * Returns the approximate number of threads that are actively executing tasks. */ int getActiveCount(); /** * Returns the approximate total number of tasks that have completed execution. */ long getCompletedTaskCount(); public void setCorePoolSize(int corePoolSize); public void setMaxPoolSize(int maxPoolSize); public void setEventKeepAlive(long millies); // subscription EndpointReferenceType business SubscriptionTicket subscribe(URI eventSourceNS, EndpointReferenceType notifyTo, EndpointReferenceType endTo, Date expires, Filter filter) throws SubscriptionError; Date renew(URI identifier, Date lease) throws SubscriptionError; Date getStatus(URI identifier) throws SubscriptionError; void unsubscribe(URI identifier) throws SubscriptionError; // notification API void dispatch(URI eventSourceNS, Element payload); void registerEventSource(EventingEndpointDeployment deploymentInfo); void removeEventSource(URI eventSourceNS); String showSubscriptionTable(); String showEventsourceTable(); public void addNotificationFailure(NotificationFailure failure); public List showNotificationFailures(); public boolean isValidateNotifications(); public void setValidateNotifications(boolean validateNotifications); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/SubscriptionTicket.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Sub0000644000175000017500000000426110560063272031641 0ustar godgod/* * 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.eventing.mgmt; // $Id: SubscriptionTicket.java 2210 2007-01-31 09:51:54Z thomas.diesler@jboss.com $ import java.net.URI; import java.util.Date; import javax.xml.bind.JAXBElement; import org.jboss.ws.extensions.eventing.jaxws.EndpointReferenceType; /** * @author Heiko Braun, * @since 02-Dec-2005 */ public final class SubscriptionTicket { private URI identifier; private EndpointReferenceType subscriptionManager; private Date expires; public SubscriptionTicket(EndpointReferenceType subscriptionManager, Date expires) { try { JAXBElement jaxbElement = (JAXBElement)subscriptionManager.getReferenceParameters().getAny().get(0); this.identifier = new URI(jaxbElement.getValue()); } catch (Exception e) { throw new RuntimeException(e); } this.subscriptionManager = subscriptionManager; this.expires = expires; } public URI getIdentifier() { return identifier; } public EndpointReferenceType getSubscriptionManager() { return subscriptionManager; } public Date getExpires() { return expires; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/EventingBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Eve0000644000175000017500000000223310627622222031624 0ustar godgodpackage org.jboss.ws.extensions.eventing.mgmt; import java.net.URI; import java.net.URISyntaxException; import org.jboss.ws.WSException; import org.jboss.ws.extensions.eventing.EventingConstants; import org.jboss.ws.extensions.eventing.deployment.EventingEndpointDeployment; /** * @author Heiko Braun, * @since 24-Jan-2006 */ public class EventingBuilder { private EventingBuilder() { } public static EventingBuilder createEventingBuilder() { return new EventingBuilder(); } public EventSource newEventSource(EventingEndpointDeployment desc) { URI eventSourceNS = newEventSourceURI(desc.getName()); EventSource eventSource = new EventSource(desc.getName(), eventSourceNS, desc.getSchema(), desc.getNotificationRootElementNS()); eventSource.getSupportedFilterDialects().add(EventingConstants.getDefaultFilterDialect()); return eventSource; } public URI newEventSourceURI(String name) { try { return new URI(name); } catch (URISyntaxException e) { throw new WSException("Failed to create eventsource URI: " + e.getMessage()); } } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/EventDispatcher.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Eve0000644000175000017500000000254310542776150031636 0ustar godgod/* * 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.eventing.mgmt; // $Id: EventDispatcher.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.net.URI; import org.w3c.dom.Element; /** * @author Heiko Braun, * @since 07-Dec-2005 */ public interface EventDispatcher { void dispatch(URI eventSourceNS, Element payload); } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManagerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Sub0000644000175000017500000000153710654321205031641 0ustar godgodpackage org.jboss.ws.extensions.eventing.mgmt; import org.jboss.kernel.spi.registry.KernelRegistry; import org.jboss.kernel.spi.registry.KernelRegistryEntry; import org.jboss.wsf.spi.util.KernelLocator; /** * @author Heiko Braun, * @since 22-Mar-2006 */ public class SubscriptionManagerFactory { private static SubscriptionManagerFactory instance = new SubscriptionManagerFactory(); // Hide ctor protected SubscriptionManagerFactory() { } public static SubscriptionManagerFactory getInstance() { return instance; } public SubscriptionManagerMBean getSubscriptionManager() { KernelRegistry registry = KernelLocator.getKernel().getRegistry(); KernelRegistryEntry entry = registry.getEntry(SubscriptionManagerMBean.BEAN_NAME); return (SubscriptionManagerMBean)entry.getTarget(); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/DispatchException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Dis0000644000175000017500000000237610553667012031640 0ustar godgod/* * 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.eventing.mgmt; import org.jboss.ws.WSException; public class DispatchException extends WSException { public DispatchException() { super(); } public DispatchException(String message) { super(message); } }././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/NotificationFailure.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Not0000644000175000017500000000504110650145103031637 0ustar godgod/* * 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.eventing.mgmt; import java.net.URI; import java.net.URISyntaxException; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * Represent an error during notification. * * @author Stefano Maestri , Alessio Soldano * @since 26/11/2006 */ public class NotificationFailure { private URI endTo; private Element event; private Exception exception; public NotificationFailure(String endTo, Element event, Exception exception) { super(); try { this.endTo = new URI(endTo); } catch (URISyntaxException e) { throw new WSException(e); } this.event = event; this.exception = exception; } public URI getEndTo() { return endTo; } public void setEndTo(URI endTo) { this.endTo = endTo; } public Element getEvent() { return event; } public void setEvent(Element event) { this.event = event; } public Exception getException() { return exception; } public void setException(Exception exception) { this.exception = exception; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append("endTo: "); sb.append(endTo); sb.append("\n\nevent: "); sb.append(DOMWriter.printNode(event, false)); sb.append("\n\nexception: "); sb.append(exception); sb.append("\n*******************\n"); return sb.toString(); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/DispatcherFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Dis0000644000175000017500000000357710627622222031640 0ustar godgod/* * 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.eventing.mgmt; import java.util.Hashtable; import javax.naming.Context; import javax.naming.Name; import javax.naming.Reference; import javax.naming.spi.ObjectFactory; /** * Creates event dispatcher delegates. * * @see DispatcherDelegate * * @author Heiko Braun, * @since 11-Jan-2006 */ public class DispatcherFactory implements ObjectFactory { public Object getObjectInstance(Object object, Name name, Context context, Hashtable hashtable) throws Exception { Reference ref = (Reference)object; String hostname = (String)ref.get(DispatcherDelegate.MANAGER_HOSTNAME).getContent(); Class cls = Thread.currentThread().getContextClassLoader().loadClass(ref.getClassName()); DispatcherDelegate delegate = (DispatcherDelegate)cls.newInstance(); delegate.setHostname(hostname); return delegate; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/SubscriptionError.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/mgmt/Sub0000644000175000017500000000106410542776150031645 0ustar godgodpackage org.jboss.ws.extensions.eventing.mgmt; /** * @author Heiko Braun, * @since 24-Jan-2006 */ public final class SubscriptionError extends Exception { private String subcode; private String reason; public SubscriptionError(String subscode, String reason) { super(); this.subcode = subscode; this.reason = reason; } public String getMessage() { return getReason(); } public String getSubcode() { return subcode; } public String getReason() { return reason; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/EventingUtils.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/Eventing0000644000175000017500000000464110560063272031725 0ustar godgod/* * 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.eventing; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.jboss.ws.Constants; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSNamespaceItem; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSStringList; /** * @author Heiko.Braun@jboss.org * @version $Id$ * @since 15.01.2007 */ public class EventingUtils { public static String[] extractNotificationSchema(JBossXSModel schemaModel) { List list = ((JBossXSStringList)schemaModel.getNamespaces()).toList(); List schemas = new LinkedList(); for (Iterator it = list.iterator(); it.hasNext(); ) { String ns = (String)it.next(); if (!Constants.URI_SOAP11_ENC.equalsIgnoreCase(ns) && !Constants.NS_SCHEMA_XSI.equalsIgnoreCase(ns) && !Constants.NS_SCHEMA_XSD.equalsIgnoreCase(ns) && !Constants.URI_WS_EVENTING.equalsIgnoreCase(ns) && !Constants.URI_WS_ADDRESSING.equalsIgnoreCase(ns)) { JBossXSNamespaceItem item = schemaModel.getNamespaceItem(ns); boolean qElem = item.isQualifiedElements(); item.setQualifiedElements(true); schemas.add(item.toString()); item.setQualifiedElements(qElem); } } return schemas.toArray(new String[schemas.size()]); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/metadata/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/metadata0000755000175000017500000000000010755000251031711 5ustar godgod././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/metadata0000644000175000017500000000320110552726176031727 0ustar godgodpackage org.jboss.ws.extensions.eventing.metadata; import java.net.URI; import java.net.URISyntaxException; import org.jboss.ws.metadata.umdm.MetaDataExtension; /** * Eventing specific endpoint meta data extensions. * * @author Heiko Braun, * @since 21-Mar-2006 */ public class EventingEpMetaExt extends MetaDataExtension { private boolean isEventSource = true; private String eventSourceNS; private String[] notificationSchema; private String notificationRootElementNS; public EventingEpMetaExt(String extensionNameSpace) { super(extensionNameSpace); } public boolean isEventSource() { return isEventSource; } public void setEventSource(boolean eventSource) { isEventSource = eventSource; } public String getEventSourceNS() { return eventSourceNS; } public void setEventSourceNS(String eventSourceNS) { this.eventSourceNS = eventSourceNS; } public URI getEventSourceURI() { try { return new URI(eventSourceNS); } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal event source URI: " + eventSourceNS); } } public String[] getNotificationSchema() { return this.notificationSchema; } public void setNotificationSchema(String[] notificationSchema) { this.notificationSchema = notificationSchema; } public String getNotificationRootElementNS() { return notificationRootElementNS; } public void setNotificationRootElementNS(String notificationRootElementNS) { this.notificationRootElementNS = notificationRootElementNS; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/common/0000755000175000017500000000000010755000252031501 5ustar godgod././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/common/EventingEndpointBase.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/common/E0000644000175000017500000000712210577027146031627 0ustar godgod/* * 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.eventing.common; // $Id: EventingEndpointBase.java 2635 2007-03-17 18:07:34Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.rpc.soap.SOAPFaultException; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.JAXWSAConstants; import org.jboss.ws.Constants; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.extensions.eventing.EventingConstants; import org.jboss.ws.extensions.eventing.mgmt.SubscriptionManagerFactory; import org.jboss.ws.extensions.eventing.mgmt.SubscriptionManagerMBean; /** * @author Heiko Braun, * @since 13-Jan-2006 */ public abstract class EventingEndpointBase { private AddressingBuilder addrBuilder; /** * Retrieve the addressing properties associated with the request * and verify them. */ protected static AddressingProperties getAddrProperties() { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); AddressingProperties inProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND); assertAddrProperties(inProps); return inProps; } /** * Access local subscription manager service. */ protected SubscriptionManagerMBean getSubscriptionManager() { SubscriptionManagerFactory factory = SubscriptionManagerFactory.getInstance(); SubscriptionManagerMBean subscriptionManager = factory.getSubscriptionManager(); return subscriptionManager; } protected AddressingBuilder getAddrBuilder() { if (null == addrBuilder) addrBuilder = AddressingBuilder.getAddressingBuilder(); return addrBuilder; } /** * Ensure that all required inbound properties are supplied in request. * @param inProps * @throws javax.xml.rpc.soap.SOAPFaultException */ protected static void assertAddrProperties(AddressingProperties inProps) throws SOAPFaultException { if (null == inProps) throw new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, "Addressing headers missing from request", "wse:InvalidMessage", null); if(null == inProps.getTo()) throw new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, "Event source URI missing from request (wsa:To)", "wse:InvalidMessage", null); } public QName buildFaultQName(String elementName) { return new QName(EventingConstants.NS_EVENTING, elementName, EventingConstants.PREFIX_EVENTING); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/0000755000175000017500000000000010755000253031346 5ustar godgod././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/ProblemActionType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Pr0000644000175000017500000001006110560063272031654 0ustar godgod/* * 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.eventing.jaxws; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; /** *

      Java class for ProblemActionType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="ProblemActionType">
       *   <complexContent>
       *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *       <sequence>
       *         <element ref="{http://www.w3.org/2005/08/addressing}Action" minOccurs="0"/>
       *         <element name="SoapAction" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
       *       </sequence>
       *     </restriction>
       *   </complexContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ProblemActionType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "action", "soapAction" }) public class ProblemActionType { @XmlElement(name = "Action", namespace = "http://www.w3.org/2005/08/addressing") protected AttributedURIType action; @XmlElement(name = "SoapAction", namespace = "http://www.w3.org/2005/08/addressing") protected String soapAction; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the action property. * * @return * possible object is * {@link AttributedURIType } * */ public AttributedURIType getAction() { return action; } /** * Sets the value of the action property. * * @param value * allowed object is * {@link AttributedURIType } * */ public void setAction(AttributedURIType value) { this.action = value; } /** * Gets the value of the soapAction property. * * @return * possible object is * {@link String } * */ public String getSoapAction() { return soapAction; } /** * Sets the value of the soapAction property. * * @param value * allowed object is * {@link String } * */ public void setSoapAction(String value) { this.soapAction = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/RenewResponse.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Re0000644000175000017500000001064310560063272031647 0ustar godgod/* * 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.eventing.jaxws; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for RenewResponse element declaration. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <element name="RenewResponse">
       *   <complexType>
       *     <complexContent>
       *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *         <sequence>
       *           <element name="Expires" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}ExpirationType" minOccurs="0"/>
       *           <any/>
       *         </sequence>
       *       </restriction>
       *     </complexContent>
       *   </complexType>
       * </element>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "expires", "any" }) @XmlRootElement(name = "RenewResponse") public class RenewResponse { @XmlElement(name = "Expires", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected Date expires; @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the expires property. * * @return * possible object is * {@link String } * */ public Date getExpires() { return expires; } /** * Sets the value of the expires property. * * @param value * allowed object is * {@link String } * */ public void setExpires(Date value) { this.expires = value; } /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

           *    getAny().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/EventingService.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Ev0000644000175000017500000000616510676430372031666 0ustar godgod/* * 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.eventing.jaxws; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.Service21; /** * This class was generated by the JAXWS SI. * JAX-WS RI 2.0-b26-ea3 * Generated source version: 2.0 * */ @WebServiceClient(name = "EventingService", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", wsdlLocation = "wind.wsdl") public class EventingService extends Service21 { private final static URL WSDL_LOCATION; private final static QName EVENTINGSERVICE = new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "EventingService"); private final static QName EVENTSOURCEPORT = new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "EventSourcePort"); private final static QName SUBSCRIPTIONMANAGERPORT = new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "SubscriptionManagerPort"); static { URL url = null; try { url = new URL("file:/home/hbraun/dev/prj/jbossws/trunk/jbossws-tests/src/main/resources/jaxws/wseventing/WEB-INF/wsdl/wind.wsdl"); } catch (MalformedURLException e) { e.printStackTrace(); } WSDL_LOCATION = url; } public EventingService(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public EventingService() { super(WSDL_LOCATION, EVENTINGSERVICE); } /** * * @return * returns EventSource */ @WebEndpoint(name = "EventSourcePort") public EventSourceEndpoint getEventSourcePort() { return (EventSourceEndpoint)super.getPort(EVENTSOURCEPORT, EventSourceEndpoint.class); } /** * * @return * returns SubscriptionManagerEndpoint */ @WebEndpoint(name = "SubscriptionManagerPort") public SubscriptionManagerEndpoint getSubscriptionManagerPort() { return (SubscriptionManagerEndpoint)super.getPort(SUBSCRIPTIONMANAGERPORT, SubscriptionManagerEndpoint.class); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/EndpointReferenceType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/En0000644000175000017500000001365110560063272031645 0ustar godgod/* * 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.eventing.jaxws; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for EndpointReferenceType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="EndpointReferenceType">
       *   <complexContent>
       *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *       <sequence>
       *         <element name="Address" type="{http://www.w3.org/2005/08/addressing}AttributedURIType"/>
       *         <element name="ReferenceParameters" type="{http://www.w3.org/2005/08/addressing}ReferenceParametersType" minOccurs="0"/>
       *         <element ref="{http://www.w3.org/2005/08/addressing}Metadata" minOccurs="0"/>
       *         <any/>
       *       </sequence>
       *     </restriction>
       *   </complexContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "EndpointReferenceType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "address", "referenceParameters", "metadata", "any" }) public class EndpointReferenceType { @XmlElement(name = "Address", namespace = "http://www.w3.org/2005/08/addressing") protected AttributedURIType address; @XmlElement(name = "ReferenceParameters", namespace = "http://www.w3.org/2005/08/addressing") protected ReferenceParametersType referenceParameters; @XmlElement(name = "Metadata", namespace = "http://www.w3.org/2005/08/addressing") protected MetadataType metadata; @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the address property. * * @return * possible object is * {@link AttributedURIType } * */ public AttributedURIType getAddress() { return address; } /** * Sets the value of the address property. * * @param value * allowed object is * {@link AttributedURIType } * */ public void setAddress(AttributedURIType value) { this.address = value; } /** * Gets the value of the referenceParameters property. * * @return * possible object is * {@link ReferenceParametersType } * */ public ReferenceParametersType getReferenceParameters() { return referenceParameters; } /** * Sets the value of the referenceParameters property. * * @param value * allowed object is * {@link ReferenceParametersType } * */ public void setReferenceParameters(ReferenceParametersType value) { this.referenceParameters = value; } /** * Gets the value of the metadata property. * * @return * possible object is * {@link MetadataType } * */ public MetadataType getMetadata() { return metadata; } /** * Sets the value of the metadata property. * * @param value * allowed object is * {@link MetadataType } * */ public void setMetadata(MetadataType value) { this.metadata = value; } /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

          *    getAny().add(newItem);
          * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } public String toString() { return "EPR {address="+this.getAddress()+", refParam="+this.getReferenceParameters()+"}"; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/SubscribeResponse.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Su0000644000175000017500000001263510560063272031673 0ustar godgod/* * 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.eventing.jaxws; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for SubscribeResponse element declaration. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <element name="SubscribeResponse">
       *   <complexType>
       *     <complexContent>
       *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *         <sequence>
       *           <element name="SubscriptionManagerEndpoint" type="{http://www.w3.org/2005/08/addressing}EndpointReferenceType"/>
       *           <element name="Expires" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}ExpirationType"/>
       *           <any/>
       *         </sequence>
       *       </restriction>
       *     </complexContent>
       *   </complexType>
       * </element>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "subscriptionManager", "expires", "any" }) @XmlRootElement(name = "SubscribeResponse") public class SubscribeResponse { @XmlElement(name = "SubscriptionManager", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected EndpointReferenceType subscriptionManager; @XmlElement(name = "Expires", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected Date expires; @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the subscriptionManager property. * * @return * possible object is * {@link EndpointReferenceType } * */ public EndpointReferenceType getSubscriptionManager() { return subscriptionManager; } /** * Sets the value of the subscriptionManager property. * * @param value * allowed object is * {@link EndpointReferenceType } * */ public void setSubscriptionManager(EndpointReferenceType value) { this.subscriptionManager = value; } /** * Gets the value of the expires property. * * @return * possible object is * {@link String } * */ public Date getExpires() { return expires; } /** * Sets the value of the expires property. * * @param value * allowed object is * {@link String } * */ public void setExpires(Date value) { this.expires = value; } /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

          *    getAny().add(newItem);
          * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } public String getSubscriptionId() { JAXBElement jaxbElement = (JAXBElement)getSubscriptionManager().getReferenceParameters().getAny().get(0); return jaxbElement.getValue(); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/ReferenceParametersType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Re0000644000175000017500000001117010560063272031643 0ustar godgod/* * 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.eventing.jaxws; /* * 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. */ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for ReferenceParametersType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="ReferenceParametersType">
       *   <complexContent>
       *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *       <sequence>
       *         <any/>
       *       </sequence>
       *     </restriction>
       *   </complexContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ReferenceParametersType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "any" }) public class ReferenceParametersType { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

          *    getAny().add(newItem);
          * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } public String toString() { return this.getAny().toString(); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/GetStatusResponse.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Ge0000644000175000017500000000665310560063272031642 0ustar godgod package org.jboss.ws.extensions.eventing.jaxws; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for GetStatusResponse element declaration. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <element name="GetStatusResponse">
       *   <complexType>
       *     <complexContent>
       *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *         <sequence>
       *           <element name="Expires" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}ExpirationType" minOccurs="0"/>
       *           <any/>
       *         </sequence>
       *       </restriction>
       *     </complexContent>
       *   </complexType>
       * </element>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "expires", "any" }) @XmlRootElement(name = "GetStatusResponse") public class GetStatusResponse { @XmlElement(name = "Expires", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected Date expires; @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the expires property. * * @return * possible object is * {@link String } * */ public Date getExpires() { return expires; } /** * Sets the value of the expires property. * * @param value * allowed object is * {@link String } * */ public void setExpires(Date value) { this.expires = value; } /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

           *    getAny().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/EventSourceEndpoint.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Ev0000644000175000017500000000441010553676375031666 0ustar godgod/* * 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.eventing.jaxws; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.ws.addressing.Action; /** * This class was generated by the JAXWS SI. * JAX-WS RI 2.0-b26-ea3 * Generated source version: 2.0 * */ @WebService(name = "EventSource", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") @SOAPBinding(parameterStyle = ParameterStyle.BARE) public interface EventSourceEndpoint { /** * * @param body * @return * returns org.jboss.ws.extensions.eventing.jaxws.SubscribeResponse */ @WebMethod(operationName = "SubscribeOp") @WebResult(name = "SubscribeResponse", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") @Action( input = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe", output = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse" ) public SubscribeResponse subscribeOp( @WebParam(name = "Subscribe", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") Subscribe body); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/RelatesToType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Re0000644000175000017500000000776310560063272031660 0ustar godgod/* * 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.eventing.jaxws; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.namespace.QName; /** *

      Java class for RelatesToType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="RelatesToType">
       *   <simpleContent>
       *     <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
       *       <attribute name="RelationshipType" type="{http://www.w3.org/2005/08/addressing}RelationshipTypeOpenEnum" default="http://www.w3.org/2005/08/addressing/reply" />
       *     </extension>
       *   </simpleContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "RelatesToType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "value" }) public class RelatesToType { @XmlValue protected String value; @XmlAttribute(name = "RelationshipType") protected String relationshipType; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets the value of the relationshipType property. * * @return * possible object is * {@link String } * */ public String getRelationshipType() { if (relationshipType == null) { return "http://www.w3.org/2005/08/addressing/reply"; } else { return relationshipType; } } /** * Sets the value of the relationshipType property. * * @param value * allowed object is * {@link String } * */ public void setRelationshipType(String value) { this.relationshipType = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Renew.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Re0000644000175000017500000000657310560063272031656 0ustar godgod package org.jboss.ws.extensions.eventing.jaxws; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for Renew element declaration. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <element name="Renew">
       *   <complexType>
       *     <complexContent>
       *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *         <sequence>
       *           <element name="Expires" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}ExpirationType" minOccurs="0"/>
       *           <any/>
       *         </sequence>
       *       </restriction>
       *     </complexContent>
       *   </complexType>
       * </element>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "expires", "any" }) @XmlRootElement(name = "Renew") public class Renew { @XmlElement(name = "Expires", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected Date expires; @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the expires property. * * @return * possible object is * {@link String } * */ public Date getExpires() { return expires; } /** * Sets the value of the expires property. * * @param value * allowed object is * {@link String } * */ public void setExpires(Date value) { this.expires = value; } /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

           *    getAny().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/AbstractSubscriptionManagerEndpoint.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Ab0000644000175000017500000001656510650145103031626 0ustar godgod/* * 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.eventing.jaxws; import java.net.URI; import java.net.URISyntaxException; import java.util.Date; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.xml.namespace.QName; import javax.xml.rpc.soap.SOAPFaultException; import javax.xml.ws.addressing.Action; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.addressing.ReferenceParameters; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.annotation.EndpointConfig; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.extensions.eventing.EventingConstants; import org.jboss.ws.extensions.eventing.common.EventingEndpointBase; import org.jboss.ws.extensions.eventing.mgmt.SubscriptionError; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Element; /** * @author Heiko.Braun@jboss.org * @version $Id$ * @since 16.01.2007 */ @WebService( name = "SubscriptionManager", portName = "SubscriptionManagerPort", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", wsdlLocation = "/WEB-INF/wsdl/wind.wsdl") @EndpointConfig(configName = "Standard WSAddressing Endpoint") public abstract class AbstractSubscriptionManagerEndpoint extends EventingEndpointBase implements SubscriptionManagerEndpoint { public static final QName IDQN = new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier", "ns1"); @WebMethod(operationName = "GetStatusOp") @WebResult(name = "GetStatusResponse", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") @Action( input = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus", output = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse" ) public GetStatusResponse getStatusOp(@WebParam(name = "GetStatus", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") GetStatus body) { URI identifier = retrieveSubscriptionId(); getLogger().debug("GetStatus request for subscriptionID: " + identifier); try { Date leaseTime = getSubscriptionManager().getStatus(identifier); GetStatusResponse response = new GetStatusResponse(); response.setExpires(leaseTime); return response; } catch (SubscriptionError e) { throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null); } } @WebMethod(operationName = "RenewOp") @WebResult(name = "RenewResponse", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") @Action( input = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew", output = "http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse" ) public RenewResponse renewOp(@WebParam(name = "Renew", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") Renew request) { URI identifier = retrieveSubscriptionId(); getLogger().debug("Renew request for subscriptionID: " + identifier); try { Date newLeaseTime = getSubscriptionManager().renew(identifier, request.getExpires()); RenewResponse response = new RenewResponse(); response.setExpires(newLeaseTime); return response; } catch (SubscriptionError e) { throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null); } } @WebMethod(operationName = "UnsubscribeOp") @Action( input = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe", output = "http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse" ) public void unsubscribeOp(@WebParam(name = "Unsubscribe", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") Unsubscribe body) { URI identifier = retrieveSubscriptionId(); getLogger().debug("Unsubscribe request for subscriptionID: " + identifier); try { getSubscriptionManager().unsubscribe(identifier); } catch (SubscriptionError e) { throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null); } } private URI retrieveSubscriptionId() { URI subscriptionId = null; CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); AddressingProperties addrProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND); if (null == addrProps) { throw new SOAPFaultException( Constants.SOAP11_FAULT_CODE_CLIENT, "The message is not valid and cannot be processed: " + "Cannot obtain addressing properties.", null, null ); } ReferenceParameters refParams = addrProps.getReferenceParameters(); if (refParams != null) { for (Object obj : refParams.getElements()) { if (obj instanceof Element) { Element el = (Element)obj; QName qname = DOMUtils.getElementQName(el); if (qname.equals(IDQN)) { try { subscriptionId = new URI(DOMUtils.getTextContent(el)); break; } catch (URISyntaxException e) { throw new SOAPFaultException( Constants.SOAP11_FAULT_CODE_CLIENT, "The message is not valid and cannot be processed: " + "Invalid subscription id.", null, null ); } } } } } if (null == subscriptionId) { throw new SOAPFaultException( buildFaultQName(EventingConstants.CODE_INVALID_MESSAGE), "The message is not valid and cannot be processed: " + "Cannot obtain subscription id.", null, null ); } return subscriptionId; } /** * Subsclasses need to provide a logger for this endpoint * @return a custom {@link org.jboss.logging.Logger} instance */ protected abstract Logger getLogger(); } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/SubscriptionEnd.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Su0000644000175000017500000001462710560063272031676 0ustar godgod/* * 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.eventing.jaxws; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for SubscriptionEnd element declaration. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <element name="SubscriptionEnd">
       *   <complexType>
       *     <complexContent>
       *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *         <sequence>
       *           <element name="SubscriptionManagerEndpoint" type="{http://www.w3.org/2005/08/addressing}EndpointReferenceType"/>
       *           <element name="Code" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}OpenSubscriptionEndCodeType"/>
       *           <element name="Reason" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}LanguageSpecificStringType" maxOccurs="unbounded" minOccurs="0"/>
       *           <any/>
       *         </sequence>
       *       </restriction>
       *     </complexContent>
       *   </complexType>
       * </element>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "subscriptionManager", "code", "reason", "any" }) @XmlRootElement(name = "SubscriptionEnd") public class SubscriptionEnd { @XmlElement(name = "SubscriptionManager", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected EndpointReferenceType subscriptionManager; @XmlElement(name = "Code", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected String code; @XmlElement(name = "Reason", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected List reason; @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the subscriptionManager property. * * @return * possible object is * {@link EndpointReferenceType } * */ public EndpointReferenceType getSubscriptionManager() { return subscriptionManager; } /** * Sets the value of the subscriptionManager property. * * @param value * allowed object is * {@link EndpointReferenceType } * */ public void setSubscriptionManager(EndpointReferenceType value) { this.subscriptionManager = value; } /** * Gets the value of the code property. * * @return * possible object is * {@link String } * */ public String getCode() { return code; } /** * Sets the value of the code property. * * @param value * allowed object is * {@link String } * */ public void setCode(String value) { this.code = value; } /** * Gets the value of the reason property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the reason property. * *

      * For example, to add a new item, do as follows: *

           *    getReason().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link LanguageSpecificStringType } * * */ public List getReason() { if (reason == null) { reason = new ArrayList(); } return this.reason; } /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

           *    getAny().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/AttributedAnyType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/At0000644000175000017500000000635610560063272031653 0ustar godgod/* * 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.eventing.jaxws; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for AttributedAnyType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="AttributedAnyType">
       *   <complexContent>
       *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *       <sequence>
       *         <any/>
       *       </sequence>
       *     </restriction>
       *   </complexContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AttributedAnyType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "any" }) public class AttributedAnyType { @XmlAnyElement(lax = true) protected Object any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the any property. * * @return * possible object is * {@link Element } * {@link Object } * */ public Object getAny() { return any; } /** * Sets the value of the any property. * * @param value * allowed object is * {@link Element } * {@link Object } * */ public void setAny(Object value) { this.any = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/SubscriptionManagerEndpoint.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Su0000644000175000017500000000644610553676375031716 0ustar godgod/* * 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.eventing.jaxws; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.ws.addressing.Action; /** * This class was generated by the JAXWS SI. * JAX-WS RI 2.0-b26-ea3 * Generated source version: 2.0 * */ @WebService(name = "SubscriptionManager", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") @SOAPBinding(parameterStyle = ParameterStyle.BARE) public interface SubscriptionManagerEndpoint { /** * * @param body * @return * returns org.jboss.ws.extensions.eventing.GetStatusResponse */ @WebMethod(operationName = "GetStatusOp") @WebResult(name = "GetStatusResponse", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") @Action( input = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus", output = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse" ) public GetStatusResponse getStatusOp( @WebParam(name = "GetStatus", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") GetStatus body); /** * * @param body * @return * returns org.jboss.ws.extensions.eventing.RenewResponse */ @WebMethod(operationName = "RenewOp") @WebResult(name = "RenewResponse", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") @Action( input = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew", output = "http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse" ) public RenewResponse renewOp( @WebParam(name = "Renew", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") Renew body); /** * * @param body */ @WebMethod(operationName = "UnsubscribeOp") @Action( input = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe", output = "http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse" ) public void unsubscribeOp( @WebParam(name = "Unsubscribe", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") Unsubscribe body); } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Subscribe.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Su0000644000175000017500000001514410560063272031671 0ustar godgod/* * 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.eventing.jaxws; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for Subscribe element declaration. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <element name="Subscribe">
       *   <complexType>
       *     <complexContent>
       *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *         <sequence>
       *           <element name="EndTo" type="{http://www.w3.org/2005/08/addressing}EndpointReferenceType" minOccurs="0"/>
       *           <element name="Delivery" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}DeliveryType"/>
       *           <element name="Expires" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}ExpirationType" minOccurs="0"/>
       *           <element name="Filter" type="{http://schemas.xmlsoap.org/ws/2004/08/eventing}FilterType" minOccurs="0"/>
       *           <any/>
       *         </sequence>
       *       </restriction>
       *     </complexContent>
       *   </complexType>
       * </element>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "endTo", "delivery", "expires", "filter", "any" }) @XmlRootElement(name = "Subscribe") public class Subscribe { @XmlElement(name = "EndTo", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected EndpointReferenceType endTo; @XmlElement(name = "Delivery", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected DeliveryType delivery; @XmlElement(name = "Expires", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected Date expires; @XmlElement(name = "Filter", namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") protected FilterType filter; @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the endTo property. * * @return * possible object is * {@link EndpointReferenceType } * */ public EndpointReferenceType getEndTo() { return endTo; } /** * Sets the value of the endTo property. * * @param value * allowed object is * {@link EndpointReferenceType } * */ public void setEndTo(EndpointReferenceType value) { this.endTo = value; } /** * Gets the value of the delivery property. * * @return * possible object is * {@link DeliveryType } * */ public DeliveryType getDelivery() { return delivery; } /** * Sets the value of the delivery property. * * @param value * allowed object is * {@link DeliveryType } * */ public void setDelivery(DeliveryType value) { this.delivery = value; } /** * Gets the value of the expires property. * * @return * possible object is * {@link String } * */ public Date getExpires() { return expires; } /** * Sets the value of the expires property. * * @param value * allowed object is * {@link String } * */ public void setExpires(Date value) { this.expires = value; } /** * Gets the value of the filter property. * * @return * possible object is * {@link FilterType } * */ public FilterType getFilter() { return filter; } /** * Sets the value of the filter property. * * @param value * allowed object is * {@link FilterType } * */ public void setFilter(FilterType value) { this.filter = value; } /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

           *    getAny().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/MetadataType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Me0000644000175000017500000000506210560063272031641 0ustar godgod package org.jboss.ws.extensions.eventing.jaxws; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for MetadataType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="MetadataType">
       *   <complexContent>
       *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *       <sequence>
       *         <any/>
       *       </sequence>
       *     </restriction>
       *   </complexContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MetadataType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "any" }) public class MetadataType { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

           *    getAny().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/GetStatus.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Ge0000644000175000017500000000720010560063272031627 0ustar godgod/* * 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.eventing.jaxws; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for GetStatus element declaration. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <element name="GetStatus">
       *   <complexType>
       *     <complexContent>
       *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *         <sequence>
       *           <any/>
       *         </sequence>
       *       </restriction>
       *     </complexContent>
       *   </complexType>
       * </element>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "any" }) @XmlRootElement(name = "GetStatus") public class GetStatus { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

           *    getAny().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/LanguageSpecificStringType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/La0000644000175000017500000000731510560063272031637 0ustar godgod/* * 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.eventing.jaxws; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.namespace.QName; /** *

      Java class for LanguageSpecificStringType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="LanguageSpecificStringType">
       *   <simpleContent>
       *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
       *       <attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/>
       *     </extension>
       *   </simpleContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "LanguageSpecificStringType", propOrder = { "value" }) public class LanguageSpecificStringType { @XmlValue protected String value; @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") protected String lang; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets the value of the lang property. * * @return * possible object is * {@link String } * */ public String getLang() { return lang; } /** * Sets the value of the lang property. * * @param value * allowed object is * {@link String } * */ public void setLang(String value) { this.lang = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/package-info.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/pa0000644000175000017500000000022310553667012031676 0ustar godgod@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing") package org.jboss.ws.extensions.eventing.jaxws; ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Unsubscribe.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Un0000644000175000017500000000520010560063272031654 0ustar godgod package org.jboss.ws.extensions.eventing.jaxws; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for Unsubscribe element declaration. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <element name="Unsubscribe">
       *   <complexType>
       *     <complexContent>
       *       <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *         <sequence>
       *           <any/>
       *         </sequence>
       *       </restriction>
       *     </complexContent>
       *   </complexType>
       * </element>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "any" }) @XmlRootElement(name = "Unsubscribe") public class Unsubscribe { @XmlAnyElement(lax = true) protected List any; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the any property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the any property. * *

      * For example, to add a new item, do as follows: *

           *    getAny().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * * */ public List getAny() { if (any == null) { any = new ArrayList(); } return this.any; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/AttributedURIType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/At0000644000175000017500000000621510560063272031645 0ustar godgod/* * 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.eventing.jaxws; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.namespace.QName; /** *

      Java class for AttributedURIType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="AttributedURIType">
       *   <simpleContent>
       *     <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
       *     </extension>
       *   </simpleContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AttributedURIType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "value" }) public class AttributedURIType { @XmlValue protected String value; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } public String toString() { return this.getValue(); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/DeliveryType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/De0000644000175000017500000001144710560063272031634 0ustar godgod/* * 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.eventing.jaxws; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for DeliveryType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="DeliveryType">
       *   <complexContent>
       *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *       <sequence>
       *         <any/>
       *       </sequence>
       *       <attribute name="Mode" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
       *     </restriction>
       *   </complexContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DeliveryType", propOrder = { "content" }) public class DeliveryType { @XmlMixed @XmlAnyElement(lax = true) protected List content; @XmlAttribute(name = "Mode") protected String mode; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the content property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. * *

      * For example, to add a new item, do as follows: *

           *    getContent().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link String } * {@link Object } * * */ public List getContent() { if (content == null) { content = new ArrayList(); } return this.content; } /** * Gets the value of the mode property. * * @return * possible object is * {@link String } * */ public String getMode() { return mode; } /** * Sets the value of the mode property. * * @param value * allowed object is * {@link String } * */ public void setMode(String value) { this.mode = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } public void setNotifyTo(EndpointReferenceType o) { getContent().add( new JAXBElement( new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "NotifyTo"), EndpointReferenceType.class, o ) ); } public EndpointReferenceType getNotifyTo() { if(getContent().isEmpty()) return null; JAXBElement jaxbElement = (JAXBElement) this.content.get(0); return jaxbElement.getValue(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/FilterType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Fi0000644000175000017500000001040610560063272031634 0ustar godgod/* * 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.eventing.jaxws; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** *

      Java class for FilterType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="FilterType">
       *   <complexContent>
       *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *       <sequence>
       *         <any/>
       *       </sequence>
       *       <attribute name="Dialect" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
       *     </restriction>
       *   </complexContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "FilterType", propOrder = { "content" }) public class FilterType { @XmlMixed @XmlAnyElement(lax = true) protected List content; @XmlAttribute(name = "Dialect") protected String dialect; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the content property. * *

      * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. * *

      * For example, to add a new item, do as follows: *

           *    getContent().add(newItem);
           * 
      * * *

      * Objects of the following type(s) are allowed in the list * {@link Element } * {@link String } * {@link Object } * * */ public List getContent() { if (content == null) { content = new ArrayList(); } return this.content; } /** * Gets the value of the dialect property. * * @return * possible object is * {@link String } * */ public String getDialect() { return dialect; } /** * Sets the value of the dialect property. * * @param value * allowed object is * {@link String } * */ public void setDialect(String value) { this.dialect = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/AttributedUnsignedLongType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/At0000644000175000017500000000624710560063272031652 0ustar godgod/* * 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.eventing.jaxws; import java.math.BigInteger; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.namespace.QName; /** *

      Java class for AttributedUnsignedLongType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="AttributedUnsignedLongType">
       *   <simpleContent>
       *     <extension base="<http://www.w3.org/2001/XMLSchema>unsignedLong">
       *     </extension>
       *   </simpleContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AttributedUnsignedLongType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "value" }) public class AttributedUnsignedLongType { @XmlValue protected BigInteger value; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the value property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link BigInteger } * */ public void setValue(BigInteger value) { this.value = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/AbstractEventSourceEndpoint.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Ab0000644000175000017500000001206110560063272031617 0ustar godgod/* * 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.eventing.jaxws; import java.net.URI; import java.net.URISyntaxException; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.xml.rpc.soap.SOAPFaultException; import javax.xml.ws.addressing.Action; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.AttributedURI; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.annotation.EndpointConfig; import org.jboss.ws.extensions.eventing.EventingConstants; import org.jboss.ws.extensions.eventing.common.EventingEndpointBase; import org.jboss.ws.extensions.eventing.mgmt.Filter; import org.jboss.ws.extensions.eventing.mgmt.SubscriptionError; import org.jboss.ws.extensions.eventing.mgmt.SubscriptionManagerMBean; import org.jboss.ws.extensions.eventing.mgmt.SubscriptionTicket; /** * @author Heiko.Braun@jboss.org * @version $Id$ * @since 16.01.2007 */ @WebService( name = "EventSource", portName = "EventSourcePort", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", wsdlLocation = "/WEB-INF/wsdl/wind.wsdl") @EndpointConfig(configName = "Standard WSAddressing Endpoint") public abstract class AbstractEventSourceEndpoint extends EventingEndpointBase implements EventSourceEndpoint { @WebMethod(operationName = "SubscribeOp") @WebResult(name = "SubscribeResponse", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") @Action( input = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe", output = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse" ) public SubscribeResponse subscribeOp(@WebParam(name = "Subscribe", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", partName = "body") Subscribe request) { try { // retrieve addressing headers AddressingProperties inProps = getAddrProperties(); AttributedURI eventSourceURI = inProps.getTo(); getLogger().debug("Subscribe request for event source: " + eventSourceURI.getURI()); assertSubscriberEndpoints(request); EndpointReferenceType notifyTo = request.getDelivery().getNotifyTo(); EndpointReferenceType endTo = request.getEndTo(); // adapt filter elements Filter filter = null; if (request.getFilter() != null) { try { filter = new Filter( new URI(request.getFilter().getDialect()), (String)request.getFilter().getContent().get(0)); } catch (URISyntaxException e) { throw new WSException(e); } } // invoke subscription manager SubscriptionManagerMBean subscriptionManager = getSubscriptionManager(); SubscriptionTicket ticket = subscriptionManager.subscribe( eventSourceURI.getURI(), notifyTo, endTo, request.getExpires(), filter ); // create the response element SubscribeResponse res = new SubscribeResponse(); res.setExpires(ticket.getExpires()); res.setSubscriptionManager(ticket.getSubscriptionManager()); return res; } catch (SubscriptionError e) { throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null); } } /** * Ensure that the subscriber endpoint information is supplied in request. * Namely NotifyTo and EndTo need to be set. * @param request */ private void assertSubscriberEndpoints(Subscribe request) { if(null == request.getDelivery().getNotifyTo() || null == request.getEndTo() ) throw new SOAPFaultException( buildFaultQName(EventingConstants.CODE_INVALID_MESSAGE) , "Subcriber endpoint information missing from request", null, null ); } /** * Subsclasses need to provide a logger for this endpoint * @return a custom {@link org.jboss.logging.Logger} instance */ protected abstract Logger getLogger(); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/AttributedQNameType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/At0000644000175000017500000000611510560063272031644 0ustar godgod/* * 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.eventing.jaxws; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.namespace.QName; /** *

      Java class for AttributedQNameType complex type. * *

      The following schema fragment specifies the expected content contained within this class. * *

       * <complexType name="AttributedQNameType">
       *   <simpleContent>
       *     <extension base="<http://www.w3.org/2001/XMLSchema>QName">
       *     </extension>
       *   </simpleContent>
       * </complexType>
       * 
      * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AttributedQNameType", namespace = "http://www.w3.org/2005/08/addressing", propOrder = { "value" }) public class AttributedQNameType { @XmlValue protected QName value; @XmlAnyAttribute private Map otherAttributes = new HashMap(); /** * Gets the value of the value property. * * @return * possible object is * {@link QName } * */ public QName getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link QName } * */ public void setValue(QName value) { this.value = value; } /** * Gets a map that contains attributes that aren't bound to any typed property on this class. * *

      * the map is keyed by the name of the attribute and * the value is the string value of the attribute. * * the map returned by this method is live, and you can add new attribute * by updating the map directly. Because of this design, there's no setter. * * * @return * always non-null */ public Map getOtherAttributes() { return otherAttributes; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/ObjectFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/jaxws/Ob0000644000175000017500000003556410553667012031656 0ustar godgod/* * 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.eventing.jaxws; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the org.jboss.ws.extensions.eventing package. *

      An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { private final static QName _Metadata_QNAME = new QName("http://www.w3.org/2005/08/addressing", "Metadata"); private final static QName _ProblemHeader_QNAME = new QName("http://www.w3.org/2005/08/addressing", "ProblemHeader"); private final static QName _EndpointReference_QNAME = new QName("http://www.w3.org/2005/08/addressing", "EndpointReference"); private final static QName _ProblemIRI_QNAME = new QName("http://www.w3.org/2005/08/addressing", "ProblemIRI"); private final static QName _FaultTo_QNAME = new QName("http://www.w3.org/2005/08/addressing", "FaultTo"); private final static QName _Identifier_QNAME = new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier"); private final static QName _SupportedDialect_QNAME = new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "SupportedDialect"); private final static QName _MessageID_QNAME = new QName("http://www.w3.org/2005/08/addressing", "MessageID"); private final static QName _RetryAfter_QNAME = new QName("http://www.w3.org/2005/08/addressing", "RetryAfter"); private final static QName _RelatesTo_QNAME = new QName("http://www.w3.org/2005/08/addressing", "RelatesTo"); private final static QName _ReplyTo_QNAME = new QName("http://www.w3.org/2005/08/addressing", "ReplyTo"); private final static QName _SupportedDeliveryMode_QNAME = new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "SupportedDeliveryMode"); private final static QName _Action_QNAME = new QName("http://www.w3.org/2005/08/addressing", "Action"); private final static QName _ProblemHeaderQName_QNAME = new QName("http://www.w3.org/2005/08/addressing", "ProblemHeaderQName"); private final static QName _To_QNAME = new QName("http://www.w3.org/2005/08/addressing", "To"); private final static QName _NotifyTo_QNAME = new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "NotifyTo"); private final static QName _ProblemAction_QNAME = new QName("http://www.w3.org/2005/08/addressing", "ProblemAction"); private final static QName _From_QNAME = new QName("http://www.w3.org/2005/08/addressing", "From"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.ws.extensions.eventing * */ public ObjectFactory() { } /** * Create an instance of {@link ReferenceParametersType } * */ public ReferenceParametersType createReferenceParametersType() { return new ReferenceParametersType(); } /** * Create an instance of {@link AttributedURIType } * */ public AttributedURIType createAttributedURIType() { return new AttributedURIType(); } /** * Create an instance of {@link SubscribeResponse } * */ public SubscribeResponse createSubscribeResponse() { return new SubscribeResponse(); } /** * Create an instance of {@link SubscriptionEnd } * */ public SubscriptionEnd createSubscriptionEnd() { return new SubscriptionEnd(); } /** * Create an instance of {@link RelatesToType } * */ public RelatesToType createRelatesToType() { return new RelatesToType(); } /** * Create an instance of {@link ProblemActionType } * */ public ProblemActionType createProblemActionType() { return new ProblemActionType(); } /** * Create an instance of {@link Renew } * */ public Renew createRenew() { return new Renew(); } /** * Create an instance of {@link LanguageSpecificStringType } * */ public LanguageSpecificStringType createLanguageSpecificStringType() { return new LanguageSpecificStringType(); } /** * Create an instance of {@link GetStatus } * */ public GetStatus createGetStatus() { return new GetStatus(); } /** * Create an instance of {@link AttributedUnsignedLongType } * */ public AttributedUnsignedLongType createAttributedUnsignedLongType() { return new AttributedUnsignedLongType(); } /** * Create an instance of {@link AttributedAnyType } * */ public AttributedAnyType createAttributedAnyType() { return new AttributedAnyType(); } /** * Create an instance of {@link Subscribe } * */ public Subscribe createSubscribe() { return new Subscribe(); } /** * Create an instance of {@link EndpointReferenceType } * */ public EndpointReferenceType createEndpointReferenceType() { return new EndpointReferenceType(); } /** * Create an instance of {@link FilterType } * */ public FilterType createFilterType() { return new FilterType(); } /** * Create an instance of {@link MetadataType } * */ public MetadataType createMetadataType() { return new MetadataType(); } /** * Create an instance of {@link AttributedQNameType } * */ public AttributedQNameType createAttributedQNameType() { return new AttributedQNameType(); } /** * Create an instance of {@link DeliveryType } * */ public DeliveryType createDeliveryType() { return new DeliveryType(); } /** * Create an instance of {@link RenewResponse } * */ public RenewResponse createRenewResponse() { return new RenewResponse(); } /** * Create an instance of {@link Unsubscribe } * */ public Unsubscribe createUnsubscribe() { return new Unsubscribe(); } /** * Create an instance of {@link GetStatusResponse } * */ public GetStatusResponse createGetStatusResponse() { return new GetStatusResponse(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link MetadataType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "Metadata") public JAXBElement createMetadata(MetadataType value) { return new JAXBElement(_Metadata_QNAME, MetadataType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link AttributedAnyType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "ProblemHeader") public JAXBElement createProblemHeader(AttributedAnyType value) { return new JAXBElement(_ProblemHeader_QNAME, AttributedAnyType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link EndpointReferenceType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "EndpointReference") public JAXBElement createEndpointReference(EndpointReferenceType value) { return new JAXBElement(_EndpointReference_QNAME, EndpointReferenceType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link AttributedURIType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "ProblemIRI") public JAXBElement createProblemIRI(AttributedURIType value) { return new JAXBElement(_ProblemIRI_QNAME, AttributedURIType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link EndpointReferenceType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "FaultTo") public JAXBElement createFaultTo(EndpointReferenceType value) { return new JAXBElement(_FaultTo_QNAME, EndpointReferenceType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ @XmlElementDecl(namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", name = "Identifier") public JAXBElement createIdentifier(String value) { return new JAXBElement(_Identifier_QNAME, String.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ @XmlElementDecl(namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", name = "SupportedDialect") public JAXBElement createSupportedDialect(String value) { return new JAXBElement(_SupportedDialect_QNAME, String.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link AttributedURIType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "MessageID") public JAXBElement createMessageID(AttributedURIType value) { return new JAXBElement(_MessageID_QNAME, AttributedURIType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link AttributedUnsignedLongType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "RetryAfter") public JAXBElement createRetryAfter(AttributedUnsignedLongType value) { return new JAXBElement(_RetryAfter_QNAME, AttributedUnsignedLongType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link RelatesToType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "RelatesTo") public JAXBElement createRelatesTo(RelatesToType value) { return new JAXBElement(_RelatesTo_QNAME, RelatesToType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link EndpointReferenceType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "ReplyTo") public JAXBElement createReplyTo(EndpointReferenceType value) { return new JAXBElement(_ReplyTo_QNAME, EndpointReferenceType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ @XmlElementDecl(namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", name = "SupportedDeliveryMode") public JAXBElement createSupportedDeliveryMode(String value) { return new JAXBElement(_SupportedDeliveryMode_QNAME, String.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link AttributedURIType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "Action") public JAXBElement createAction(AttributedURIType value) { return new JAXBElement(_Action_QNAME, AttributedURIType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link AttributedQNameType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "ProblemHeaderQName") public JAXBElement createProblemHeaderQName(AttributedQNameType value) { return new JAXBElement(_ProblemHeaderQName_QNAME, AttributedQNameType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link AttributedURIType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "To") public JAXBElement createTo(AttributedURIType value) { return new JAXBElement(_To_QNAME, AttributedURIType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link EndpointReferenceType }{@code >}} * */ @XmlElementDecl(namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing", name = "NotifyTo") public JAXBElement createNotifyTo(EndpointReferenceType value) { return new JAXBElement(_NotifyTo_QNAME, EndpointReferenceType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link ProblemActionType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "ProblemAction") public JAXBElement createProblemAction(ProblemActionType value) { return new JAXBElement(_ProblemAction_QNAME, ProblemActionType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link EndpointReferenceType }{@code >}} * */ @XmlElementDecl(namespace = "http://www.w3.org/2005/08/addressing", name = "From") public JAXBElement createFrom(EndpointReferenceType value) { return new JAXBElement(_From_QNAME, EndpointReferenceType.class, null, value); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/EventingConstants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/eventing/Eventing0000644000175000017500000001343410542776150031733 0ustar godgod/* * 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.eventing; // $Id: EventingConstants.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.net.URI; import java.net.URISyntaxException; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingConstants; import org.jboss.ws.WSException; /** * @author Heiko Braun, * @since 19-Dec-2005 */ public class EventingConstants { private static AddressingBuilder WSA_BUILDER = AddressingBuilder.getAddressingBuilder(); private static AddressingConstants WSA_CONSTANTS = WSA_BUILDER.newAddressingConstants(); // common namespaces public final static String NS_EVENTING = "http://schemas.xmlsoap.org/ws/2004/08/eventing"; public final static String PREFIX_EVENTING = "wse"; public final static String NS_ADDRESSING = WSA_CONSTANTS.getNamespaceURI(); // request /response action from specification public final static String SUBSCRIBE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe"; public final static String SUBSCRIBE_RESPONSE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse"; public final static String UNSUBSCRIBE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe"; public final static String UNSUBSCRIBE_RESPONSE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse"; public final static String GET_STATUS_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus"; public final static String GET_STATUS_RESPONSE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse"; public final static String RENEW_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew"; public final static String RENEW_RESPONSE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse"; public final static String SUBSCRIPTION_END_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscriptionEnd"; public final static String WSA_FAULT_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/addressing/fault"; public final static String WSA_ANONYMOUS_URI = WSA_CONSTANTS.getAnonymousURI(); // failures public final static String DELIVERY_FAILURE = "http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryFailure"; public final static String SOURCE_SHUTTING_DOWN = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SourceShuttingDown"; public final static String SOURCE_CANCELING = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SourceCanceling"; public final static String CODE_UNABLE_TO_PROCESS = "EventSourceUnableToProcess"; public final static String CODE_FILTER_NOT_SUPPORTED = "FilteringNotSupported"; public final static String CODE_REQUESTED_FILTER_UNAVAILABLE = "FilteringRequestedUnavailable"; public final static String CODE_INVALID_EXPIRATION_TIME = "InvalidExpirationTime"; public final static String CODE_UNABLE_TO_RENEW = "UnableToRenew"; public final static String CODE_INVALID_MESSAGE = "InvalidMessage"; // default config public final static String DISPATCHER_JNDI_NAME = "EventDispatcher"; public final static long MAX_LEASE_TIME = 1000 * 60 * 10L; public final static long DEFAULT_LEASE = 1000 * 60 * 5L; private static URI DELIVERY_PUSH_URI = null; private static URI DIALECT_XPATH_URI = null; private static URI SUBSCRIBE_ACTION_URI = null; public final static URI buildURI(String uri) { try { return new URI(uri); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } } public static final URI getDefaultFilterDialect() { try { return new URI("http://www.w3.org/TR/1999/REC-xpath-19991116"); } catch (URISyntaxException e) { throw new WSException(e.getMessage()); } } public static final URI getDeliveryPush() { if (null == DELIVERY_PUSH_URI) { try { DELIVERY_PUSH_URI = new URI("http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push"); } catch (URISyntaxException e) { // } } return DELIVERY_PUSH_URI; } public static URI getDialectXPath() { if (null == DIALECT_XPATH_URI) { try { DIALECT_XPATH_URI = new URI("http://www.w3.org/TR/1999/REC-xpath-19991116"); } catch (URISyntaxException e) { // } } return DIALECT_XPATH_URI; } public static URI getSubscribeAction() { if (null == SUBSCRIBE_ACTION_URI) { try { SUBSCRIBE_ACTION_URI = new URI(SUBSCRIBE_ACTION); } catch (URISyntaxException e) { // } } return SUBSCRIBE_ACTION_URI; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/0000755000175000017500000000000010755000254027673 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/metadata/0000755000175000017500000000000010755000254031453 5ustar godgod././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/metadata/P0000644000175000017500000003061010654066746031615 0ustar godgod/* * 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.metadata; import java.io.InputStream; import java.util.List; import java.util.StringTokenizer; import org.apache.ws.policy.Policy; import org.apache.ws.policy.PolicyReference; import org.apache.ws.policy.util.DOMPolicyReader; import org.apache.ws.policy.util.PolicyFactory; import org.apache.ws.policy.util.PolicyRegistry; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.extensions.policy.PolicyScopeLevel; import org.jboss.ws.extensions.policy.annotation.PolicyAttachment; import org.jboss.ws.extensions.policy.deployer.PolicyDeployer; import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ExtensibleMetaData; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLExtensibilityElement; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLProperty; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; /** * A meta data builder for policies; handles checks for policy support * and their eventual deploy on both server side and client side. * * @author Alessio Soldano, * * @since 16-May-2007 */ public class PolicyMetaDataBuilder { private static final Logger log = Logger.getLogger(PolicyMetaDataBuilder.class); private boolean serverSide = true; private boolean toolMode = false; private PolicyDeployer customDeployer; public PolicyMetaDataBuilder() { } /** * To be used for tests or whenever a custom deployer is required * * @param customDeployer */ public PolicyMetaDataBuilder(PolicyDeployer customDeployer) { this.customDeployer = customDeployer; } /** * Creates a new PolicyMetaDataBuilder for server side policy processing. * * @param toolMode True if running WSProvideTask (no policy deployments) * @return */ public static PolicyMetaDataBuilder getServerSidePolicyMetaDataBuilder(boolean toolMode) { PolicyMetaDataBuilder builder = new PolicyMetaDataBuilder(); builder.setServerSide(true); builder.setToolMode(toolMode); return builder; } /** * Creates a new PolicyMetaDataBuilder for client side policy processing. * * @return */ public static PolicyMetaDataBuilder getClientSidePolicyMetaDataBuilder() { PolicyMetaDataBuilder builder = new PolicyMetaDataBuilder(); builder.setServerSide(false); return builder; } public void processPolicyAnnotations(EndpointMetaData epMetaData, Class sepClass) { UnifiedVirtualFile vfRoot = epMetaData.getServiceMetaData().getUnifiedMetaData().getRootFile(); for (org.jboss.ws.extensions.policy.annotation.Policy anPolicy : sepClass.getAnnotation(PolicyAttachment.class).value()) { InputStream is = null; try { String policyFileLocation = anPolicy.policyFileLocation(); if (policyFileLocation.length() == 0) throw new IllegalStateException("Cannot obtain @Policy.policyFileLocation"); // The root virtual file is the uniform way to obtain resources // It should work in all containers, server/client side UnifiedVirtualFile vfPolicyFile = vfRoot.findChild(policyFileLocation); is = vfPolicyFile.toURL().openStream(); DOMPolicyReader reader = (DOMPolicyReader)PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER); Policy unnormalizedPolicy = reader.readPolicy(is); Policy normPolicy = (Policy)unnormalizedPolicy.normalize(); log.info("Deploying Annotated Policy = " + policyFileLocation); PolicyScopeLevel scope = anPolicy.scope(); if (PolicyScopeLevel.WSDL_PORT.equals(scope) || PolicyScopeLevel.WSDL_PORT_TYPE.equals(scope) || PolicyScopeLevel.WSDL_BINDING.equals(scope)) { deployPolicy(normPolicy, scope, epMetaData); } else { throw new WSException("Policy scope " + scope + " not supported yet!"); } } catch (Exception e) { log.error(e); } finally { try { is.close(); } catch (Exception e) { } } } } public void processPolicyExtensions(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions) { //Collect all policies defined in our wsdl definitions DOMPolicyReader reader = (DOMPolicyReader)PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER); PolicyRegistry localPolicyRegistry = new PolicyRegistry(); for (WSDLExtensibilityElement policyElement : wsdlDefinitions.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY)) { Policy policy = reader.readPolicy(policyElement.getElement()); localPolicyRegistry.register(policy.getPolicyURI(), policy); } //Port scope WSDLService wsdlService = wsdlDefinitions.getService(epMetaData.getServiceMetaData().getServiceName()); if (wsdlService != null) { WSDLEndpoint wsdlEndpoint = wsdlService.getEndpoint(epMetaData.getPortName()); if (wsdlEndpoint != null) { List portPolicyRefList = wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE); processPolicies(portPolicyRefList, PolicyScopeLevel.WSDL_PORT, localPolicyRegistry, epMetaData); } else { log .warn("Cannot get port '" + epMetaData.getPortName() + "' from the given wsdl definitions! Eventual policies attached to this port won't be considered."); } } else { log.warn("Cannot get service '" + epMetaData.getServiceMetaData().getServiceName() + "' from the given wsdl definitions! Eventual policies attached to this service won't be considered."); } //Binding scope WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(epMetaData.getPortTypeName()); if (wsdlBinding != null) { List bindingPolicyRefList = wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE); processPolicies(bindingPolicyRefList, PolicyScopeLevel.WSDL_BINDING, localPolicyRegistry, epMetaData); } else { log.warn("Cannot get binding for portType '" + epMetaData.getPortTypeName() + "' from the given wsdl definitions! Eventual policies attached to this binding won't be considered."); } //PortType scope WSDLInterface wsdlInterface = wsdlDefinitions.getInterface(epMetaData.getPortTypeName()); if (wsdlInterface != null) { WSDLProperty portTypePolicyProp = wsdlInterface.getProperty(Constants.WSDL_PROPERTY_POLICYURIS); processPolicies(portTypePolicyProp, PolicyScopeLevel.WSDL_PORT_TYPE, localPolicyRegistry, epMetaData); } else { log.warn("Cannot get portType '" + epMetaData.getPortTypeName() + "' from the given wsdl definitions! Eventual policies attached to this portType won't be considered."); } } private void processPolicies(WSDLProperty policyProp, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData) { if (policyProp != null && policyProp.getValue() != null) { StringTokenizer st = new StringTokenizer(policyProp.getValue(), ", ", false); while (st.hasMoreTokens()) { PolicyReference policyRef = new PolicyReference(st.nextToken()); deployPolicy(resolvePolicyReference(policyRef, localPolicies), scope, extMetaData); } } } private void processPolicies(List policyReferences, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData) { if (policyReferences != null && policyReferences.size() != 0) { DOMPolicyReader reader = (DOMPolicyReader)PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER); for (WSDLExtensibilityElement element : policyReferences) { PolicyReference policyRef = reader.readPolicyReference(element.getElement()); deployPolicy(resolvePolicyReference(policyRef, localPolicies), scope, extMetaData); } } } private Policy resolvePolicyReference(PolicyReference policyRef, PolicyRegistry localPolicies) { Policy normPolicy; try { normPolicy = (Policy)policyRef.normalize(localPolicies); } catch (RuntimeException e) { //TODO!!! not a local policy: get the policy definition and create the policy normPolicy = null; } return normPolicy; } private void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData) { PolicyDeployer deployer; if (customDeployer != null) { deployer = customDeployer; } else if (toolMode) { deployer = PolicyDeployer.newInstanceForTools(); } else { deployer = PolicyDeployer.getInstance(); } if (serverSide) { deployPolicyServerSide(policy, scope, extMetaData, deployer); } else { deployPolicyClientSide(policy, scope, extMetaData, deployer); } } private void deployPolicyServerSide(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData, PolicyDeployer deployer) { PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY); if (ext == null) { ext = new PolicyMetaExtension(Constants.URI_WS_POLICY); extMetaData.addExtension(ext); } try { Policy deployedPolicy = deployer.deployServerside(policy, extMetaData); ext.addPolicy(scope, deployedPolicy); } catch (UnsupportedPolicy e) { log.warn("Policy Not supported:" + policy.getPolicyURI()); } } private void deployPolicyClientSide(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData, PolicyDeployer deployer) { PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY); if (ext == null) { ext = new PolicyMetaExtension(Constants.URI_WS_POLICY); extMetaData.addExtension(ext); } try { deployer.deployClientSide(policy, extMetaData); ext.addPolicy(scope, policy); } catch (UnsupportedPolicy e) { if (log.isDebugEnabled()) { log.debug("Policy Not supported:" + policy.getPolicyURI()); } WSException.rethrow("Policy not supported! " + policy.getPolicyURI(), e); } } public boolean isServerSide() { return serverSide; } public void setServerSide(boolean serverSide) { this.serverSide = serverSide; } public boolean isToolMode() { return toolMode; } public void setToolMode(boolean toolMode) { this.toolMode = toolMode; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/metadata/PolicyMetaExtension.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/metadata/P0000644000175000017500000000270710625052352031605 0ustar godgodpackage org.jboss.ws.extensions.policy.metadata; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import org.apache.ws.policy.Policy; import org.jboss.ws.extensions.policy.PolicyScopeLevel; import org.jboss.ws.metadata.umdm.MetaDataExtension; public class PolicyMetaExtension extends MetaDataExtension { //Policies may be attached to a policy subject with different policy scopes private Map> policies = new HashMap>(); public PolicyMetaExtension(String extensionNameSpace) { super(extensionNameSpace); } public void addPolicy(PolicyScopeLevel scope, Policy policy) { Collection list; if (!policies.containsKey(scope)) { list = new LinkedList(); policies.put(scope,list); } else { list = policies.get(scope); } list.add(policy); } public Collection getPolicies(PolicyScopeLevel scope) { Collection policyCollection = policies.get(scope); return policyCollection == null ? new LinkedList() : policyCollection; } public Collection getAllPolicies() { Collection list = new LinkedList(); for (PolicyScopeLevel scope : policies.keySet()) { list.addAll(policies.get(scope)); } return list; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/0000755000175000017500000000000010755000254031516 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/domainAssertion/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/d0000755000175000017500000000000010755000254031662 5ustar godgod././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/domainAssertion/WSSecurityAssertionDeployer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/d0000644000175000017500000001075110625052352031672 0ustar godgod/* * 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 java.io.ByteArrayOutputStream; import java.io.StringReader; import org.apache.ws.policy.PrimitiveAssertion; import org.jboss.logging.Logger; 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.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; /** * * @author Stefano Maestri, * @author Alessio Soldano, * */ 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(); } } } } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/d0000644000175000017500000000401610627234505031673 0ustar godgod/* * 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; /** * This assertion deployer actually does nothing when asked to * deploy a policy assertion. It is used as a placeholder by * PolicyDeployer in case no modification to umdm or anything * else is actually required (for example when running the * WSProvideTask tool). * * @author Stefano Maestri * @author Alessio Soldano * * @since 16-May-2007 * */ public class NopAssertionDeployer implements AssertionDeployer { public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { //nop } public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { //nop } } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/domainAssertion/AssertionDeployer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/d0000644000175000017500000000427510625052352031676 0ustar godgod/* * 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 * @author Alessio Soldano * */ 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; } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/exceptions/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/e0000755000175000017500000000000010755000254031663 5ustar godgod././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/exceptions/UnsupportedAssertion.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/e0000644000175000017500000000231410625052352031667 0ustar godgod/* * 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.exceptions; /** * @author Stefano Maestri * * since 27/04/2007 */ public class UnsupportedAssertion extends Exception { } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/exceptions/UnsupportedAlternative.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/e0000644000175000017500000000231610625052352031671 0ustar godgod/* * 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.exceptions; /** * @author Stefano Maestri * * since 27/04/2007 */ public class UnsupportedAlternative extends Exception { } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/exceptions/UnsupportedPolicy.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/e0000644000175000017500000000231110625052352031664 0ustar godgod/* * 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.exceptions; /** * @author Stefano Maestri * * since 27/04/2007 */ public class UnsupportedPolicy extends Exception { } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/util/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/u0000755000175000017500000000000010755000254031703 5ustar godgod././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/util/PrimitiveAssertionWriter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/u0000644000175000017500000001036510625052352031714 0ustar godgod/* * 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.util; import java.io.ByteArrayOutputStream; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.ws.policy.Assertion; import org.apache.ws.policy.PrimitiveAssertion; /** * * @author Stefano Maestri, * */ public class PrimitiveAssertionWriter { private int num = 1; PrimitiveAssertionWriter() { } public static PrimitiveAssertionWriter newInstance() { return new PrimitiveAssertionWriter(); } public void writePrimitiveAssertion(PrimitiveAssertion assertion, ByteArrayOutputStream stream) throws XMLStreamException { XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(stream); writePrimitiveAssertion(assertion, writer); } public void writePrimitiveAssertion(PrimitiveAssertion assertion, XMLStreamWriter writer) throws XMLStreamException { QName qname = assertion.getName(); String writerPrefix = writer.getPrefix(qname.getNamespaceURI()); if (writerPrefix != null) { writer.writeStartElement(qname.getNamespaceURI(), qname.getLocalPart()); } else { String prefix = (qname.getPrefix() != null) ? qname.getPrefix() : generateNamespace(); writer.writeStartElement(prefix, qname.getLocalPart(), qname.getNamespaceURI()); writer.writeNamespace(prefix, qname.getNamespaceURI()); writer.setPrefix(prefix, qname.getNamespaceURI()); } Hashtable attributes = assertion.getAttributes(); writeAttributes(attributes, writer); String text = (String)assertion.getStrValue(); if (text != null) { writer.writeCharacters(text); } //A Primitive assertion can't have terms----to be verified List terms = assertion.getTerms(); writeTerms(terms, writer); writer.writeEndElement(); writer.flush(); } private void writeTerms(List terms, XMLStreamWriter writer) throws XMLStreamException { Iterator iterator = terms.iterator(); while (iterator.hasNext()) { Assertion assertion = (Assertion)iterator.next(); writePrimitiveAssertion((PrimitiveAssertion) assertion, writer); } } private void writeAttributes(Hashtable attributes, XMLStreamWriter writer) throws XMLStreamException { Iterator iterator = attributes.keySet().iterator(); while (iterator.hasNext()) { QName qname = (QName)iterator.next(); String value = (String)attributes.get(qname); String prefix = qname.getPrefix(); if (prefix != null) { writer.writeAttribute(prefix, qname.getNamespaceURI(), qname.getLocalPart(), value); } else { writer.writeAttribute(qname.getNamespaceURI(), qname.getLocalPart(), value); } } } private String generateNamespace() { return "ns" + num++; } }././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/deployer/P0000644000175000017500000002247710747701205031661 0ustar godgod/* * 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 java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.apache.ws.policy.AndCompositeAssertion; import org.apache.ws.policy.Assertion; import org.apache.ws.policy.Policy; import org.apache.ws.policy.PrimitiveAssertion; import org.apache.ws.policy.XorCompositeAssertion; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer; import org.jboss.ws.extensions.policy.deployer.domainAssertion.NopAssertionDeployer; 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; import org.jboss.ws.extensions.wsrm.policy.RM10PolicyAssertionDeployer; import org.jboss.ws.extensions.wsrm.policy.RM11PolicyAssertionDeployer; import org.jboss.ws.metadata.umdm.ExtensibleMetaData; /** * @author Stefano Maestri * * since 27/04/2007 */ public class PolicyDeployer { private final static Logger log = Logger.getLogger(PolicyDeployer.class); private static PolicyDeployer me; private Map domainDeployerMap = new HashMap(); static { me = new PolicyDeployer(); me.domainDeployerMap.put("http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd", WSSecurityAssertionDeployer.class); me.domainDeployerMap.put("http://docs.oasis-open.org/ws-rx/wsrmp/200702", RM11PolicyAssertionDeployer.class); me.domainDeployerMap.put("http://schemas.xmlsoap.org/ws/2005/02/rm/policy", RM10PolicyAssertionDeployer.class); } //hide constructor PolicyDeployer() { } public static PolicyDeployer getInstance() { return me; } //for test public static PolicyDeployer newInstance(Map customDomainMap) { PolicyDeployer instance = new PolicyDeployer(); instance.domainDeployerMap = customDomainMap; return instance; } //for tools public static PolicyDeployer newInstanceForTools() { PolicyDeployer instance = new PolicyDeployer(); instance.domainDeployerMap.put("http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd", NopAssertionDeployer.class); instance.domainDeployerMap.put("http://docs.oasis-open.org/ws-rx/wsrmp/200702", NopAssertionDeployer.class); instance.domainDeployerMap.put("http://schemas.xmlsoap.org/ws/2005/02/rm/policy", NopAssertionDeployer.class); return instance; } @SuppressWarnings("unchecked") public Policy deployServerside(Policy policy, ExtensibleMetaData extMetaData) throws UnsupportedPolicy { if (policy == null) throw new WSException("Cannot deploy null policy!"); List returnedPolicyTerms = new LinkedList(); if (!policy.isNormalized()) { policy = (Policy)policy.normalize(); } //in normal form we have just one wsp:ExactlyOne element containg unbounded wsp:All (alternative) XorCompositeAssertion exactlyOne = (XorCompositeAssertion)policy.getTerms().get(0); log.debug("####" + exactlyOne.getClass()); log.debug("####" + exactlyOne.getTerms()); for (AndCompositeAssertion alternative : (List)exactlyOne.getTerms()) { log.debug("alternative"); try { deployAlternativeServerSide(alternative, extMetaData); returnedPolicyTerms.add(alternative); } catch (UnsupportedAlternative e) { log.debug("Unsupported Alternative"); //policy is unsupported only if it have all alternative unsupported } } if (returnedPolicyTerms.size() == 0) { if (log.isDebugEnabled()) { log.debug("XorComposite zero element...Policy not supported"); } throw new UnsupportedPolicy(); } policy.getTerms().clear(); policy.addTerms(returnedPolicyTerms); return policy; } /** * Policy deployer method for client side: delegates to the right domain deployer * and fails if one or more policy assertions are not supported. * * @param policy * @param extMetaData * @throws UnsupportedPolicy */ @SuppressWarnings("unchecked") public void deployClientSide(Policy policy, ExtensibleMetaData extMetaData) throws UnsupportedPolicy { if (policy == null) throw new WSException("Cannot deploy null policy!"); if (!policy.isNormalized()) { policy = (Policy)policy.normalize(); } //in normal form we have just one wsp:ExactlyOne element containg unbounded wsp:All (alternative) XorCompositeAssertion exactlyOne = (XorCompositeAssertion)policy.getTerms().get(0); for (AndCompositeAssertion alternative : (List)exactlyOne.getTerms()) { for (Assertion assertion : (List)alternative.getTerms()) { if (assertion instanceof PrimitiveAssertion) { try { deployAssertionClientSide((PrimitiveAssertion)assertion, extMetaData); } catch (UnsupportedAssertion e) { log.error("Unsupported assertion!"); throw new UnsupportedPolicy(); } } else if (assertion instanceof Policy) //inner policy to be verified { deployClientSide((Policy)assertion, extMetaData); } } } } @SuppressWarnings("unchecked") private void deployAlternativeServerSide(AndCompositeAssertion alternative, ExtensibleMetaData extMetaData) throws UnsupportedAlternative { for (Assertion assertion : (List)alternative.getTerms()) { try { if (assertion instanceof PrimitiveAssertion) { deployAssertionServerSide((PrimitiveAssertion)assertion, extMetaData); } else if (assertion instanceof Policy) //inner policy to be verified { deployServerside((Policy)assertion, extMetaData); } else { if (log.isDebugEnabled()) { log.debug("Unknown Alternative type....Alternative not supported"); } throw new UnsupportedAlternative(); } } catch (UnsupportedAssertion e) { //If there is al least one unsupported assertion the alternative isn't supported throw new UnsupportedAlternative(); } catch (UnsupportedPolicy ep) { //If there is al least one unsupported assertion the alternative isn't supported throw new UnsupportedAlternative(); } } } private void deployAssertionServerSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { AssertionDeployer deployer = getDomainDeployerInstance(assertion.getName().getNamespaceURI()); deployer.deployServerSide(assertion, extMetaData); } private void deployAssertionClientSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { AssertionDeployer deployer = getDomainDeployerInstance(assertion.getName().getNamespaceURI()); deployer.deployClientSide(assertion, extMetaData); } /** * * @param namespace * @return the correct AssertionDeployer instance, or null if namespace not supported */ private AssertionDeployer getDomainDeployerInstance(String namespace) throws UnsupportedAssertion { try { if (!domainDeployerMap.containsKey(namespace)) { if (log.isDebugEnabled()) { log.debug("Unknown namespace:" + namespace + "...Assertion not supported"); } throw new UnsupportedAssertion(); } return (AssertionDeployer)(domainDeployerMap.get(namespace)).newInstance(); } catch (Exception e) { throw new UnsupportedAssertion(); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/annotation/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/annotation0000755000175000017500000000000010755000254031766 5ustar godgod././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/annotation/Policy.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/annotation0000644000175000017500000000265410625052352032001 0ustar godgod/* * 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.annotation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import org.jboss.ws.extensions.policy.PolicyScopeLevel; /** * @author Stefano Maestri * * since 11/05/2007 */ @Retention(RetentionPolicy.RUNTIME) public @interface Policy { public String policyFileLocation(); public PolicyScopeLevel scope(); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/annotation/PolicyAttachment.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/annotation0000644000175000017500000000264710625052352032003 0ustar godgod/* * 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.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author Stefano Maestri * * since 11/05/2007 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface PolicyAttachment { Policy[] value(); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/Policy.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/Policy.jav0000644000175000017500000001246310650145103031637 0ustar godgod/* * 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; // $Id: Policy.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.Element; /** * At the abstract level a policy is a potentially empty collection of policy alternatives. A * policy with zero alternatives contains no choices; a policy with one or more alternatives * indicates choice in requirements (or capabilities) within the policy. * * Alternatives are not ordered, and thus aspects such as preferences between alternatives * in a given context are beyond the scope of this specification. * * Alternatives within a policy may differ significantly in terms of the behaviors they * indicate. Conversely, alternatives within a policy may be very similar. In either case, the * value or suitability of an alternative is generally a function of the semantics of assertions * within the alternative. * * @author Thomas.Diesler@jboss.org * @since 13-Nov-2005 */ public class Policy { public static final String URI_POLICY = "http://schemas.xmlsoap.org/ws/2004/09/policy"; public static final String URI_SECURITY_UTILITY = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; // The target namespace private String targetNamespace; // The optional base URI private String baseURI; // The optional ID private String id; // The policy alternatives private Collection alternatives = new ArrayList(); // The namespace registry for the policy private NamespaceRegistry nsRegistry = new NamespaceRegistry(); // Hide constructor Policy() { } public NamespaceRegistry getNamespaceRegistry() { return nsRegistry; } public String getTargetNamespace() { return targetNamespace; } public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; } public String getBaseURI() { return baseURI; } public void setBaseURI(String baseURI) { this.baseURI = baseURI; } public String getID() { return id; } public void setID(String id) { this.id = id; } public void addPolicyAlternative(PolicyAlternative polAlternative) { alternatives.add(polAlternative); } public Collection getPolicyAlternatives() { return new ArrayList(alternatives); } public void clearPolicyAlternatives() { alternatives.clear(); } public Element toElement() { String xmlString = toXMLString(false); try { return DOMUtils.parse(xmlString); } catch (IOException ex) { throw new WSException("Cannot parse: " + xmlString, ex); } } public String toXMLString(boolean pretty) { if (pretty) { Element elPolicy = toElement(); return DOMWriter.printNode(elPolicy, true); } StringBuilder xmlBuffer = new StringBuilder(""); xmlBuffer.append(""); for (PolicyAlternative polAlternative : alternatives) { xmlBuffer.append(polAlternative.toXMLString(false)); } xmlBuffer.append(""); xmlBuffer.append(""); String xmlString = xmlBuffer.toString(); return xmlString; } public String toString() { return toXMLString(true); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/PolicyScopeLevel.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/PolicyScop0000644000175000017500000000353110625052352031706 0ustar godgod/* * 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; /** * When attaching a Policy to a WSDL element, a Policy Scope is implied for that attachment. * PolicyScopeLevel enumerates all kind of element a Policy can be attached to in wsdl 1.1. * * @author Alessio Soldano, * @since 3-May-2007 */ public enum PolicyScopeLevel { WSDL_SERVICE, //wsdl:service WSDL_PORT, //wsdl:port WSDL_PORT_TYPE, //wsdl:portType WSDL_BINDING, //wsdl:binding BINDING_OPERATION, //wsdl:binding/wsdl:operation PORT_TYPE_OPERATION, //wsdl:portType/wsdl:operation BINDING_OPERATION_INPUT, //wsdl:binding/wsdl:operation/wsdl:input PORT_TYPE_OPERATION_INPUT, //wsdl:portType/wsdl:operation/wsdl:input MESSAGE //wsdl:message } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/PolicyAlternative.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/PolicyAlte0000644000175000017500000001013310650145103031656 0ustar godgod/* * 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; //$Id: PolicyAlternative.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * A policy alternative is a potentially empty collection of policy assertions. An alternative * with zero assertions indicates no behaviors. An alternative with one or more assertions * indicates behaviors implied by those, and only those assertions. * * The vocabulary of a policy alternative is the set of all assertion types within the * alternative. The vocabulary of a policy is the set of all assertion types used in the policy. * An assertion whose type is part of the policy's vocabulary but is not included in an * alternative is explicitly prohibited by the alternative. * * Assertions within an alternative are not ordered, and thus aspects such as the order in * which behaviors (indicated by assertions) are applied to a subject are beyond the scope * of this specification. * * A policy alternative MAY contain multiple instances of an assertion type. Mechanisms for * determining the aggregate behavior indicated by the assertion instances (and their Post- * Schema-Validation Infoset (PSVI) content, if any) are specific to the assertion type. * * @author Thomas.Diesler@jboss.org * @since 13-Nov-2005 */ public class PolicyAlternative { private Collection assertions = new ArrayList(); // Hide constructor PolicyAlternative() { } static PolicyAlternative parse(Element elAll) { // Work with a cloned copy, so parsing does not effect in input node elAll = (Element)elAll.cloneNode(true); PolicyAlternative all = new PolicyAlternative(); Iterator it = DOMUtils.getChildElements(elAll); while (it.hasNext()) { Element el = (Element)it.next(); all.addPolicyAssertion(new PolicyAssertion(el)); } return all; } public void addPolicyAssertion(PolicyAssertion polAssertion) { assertions.add(polAssertion); } public Collection getPolicyAssertions() { return new ArrayList(assertions); } public Element toElement() { String xmlString = toXMLString(false); try { return DOMUtils.parse(xmlString); } catch (IOException ex) { throw new WSException("Cannot parse: " + xmlString, ex); } } public String toXMLString(boolean pretty) { if (pretty) { Element elAll = toElement(); return DOMWriter.printNode(elAll, true); } StringBuilder xmlBuffer = new StringBuilder(""); for (PolicyAssertion assertion : assertions) { xmlBuffer.append(assertion.toXMLString(false)); } xmlBuffer.append(""); return xmlBuffer.toString(); } public String toString() { return toXMLString(true); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/PolicyAssertion.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/PolicyAsse0000644000175000017500000000617310650145103031675 0ustar godgod/* * 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; //$Id: PolicyAssertion.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * A policy assertion identifies a behavior that is a requirement (or capability) of a policy * subject. Assertions indicate domain-specific (e.g., security, transactions) semantics and * are expected to be defined in separate, domain-specific specifications. * * Assertions are strongly typed. The type is identified only by the XML Infoset * [namespace name] and [local name] properties (that is, the qualified name or * QName) of the root Element Information Item representing the assertion. Assertions of * a given type MUST be consistently interpreted independent of their policy subjects. * * The XML Infoset of an assertion MAY contain a non-empty [attributes] property and/or * a non-empty [children] property. Such content MAY be used to parameterize the * behavior indicated by the assertion. For example, an assertion identifying support for a * specific reliable messaging mechanism might include an Attribute Information Item to * indicate how long an endpoint will wait before sending an acknowledgement. However, * additional assertion content is not required when the identity of the root Element * Information Item alone is enough to convey the requirement (capability). * * @author Thomas.Diesler@jboss.org * @since 13-Nov-2005 */ public class PolicyAssertion { private Element assertionElement; private String nameSpace; PolicyAssertion(Element element) { Document doc = DOMUtils.getOwnerDocument(); this.assertionElement = (Element)doc.adoptNode(element); this.nameSpace = assertionElement.getNamespaceURI(); } public Element getElement() { return assertionElement; } public String toXMLString(boolean pretty) { return DOMWriter.printNode(assertionElement, pretty); } public String toString() { return toXMLString(true); } public String getNameSpace() { return nameSpace; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/PolicyFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/policy/PolicyFact0000644000175000017500000000735610650145103031663 0ustar godgod/* * 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; // $Id: PolicyFactory.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * A factory for Policy construction * * @author Thomas.Diesler@jboss.org * @since 13-Nov-2005 */ public class PolicyFactory { // PolicyFactory Singelton private static PolicyFactory factory = new PolicyFactory(); // Hide constructor private PolicyFactory() { } public static PolicyFactory newInstance() { return factory; } public Policy createPolicy(String strPolicy) { try { return createPolicy(DOMUtils.parse(strPolicy)); } catch (IOException ex) { throw new IllegalArgumentException("Cannot parse: " + strPolicy, ex); } } public Policy createPolicy(Element elPolicy) { // Work with a cloned copy, so parsing does not effect in input node elPolicy = (Element)elPolicy.cloneNode(true); Policy policy = new Policy(); policy.setTargetNamespace(DOMUtils.getAttributeValue(elPolicy, "TargetNamespace")); policy.setBaseURI(DOMUtils.getAttributeValue(elPolicy, "xml:base")); policy.setID(DOMUtils.getAttributeValue(elPolicy, new QName(Policy.URI_SECURITY_UTILITY, "Id"))); // Register namespaces NamedNodeMap attribs = elPolicy.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attr = (Attr)attribs.item(i); String attrName = attr.getName(); String attrValue = attr.getValue(); if (attrName.startsWith("xmlns:")) { String prefix = attrName.substring(6); policy.getNamespaceRegistry().registerURI(attrValue, prefix); } } // Parse wsp:ExactlyOne QName oneQName = new QName(Policy.URI_POLICY, "ExactlyOne"); Element elExactlyOne = DOMUtils.getFirstChildElement(elPolicy, oneQName); if (elExactlyOne == null) throw new WSException("Cannot find child element: " + oneQName); // Parse wsp:All QName allQName = new QName(Policy.URI_POLICY, "All"); Element elAll = DOMUtils.getFirstChildElement(elExactlyOne, allQName); if (elAll == null) throw new WSException("Cannot find child element: " + allQName); Iterator it = DOMUtils.getChildElements(elExactlyOne, allQName); while (it.hasNext()) { elAll = (Element)it.next(); PolicyAlternative all = PolicyAlternative.parse(elAll); policy.addPolicyAlternative(all); } return policy; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/0000755000175000017500000000000010755000255030520 5ustar godgod././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/metadata/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/metada0000755000175000017500000000000010755000254031673 5ustar godgod././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/metadata/AddressingOpMetaExt.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/metada0000644000175000017500000000365410542776150031716 0ustar godgod/* * 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.addressing.metadata; // $Id: AddressingOpMetaExt.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import org.jboss.ws.metadata.umdm.MetaDataExtension; /** * Addressing meta data extensions: *

        *
      • wsa:Action attribute *
      * @author Heiko Braun, * @since 17-Mar-2006 */ public class AddressingOpMetaExt extends MetaDataExtension { private String inboundAction; private String outboundAction; public AddressingOpMetaExt(String extensionNameSpace) { super(extensionNameSpace); } public String getInboundAction() { return inboundAction; } public void setInboundAction(String inboundAction) { this.inboundAction = inboundAction; } public String getOutboundAction() { return outboundAction; } public void setOutboundAction(String outboundAction) { this.outboundAction = outboundAction; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxrpc/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxrpc0000755000175000017500000000000010755000254031727 5ustar godgod././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingServerHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxrpc0000644000175000017500000001341210633763770031750 0ustar godgod/* * 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.addressing.jaxrpc; import java.net.URISyntaxException; import java.util.Set; import java.util.HashSet; import javax.xml.namespace.QName; import javax.xml.rpc.handler.GenericHandler; import javax.xml.rpc.handler.HandlerInfo; import javax.xml.rpc.handler.MessageContext; import javax.xml.rpc.handler.soap.SOAPMessageContext; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.addressing.soap.SOAPAddressingBuilder; import javax.xml.ws.addressing.soap.SOAPAddressingProperties; import org.jboss.logging.Logger; import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC; import org.jboss.ws.extensions.addressing.AddressingConstantsImpl; import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * A server side handler that reads/writes the addressing properties * and puts then into the message context. * * @author Thomas.Diesler@jboss.org * @since 24-Nov-2005 */ public class WSAddressingServerHandler extends GenericHandler { // Provide logging private static Logger log = Logger.getLogger(WSAddressingServerHandler.class); private static AddressingBuilder ADDR_BUILDER; private static AddressingConstantsImpl ADDR_CONSTANTS; private static QName[] HEADERS = new QName[2]; static { ADDR_CONSTANTS = new AddressingConstantsImpl(); ADDR_BUILDER = AddressingBuilder.getAddressingBuilder(); HEADERS[0] = ADDR_CONSTANTS.getActionQName(); HEADERS[1] = ADDR_CONSTANTS.getToQName(); } public QName[] getHeaders() { return HEADERS; } public void init(HandlerInfo handlerInfo) { super.init(handlerInfo); } /** * Read the addressing headers from the incomming message and put a * SOAPAddressingProperties object into the message context */ public boolean handleRequest(MessageContext msgContext) { if(log.isDebugEnabled()) log.debug("handleRequest"); SOAPAddressingProperties addrProps = (SOAPAddressingProperties)ADDR_BUILDER.newAddressingProperties(); SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); addrProps.readHeaders(soapMessage); msgContext.setProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, addrProps); return true; } /** * Get a SOAPAddressingProperties object from the message context * and write the adressing headers */ public boolean handleResponse(MessageContext msgContext) { if(log.isDebugEnabled()) log.debug("handleResponse"); handleResponseOrFault(msgContext, false); return true; } /** * Get a SOAPAddressingProperties object from the message context * and write the adressing headers */ public boolean handleFault(MessageContext msgContext) { if(log.isDebugEnabled()) log.debug("handleFault"); handleResponseOrFault(msgContext, true); return true; } private void handleResponseOrFault(MessageContext msgContext, boolean isFault) { SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder(); SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); SOAPAddressingProperties inProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND); SOAPAddressingProperties outProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND); if (outProps == null) { // create new response properties outProps = (SOAPAddressingProperties)builder.newAddressingProperties(); msgContext.setProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, outProps); } outProps.initializeAsReply(inProps, isFault); try { // supply the response action OperationMetaData opMetaData = ((SOAPMessageContextJAXRPC)msgContext).getOperationMetaData(); if (!isFault && !opMetaData.isOneWay()) { AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI()); if (addrExt != null) { outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction())); } else { log.warn("Unable to resolve replyAction for " + opMetaData.getQName()); } } else if (isFault) { outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction())); } } catch (URISyntaxException e) { log.error("Error setting response action", e); } outProps.writeHeaders(soapMessage); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxrpc/WSAddressingClientHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxrpc0000644000175000017500000001072410703122770031736 0ustar godgod/* * 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.addressing.jaxrpc; import javax.xml.namespace.QName; import javax.xml.rpc.handler.GenericHandler; import javax.xml.rpc.handler.HandlerInfo; import javax.xml.rpc.handler.MessageContext; import javax.xml.rpc.handler.soap.SOAPMessageContext; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingException; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.addressing.soap.SOAPAddressingBuilder; import javax.xml.ws.addressing.soap.SOAPAddressingProperties; import org.jboss.logging.Logger; import org.jboss.ws.extensions.addressing.AddressingConstantsImpl; import org.jboss.ws.extensions.addressing.soap.SOAPAddressingPropertiesImpl; /** * A client side handler that reads/writes the addressing properties * and puts then into the message context. * * @author Thomas.Diesler@jboss.org * @since 24-Nov-2005 */ public class WSAddressingClientHandler extends GenericHandler { // Provide logging private static Logger log = Logger.getLogger(WSAddressingClientHandler.class); private static AddressingBuilder ADDR_BUILDER; private static AddressingConstantsImpl ADDR_CONSTANTS; private static QName[] HEADERS = new QName[2]; static { ADDR_CONSTANTS = new AddressingConstantsImpl(); ADDR_BUILDER = AddressingBuilder.getAddressingBuilder(); HEADERS[0] = ADDR_CONSTANTS.getActionQName(); HEADERS[1] = ADDR_CONSTANTS.getToQName(); } public QName[] getHeaders() { return HEADERS; } public void init(HandlerInfo handlerInfo) { super.init(handlerInfo); } public boolean handleRequest(MessageContext msgContext) { log.debug("handleRequest"); SOAPAddressingProperties addrProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES); if (addrProps != null) msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps); addrProps = (SOAPAddressingProperties)msgContext.getProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND); if (addrProps != null) { SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); addrProps.writeHeaders(soapMessage); } else { // supply default addressing properties addrProps = (SOAPAddressingPropertiesImpl)ADDR_BUILDER.newAddressingProperties(); msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps); } return true; } public boolean handleResponse(MessageContext msgContext) { log.debug("handleResponse"); try { SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); if (soapMessage.getSOAPPart().getEnvelope() != null) { SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder(); SOAPAddressingProperties addrProps = (SOAPAddressingProperties)builder.newAddressingProperties(); addrProps.readHeaders(soapMessage); msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps); msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, addrProps); } } catch (SOAPException ex) { throw new AddressingException("Cannot handle response", ex); } return true; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxws/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxws/0000755000175000017500000000000010755000255031654 5ustar godgod././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxws/WSAddressingServerHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxws/0000644000175000017500000001334510650145103031660 0ustar godgod/* * 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.addressing.jaxws; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler; import org.jboss.ws.extensions.addressing.AddressingConstantsImpl; import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt; import org.jboss.ws.metadata.umdm.OperationMetaData; import javax.xml.namespace.QName; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.addressing.soap.SOAPAddressingBuilder; import javax.xml.ws.addressing.soap.SOAPAddressingProperties; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.MessageContext.Scope; import javax.xml.ws.handler.soap.SOAPMessageContext; import java.net.URISyntaxException; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** * A server side handler that reads/writes the addressing properties * and puts then into the message context. * * @author Thomas.Diesler@jboss.org * @author Heiko.Braun@jboss.com * @since 24-Nov-2005 */ public class WSAddressingServerHandler extends GenericSOAPHandler { // Provide logging private static Logger log = Logger.getLogger(WSAddressingServerHandler.class); private static AddressingBuilder ADDR_BUILDER; private static AddressingConstantsImpl ADDR_CONSTANTS; private static Set HEADERS = new HashSet(); static { ADDR_CONSTANTS = new AddressingConstantsImpl(); ADDR_BUILDER = AddressingBuilder.getAddressingBuilder(); HEADERS.add( ADDR_CONSTANTS.getActionQName()); HEADERS.add( ADDR_CONSTANTS.getToQName()); } public Set getHeaders() { return Collections.unmodifiableSet(HEADERS); } protected boolean handleInbound(MessageContext msgContext) { if(log.isDebugEnabled()) log.debug("handleInbound"); SOAPAddressingProperties addrProps = (SOAPAddressingProperties)ADDR_BUILDER.newAddressingProperties(); SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); addrProps.readHeaders(soapMessage); msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, addrProps); msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, Scope.APPLICATION); return true; } protected boolean handleOutbound(MessageContext msgContext) { if(log.isDebugEnabled()) log.debug("handleOutbound"); handleResponseOrFault(msgContext, false); return true; } /** * Get a SOAPAddressingProperties object from the message context * and write the adressing headers */ public boolean handleFault(MessageContext msgContext) { if(log.isDebugEnabled()) log.debug("handleFault"); handleResponseOrFault(msgContext, true); return true; } private void handleResponseOrFault(MessageContext msgContext, boolean isFault) { SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder(); SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); SOAPAddressingProperties inProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND); SOAPAddressingProperties outProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND); if (outProps == null) { // create new response properties outProps = (SOAPAddressingProperties)builder.newAddressingProperties(); msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, outProps); msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION); } outProps.initializeAsReply(inProps, isFault); try { // supply the response action OperationMetaData opMetaData = ((CommonMessageContext)msgContext).getOperationMetaData(); if (!isFault && !opMetaData.isOneWay()) { AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI()); if (addrExt != null) { outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction())); } else { log.warn("Unable to resolve replyAction for " + opMetaData.getQName()); } } else if (isFault) { outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction())); } } catch (URISyntaxException e) { log.error("Error setting response action", e); } outProps.writeHeaders(soapMessage); } /* check wsa formal constraints */ private void validateRequest(SOAPAddressingProperties addrProps) { // If wsa:ReplyTo is supplied and the message lacks a [message id] property, the processor MUST fault. if (addrProps.getReplyTo() != null && addrProps.getMessageID() == null) throw new IllegalArgumentException("wsa:MessageId is required when wsa:ReplyTo is supplied"); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxws/WSAddressingClientHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/jaxws/0000644000175000017500000001134010703122770031655 0ustar godgod/* * 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.addressing.jaxws; import org.jboss.logging.Logger; import org.jboss.ws.extensions.addressing.AddressingConstantsImpl; import org.jboss.ws.extensions.addressing.soap.SOAPAddressingPropertiesImpl; import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler; import javax.xml.namespace.QName; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingException; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.addressing.soap.SOAPAddressingBuilder; import javax.xml.ws.addressing.soap.SOAPAddressingProperties; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.MessageContext.Scope; import javax.xml.ws.handler.soap.SOAPMessageContext; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** * A client side handler that reads/writes the addressing properties * and puts then into the message context. * * @author Thomas.Diesler@jboss.org * @author Heiko.Braun@jboss.com * @since 24-Nov-2005 */ public class WSAddressingClientHandler extends GenericSOAPHandler { // Provide logging private static Logger log = Logger.getLogger(WSAddressingClientHandler.class); private static AddressingBuilder ADDR_BUILDER; private static AddressingConstantsImpl ADDR_CONSTANTS; private static Set HEADERS = new HashSet(); static { ADDR_CONSTANTS = new AddressingConstantsImpl(); ADDR_BUILDER = AddressingBuilder.getAddressingBuilder(); HEADERS.add( ADDR_CONSTANTS.getActionQName()); HEADERS.add( ADDR_CONSTANTS.getToQName()); } public Set getHeaders() { return Collections.unmodifiableSet(HEADERS); } protected boolean handleOutbound(MessageContext msgContext) { log.debug("handleOutbound"); SOAPAddressingProperties addrProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES); if (addrProps != null) { msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps); msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION); } addrProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND); if (addrProps != null) { SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); addrProps.writeHeaders(soapMessage); } else { // supply default addressing properties addrProps = (SOAPAddressingPropertiesImpl)ADDR_BUILDER.newAddressingProperties(); msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps); msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION); } return true; } protected boolean handleInbound(MessageContext msgContext) { log.debug("handleInbound"); try { SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); if (soapMessage.getSOAPPart().getEnvelope() != null) { SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder(); SOAPAddressingProperties addrProps = (SOAPAddressingProperties)builder.newAddressingProperties(); addrProps.readHeaders(soapMessage); msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps); msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, Scope.APPLICATION); msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, addrProps); msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, Scope.APPLICATION); } } catch (SOAPException ex) { throw new AddressingException("Cannot handle response", ex); } return true; } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/soap/0000755000175000017500000000000010755000255031462 5ustar godgod././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/soap/SOAPAddressingBuilderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/soap/S0000644000175000017500000000572010542776150031623 0ustar godgod/* * 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.addressing.soap; //$Id: SOAPAddressingBuilderImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.net.URI; import java.net.URISyntaxException; import javax.xml.namespace.QName; import javax.xml.ws.addressing.AddressingConstants; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.AttributedQName; import javax.xml.ws.addressing.AttributedURI; import javax.xml.ws.addressing.EndpointReference; import javax.xml.ws.addressing.Relationship; import javax.xml.ws.addressing.soap.SOAPAddressingBuilder; import org.jboss.ws.extensions.addressing.AddressingConstantsImpl; import org.jboss.ws.extensions.addressing.AddressingTypeImpl; import org.jboss.ws.extensions.addressing.AttributedQNameImpl; import org.jboss.ws.extensions.addressing.AttributedURIImpl; import org.jboss.ws.extensions.addressing.EndpointReferenceImpl; import org.jboss.ws.extensions.addressing.RelationshipImpl; /** * Factory for AddressingElements. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class SOAPAddressingBuilderImpl extends SOAPAddressingBuilder { public AttributedURI newURI(URI uri) { return new AttributedURIImpl(uri); } public AttributedURI newURI(String uri) throws URISyntaxException { return newURI(new URI(uri)); } public AttributedQName newQName(QName name) { return new AttributedQNameImpl(name); } public Relationship newRelationship(URI uri) { return new RelationshipImpl(uri); } public EndpointReference newEndpointReference(URI uri) { return new EndpointReferenceImpl(uri); } public AddressingProperties newAddressingProperties() { return new SOAPAddressingPropertiesImpl(); } public AddressingConstants newAddressingConstants() { return new AddressingConstantsImpl(); } public String getNamespaceURI() { return new AddressingTypeImpl().getNamespaceURI(); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/soap/S0000644000175000017500000003145110650145103031607 0ustar godgod/* * 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.addressing.soap; //$Id: SOAPAddressingPropertiesImpl.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import org.jboss.ws.core.soap.NameImpl; import org.jboss.ws.core.soap.SOAPFactoryImpl; import org.jboss.ws.extensions.addressing.AddressingConstantsImpl; import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl; import org.jboss.ws.extensions.addressing.EndpointReferenceImpl; import org.jboss.wsf.common.DOMUtils; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import javax.xml.namespace.QName; import javax.xml.soap.*; import javax.xml.ws.addressing.*; import javax.xml.ws.addressing.soap.SOAPAddressingBuilder; import javax.xml.ws.addressing.soap.SOAPAddressingProperties; import java.lang.reflect.Array; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Subimplementation of AddressingProperties includes methods that * read and write the Message Addressing Properties to a SOAPMessage. * All individual properties must implement SOAPAddressingElement. * * @See http://www.w3.org/TR/ws-addr-core/ * * @author Thomas.Diesler@jboss.org * @since 15-Nov-2005 */ public class SOAPAddressingPropertiesImpl extends AddressingPropertiesImpl implements SOAPAddressingProperties { private static AddressingConstants ADDR = new AddressingConstantsImpl(); private NamespaceRegistry nsRegistry = new NamespaceRegistry(); private boolean mustunderstand; private String getRequiredHeaderContent(SOAPHeader soapHeader, QName qname) { Element element = DOMUtils.getFirstChildElement(soapHeader, qname); if(null == element) throw new AddressingException("Required element "+qname+" is missing"); String value = DOMUtils.getTextContent(element); if(null == value || value.equals("")) throw new AddressingException("Required element "+qname+" is missing"); return value; } private String getOptionalHeaderContent(SOAPHeader soapHeader, QName qname) { Element element = DOMUtils.getFirstChildElement(soapHeader, qname); if (element != null) { return DOMUtils.getTextContent(element); } return null; } public void readHeaders(SOAPMessage message) throws AddressingException { try { SOAPHeader soapHeader = message.getSOAPHeader(); SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl(); AddressingConstants ADDR = builder.newAddressingConstants(); registerNamespaces(ADDR, soapHeader); // wsa:To // This OPTIONAL element provides the value for the [destination] property. // If this element is NOT present then the value of the [destination] // property is "http://www.w3.org/2005/08/addressing/anonymous". String to = getOptionalHeaderContent(soapHeader, ADDR.getToQName()); if(to!=null) setTo(builder.newURI(to)); // Read wsa:From // This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value for the [source endpoint] property. Element wsaFrom = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFromQName()); if (wsaFrom != null) { EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFrom); setReplyTo(ref); } // Read wsa:ReplyTo // This OPTIONAL element provides the value for the [reply endpoint] property. // If this element is NOT present then the value of the [address] property of the [reply endpoint] // EPR is "http://www.w3.org/2005/08/addressing/anonymous". Element wsaReplyTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getReplyToQName()); if (wsaReplyTo != null) { EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaReplyTo); setReplyTo(ref); } // Read wsa:FaultTo // This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value for the [fault endpoint] property. // If this element is present, wsa:MessageID MUST be present. Element wsaFaultTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFaultToQName()); if (wsaFaultTo != null) { EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFaultTo); setFaultTo(ref); } // wsa:Action // This REQUIRED element of type xs:anyURI conveys the [action] property. // The [children] of this element convey the value of this property. String action = getRequiredHeaderContent(soapHeader, ADDR.getActionQName()); setAction(builder.newURI(action)); // Read wsa:MessageID // This OPTIONAL element (whose content is of type xs:anyURI) conveys the [message id] property. String messageID = getOptionalHeaderContent(soapHeader, ADDR.getMessageIDQName()); if(messageID!=null) setMessageID(builder.newURI(messageID)); // Read wsa:RelatesTo // This OPTIONAL attribute conveys the relationship type as an IRI. // When absent, the implied value of this attribute is "http://www.w3.org/2005/08/addressing/reply". Iterator itRelatesTo = DOMUtils.getChildElements(soapHeader, ADDR.getRelatesToQName()); List relList = new ArrayList(); while (itRelatesTo.hasNext()) { Element wsaRelatesTo = (Element)itRelatesTo.next(); QName type = DOMUtils.getAttributeValueAsQName(wsaRelatesTo, ADDR.getRelationshipTypeName()); String uri = DOMUtils.getTextContent(wsaRelatesTo); Relationship rel = builder.newRelationship(new URI(uri)); rel.setType(type); relList.add(rel); } Relationship[] relArr = (Relationship[])Array.newInstance(Relationship.class, relList.size()); relList.toArray(relArr); setRelatesTo(relArr); // Read wsa:ReferenceParameters QName refQName = new QName(getNamespaceURI(), "IsReferenceParameter"); ReferenceParameters refParams = getReferenceParameters(); Iterator it = soapHeader.examineAllHeaderElements(); while (it.hasNext()) { SOAPHeaderElement headerElement = (SOAPHeaderElement)it.next(); if ("true".equals(DOMUtils.getAttributeValue(headerElement, refQName))) { refParams.addElement(headerElement); } } } catch (SOAPException ex) { throw new AddressingException("Cannot read headers", ex); } catch (URISyntaxException ex) { throw new AddressingException("Cannot read headers", ex); } } private void registerNamespaces(AddressingConstants ADDR, SOAPHeader soapHeader) { // Register wsa namespace nsRegistry.registerURI(ADDR.getNamespaceURI(), ADDR.getNamespacePrefix()); // Register namespaces NamedNodeMap attribs = soapHeader.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attr = (Attr)attribs.item(i); String attrName = attr.getName(); String attrValue = attr.getValue(); if (attrName.startsWith("xmlns:")) { String prefix = attrName.substring(6); nsRegistry.registerURI(attrValue, prefix); } } } public void writeHeaders(SOAPMessage message) throws AddressingException { try { SOAPFactoryImpl factory = (SOAPFactoryImpl)SOAPFactory.newInstance(); SOAPHeader soapHeader = message.getSOAPHeader(); // Add the xmlns:wsa declaration soapHeader.addNamespaceDeclaration(ADDR.getNamespacePrefix(), ADDR.getNamespaceURI()); // Write wsa:To if (getTo() != null) { SOAPElement element = soapHeader.addChildElement(new NameImpl(ADDR.getToQName())); element.addTextNode(getTo().getURI().toString()); } // Write wsa:From if (getFrom() != null) { EndpointReferenceImpl epr = (EndpointReferenceImpl)getFrom(); epr.setRootQName(ADDR.getFromQName()); SOAPElement soapElement = factory.createElement(epr.toElement()); soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix()); soapHeader.addChildElement(soapElement); } // Write wsa:ReplyTo if (getReplyTo() != null) { EndpointReferenceImpl epr = (EndpointReferenceImpl)getReplyTo(); epr.setRootQName(ADDR.getReplyToQName()); SOAPElement soapElement = factory.createElement(epr.toElement()); soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix()); soapHeader.addChildElement(soapElement); } // Write wsa:FaultTo if (getFaultTo() != null) { EndpointReferenceImpl epr = (EndpointReferenceImpl)getFaultTo(); epr.setRootQName(ADDR.getFaultToQName()); SOAPElement soapElement = factory.createElement(epr.toElement()); soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix()); soapHeader.addChildElement(soapElement); } appendRequiredHeader(soapHeader, ADDR.getActionQName(), getAction()); // Write wsa:MessageID if( (getReplyTo()!=null || getFaultTo()!=null) && null==getMessageID()) { throw new AddressingException("Required addressing header missing:" + ADDR.getMessageIDQName()); } else if (getMessageID() != null) { SOAPElement wsaMessageId = soapHeader.addChildElement(new NameImpl(ADDR.getMessageIDQName())); wsaMessageId.addTextNode(getMessageID().getURI().toString()); } // Write wsa:RelatesTo if (getRelatesTo() != null) { for (Relationship rel : getRelatesTo()) { SOAPElement wsaRelatesTo = soapHeader.addChildElement(new NameImpl(ADDR.getRelatesToQName())); if (rel.getType() != null) { wsaRelatesTo.setAttribute(ADDR.getRelationshipTypeName(), getPrefixedName(rel.getType())); } wsaRelatesTo.addTextNode(rel.getID().toString()); } } // Write wsa:ReferenceParameters ReferenceParameters refParams = getReferenceParameters(); if (refParams.getElements().size() > 0 || refParams.getAttributes().size() > 0) { SOAPElement wsaRefParams = soapHeader.addChildElement(new NameImpl(ADDR.getReferenceParametersQName())); appendAttributes(wsaRefParams, refParams.getAttributes()); appendElements(wsaRefParams, refParams.getElements()); } appendElements(soapHeader, getElements()); } catch (SOAPException ex) { throw new AddressingException("Cannot read ws-addressing headers", ex); } } private void appendRequiredHeader(SOAPHeader soapHeader, QName name, AttributedURI value) throws SOAPException { if(null == value) throw new AddressingException("Required addressing property missing: " + name); SOAPElement element = soapHeader.addChildElement(new NameImpl(name)); element.addTextNode(value.getURI().toString()); if(mustunderstand) { // add soap:mustUnderstand=1 String envNS = soapHeader.getParentElement().getNamespaceURI(); element.addNamespaceDeclaration("soap", envNS); element.addAttribute(new QName(envNS, "mustUnderstand", "soap"), "1"); } } public void setMu(boolean mu) { this.mustunderstand = mu; } private void appendAttributes(SOAPElement soapElement, Map attributes) { for (QName qname : attributes.keySet()) { String qualname = getPrefixedName(qname); String value = attributes.get(qname); soapElement.setAttribute(qualname, value); } } private void appendElements(SOAPElement soapElement, List elements) { try { SOAPFactoryImpl factory = (SOAPFactoryImpl)SOAPFactory.newInstance(); for (Object obj : elements) { if (obj instanceof Element) { SOAPElement child = factory.createElement((Element)obj); soapElement.addChildElement(child); } else if (obj instanceof String) { Element el = DOMUtils.parse((String)obj); SOAPElement child = factory.createElement(el); soapElement.addChildElement(child); } else { throw new AddressingException("Unsupported element: " + obj.getClass().getName()); } } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new AddressingException("Cannot append elements", ex); } } private String getPrefixedName(QName qname) { String prefix = qname.getPrefix(); String localPart = qname.getLocalPart(); String qualname = (prefix != null && prefix.length() > 0 ? prefix + ":" + localPart : localPart); return qualname; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/MetadataImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Metada0000644000175000017500000000255710542776150031657 0ustar godgod/* * 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.addressing; //$Id: MetadataImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.ws.addressing.Metadata; /** * Abstraction of Metadata bucket in an EndpointReference. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class MetadataImpl extends AttributeElementExtensibleImpl implements Metadata { } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AttributeElementExtensibleImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Attrib0000644000175000017500000000474610542776150031713 0ustar godgod/* * 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.addressing; //$Id: AttributeElementExtensibleImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.ws.addressing.AddressingException; import javax.xml.ws.addressing.AddressingType; import javax.xml.ws.addressing.AttributeExtensible; import javax.xml.ws.addressing.ElementExtensible; /** * Used to represent Addressing classes that support collections of arbitrary XML Elements. * Used to represent Addressing classes that support extensibility attributes. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class AttributeElementExtensibleImpl implements AttributeExtensible, ElementExtensible, AddressingType { private AttributeExtensible attrExt = new AttributeExtensibleImpl(); private ElementExtensible elmtExt = new ElementExtensibleImpl(); public Map getAttributes() { return attrExt.getAttributes(); } public void addAttribute(QName name, String value) throws AddressingException { attrExt.addAttribute(name, value); } public List getElements() { return elmtExt.getElements(); } public void addElement(Object element) { elmtExt.addElement(element); } public boolean removeElement(Object element) { return elmtExt.removeElement(element); } public String getNamespaceURI() { return new AddressingTypeImpl().getNamespaceURI(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AddressingConstantsImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Addres0000644000175000017500000001207010542776150031655 0ustar godgod/* * 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.addressing; //$Id: AddressingConstantsImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.ws.addressing.AddressingConstants; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; /** * Encapsulation for version-specific WS-Addressing constants. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class AddressingConstantsImpl implements AddressingConstants { static final String URI_ADDRESSING = "http://www.w3.org/2005/08/addressing"; static final String PREFIX_ADDRESSING = "wsa"; public String getNamespaceURI() { return URI_ADDRESSING; } public String getNamespacePrefix() { return PREFIX_ADDRESSING; } public String getWSDLNamespaceURI() { return Constants.NS_WSDL11; } public String getWSDLNamespacePrefix() { return Constants.PREFIX_WSDL; } public QName getWSDLExtensibilityQName() { return null; } public QName getWSDLActionQName() { return new QName(URI_ADDRESSING, "Action", "wsa"); } public String getAnonymousURI() { return "http://www.w3.org/2005/08/addressing/anonymous"; } public String getNoneURI() { return "http://www.w3.org/2005/08/addressing/none"; } public QName getFromQName() { return new QName(URI_ADDRESSING, "From", PREFIX_ADDRESSING); } public QName getToQName() { return new QName(URI_ADDRESSING, "To", PREFIX_ADDRESSING); } public QName getReplyToQName() { return new QName(URI_ADDRESSING, "ReplyTo", PREFIX_ADDRESSING); } public QName getFaultToQName() { return new QName(URI_ADDRESSING, "FaultTo", PREFIX_ADDRESSING); } public QName getActionQName() { return new QName(URI_ADDRESSING, "Action", PREFIX_ADDRESSING); } public QName getMessageIDQName() { return new QName(URI_ADDRESSING, "MessageID", PREFIX_ADDRESSING); } public QName getRelationshipReplyQName() { return new QName(URI_ADDRESSING, "Reply", PREFIX_ADDRESSING); } public QName getRelatesToQName() { return new QName(URI_ADDRESSING, "RelatesTo", PREFIX_ADDRESSING); } public String getRelationshipTypeName() { return "RelationshipType"; } public QName getMetadataQName() { return new QName(URI_ADDRESSING, "Metadata", PREFIX_ADDRESSING); } public QName getAddressQName() { return new QName(URI_ADDRESSING, "Address", PREFIX_ADDRESSING); } public QName getReferenceParametersQName() { return new QName(URI_ADDRESSING, "ReferenceParameters", PREFIX_ADDRESSING); } public String getPackageName() { return getClass().getPackage().getName(); } public String getIsReferenceParameterName() { throw new NotImplementedException(); } public QName getInvalidMapQName() { return new QName(URI_ADDRESSING, "InvalidMessageInformationHeader", PREFIX_ADDRESSING); } public QName getMapRequiredQName() { return new QName(URI_ADDRESSING, "MessageInformationHeaderRequired", PREFIX_ADDRESSING); } public QName getDestinationUnreachableQName() { return new QName(URI_ADDRESSING, "DestinationUnreachable", PREFIX_ADDRESSING); } public QName getActioNotSupportedQName() { return new QName(URI_ADDRESSING, "ActionNotSupported", PREFIX_ADDRESSING); } public QName getEndpointUnavailableQName() { return new QName(URI_ADDRESSING, "EndpointUnavailable", PREFIX_ADDRESSING); } public String getDefaultFaultAction() { return "http://www.w3.org/2005/08/addressing/fault"; } public String getActionNotSupportedText() { return "Action not supported"; } public String getDestinationUnreachableText() { return "Destination unreachable"; } public String getEndpointUnavailableText() { return "Endpoint unavailable"; } public String getInvalidMapText() { return "Invalid Map"; } public String getMapRequiredText() { return "Map Required"; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/ReferenceParametersImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Refere0000644000175000017500000000277310542776150031674 0ustar godgod/* * 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.addressing; import javax.xml.ws.addressing.ReferenceParameters; // $Id: ReferenceParametersImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * Abstraction of ReferenceParameters bucket in an * EndpointReference. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class ReferenceParametersImpl extends AttributeElementExtensibleImpl implements ReferenceParameters { public ReferenceParametersImpl() { super(); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AddressingTypeImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Addres0000644000175000017500000000270010542776150031654 0ustar godgod/* * 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.addressing; //$Id: AddressingTypeImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.ws.addressing.AddressingType; /** * Implemented by wrappers for types defined by WS-Addressing. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class AddressingTypeImpl implements AddressingType { public String getNamespaceURI() { return AddressingConstantsImpl.URI_ADDRESSING; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AttributeExtensibleImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Attrib0000644000175000017500000000345210542776150031704 0ustar godgod/* * 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.addressing; //$Id: AttributeExtensibleImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.ws.addressing.AddressingException; import javax.xml.ws.addressing.AttributeExtensible; /** * Used to represent Addressing classes that support extensibility attributes. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class AttributeExtensibleImpl extends AddressingTypeImpl implements AttributeExtensible { private Map extMap = new HashMap(); public Map getAttributes() { return extMap; } public void addAttribute(QName name, String value) throws AddressingException { extMap.put(name, value); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AttributedURIImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Attrib0000644000175000017500000000347510542776150031711 0ustar godgod/* * 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.addressing; //$Id: AttributedURIImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.net.URI; import java.net.URISyntaxException; import javax.xml.ws.addressing.AttributedURI; /** * Abstraction AttributedURIType defined in the normative WS-Addressing core schema. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class AttributedURIImpl extends AttributeExtensibleImpl implements AttributedURI { private URI uri; public AttributedURIImpl(URI uri) { this.uri = uri; } public AttributedURIImpl(String uri) { try { this.uri = new URI(uri); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex.toString()); } } public URI getURI() { return uri; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AttributedQNameImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Attrib0000644000175000017500000000315510542776150031704 0ustar godgod/* * 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.addressing; //$Id: AttributedQNameImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.ws.addressing.AttributedQName; /** * Abstraction of AttributedQNameType defined in the normative * WS-Addressing core schema. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class AttributedQNameImpl extends AttributeExtensibleImpl implements AttributedQName { private QName qname; public AttributedQNameImpl(QName qname) { this.qname = qname; } public QName getQName() { return qname; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Addres0000644000175000017500000002152010633271735031655 0ustar godgod/* * 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.addressing; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingConstants; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.AddressingType; import javax.xml.ws.addressing.AttributedURI; import javax.xml.ws.addressing.EndpointReference; import javax.xml.ws.addressing.ReferenceParameters; import javax.xml.ws.addressing.Relationship; // $Id: AddressingPropertiesImpl.java 3534 2007-06-11 16:10:05Z heiko.braun@jboss.com $ /** * Each instance is associated with a particular WS-Addressing schema whose * namespace URI is returned by its getAddressingVersion method. * * The namespace of each key in the underlying map must match this URI and the * local names of all the keys must be exactly the names of the Message Addressing Properties * defined in that version of the WS-Addressing specification. * * Each value in the underlying type must be an instance of AddressingType whose * WS-Addressing version (determined by its getAddressingVersion) method must * match the WS-Addressing version associated with the AddressingProperties. * * TODO: verify that AddressingPropertiesImpl can extend ElementExtensibleImpl. * See http://jira.jboss.com/jira/browse/JBWS-728 * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class AddressingPropertiesImpl extends ElementExtensibleImpl implements AddressingProperties { private static AddressingConstants ADDR = new AddressingConstantsImpl(); // A REQUIRED absolute URI representing the address of the intended receiver of this message. private AttributedURI to; // A REQUIRED absolute URI that uniquely identifies the semantics implied by this message. private AttributedURI action; // An OPTIONAL absolute URI that uniquely identifies the message. private AttributedURI messageId; // An OPTIONAL pair of values that indicate how this message relates to another message. private Relationship[] relatesTo; // An OPTIONAL endpoint reference for the intended receiver for replies to this message. private EndpointReference replyTo; // An OPTIONAL endpoint reference for the intended receiver for faults related to this message. private EndpointReference faultTo; // An OPTIONAL reference to the endpoint from which the message originated. private EndpointReference from; // Corresponds to the value of the [reference parameters] property of the endpoint reference to which the message is addressed. private ReferenceParameters refParams = new ReferenceParametersImpl(); private Map addrTypes = new HashMap(); private boolean initialized = false; public AttributedURI getTo() { return to; } public void setTo(AttributedURI to) { this.to = to; } public AttributedURI getAction() { return action; } public void setAction(AttributedURI action) { this.action = action; } public AttributedURI getMessageID() { return messageId; } public void setMessageID(AttributedURI iri) { this.messageId = iri; } public Relationship[] getRelatesTo() { return relatesTo; } public void setRelatesTo(Relationship[] relatesTo) { this.relatesTo = relatesTo; } public EndpointReference getReplyTo() { return replyTo; } public void setReplyTo(EndpointReference replyTo) { this.replyTo = replyTo; } public EndpointReference getFaultTo() { return faultTo; } public void setFaultTo(EndpointReference faultTo) { this.faultTo = faultTo; } public EndpointReference getFrom() { return from; } public void setFrom(EndpointReference from) { this.from = from; } public ReferenceParameters getReferenceParameters() { return refParams; } /** * Initializes the properties as a destination using the given * EndpointReference. The To property is initialized * using the Address property of the EndpointReference * and the ReferenceParameters property is initialized using the * ReferenceParameters property of the EndpointReference. * * @param epr The EndpointReference representing the destination. */ public void initializeAsDestination(EndpointReference epr) { if(initialized) return; if (epr == null) throw new IllegalArgumentException("Invalid null endpoint reference"); this.to = epr.getAddress(); ReferenceParameters srcParams = epr.getReferenceParameters(); for (Object obj : srcParams.getElements()) { SOAPElement soapElement = (SOAPElement)obj; soapElement.setAttributeNS(getNamespaceURI(), "wsa:IsReferenceParameter", "true"); addElement(soapElement); } this.initialized = true; } /** * Initialize this AddressingProperties as a reply to the * given message. As described in the WS-Addressing Core specification. * The ReplyTo property is using the Address * property of the source AddressingProperties and the * ReferenceParameters property is initialized using the * ReferenceParameters property of the source message. * * @param props The source AddressingProperties * @param isFault true if the reply is a Fault message. */ public void initializeAsReply(AddressingProperties props, boolean isFault) { if(initialized) return; EndpointReference epr = (isFault ? props.getFaultTo() : null); if (epr == null) { epr = props.getReplyTo(); } this.to = (epr != null ? epr.getAddress() : new AttributedURIImpl(ADDR.getAnonymousURI())); if (epr != null) { ReferenceParameters srcParams = epr.getReferenceParameters(); for (Object obj : srcParams.getElements()) { SOAPElement soapElement = (SOAPElement)obj; soapElement.setAttributeNS(getNamespaceURI(), "wsa:IsReferenceParameter", "true"); addElement(soapElement); } } if (props.getMessageID() != null) { AddressingBuilder builder = AddressingBuilder.getAddressingBuilder(); Relationship rel = builder.newRelationship(props.getMessageID().getURI()); this.relatesTo = new Relationship[] { rel }; } this.initialized = true; } // Map interface **************************************************************** public int size() { return addrTypes.size(); } public boolean isEmpty() { return addrTypes.isEmpty(); } public boolean containsKey(Object arg0) { return addrTypes.containsKey(arg0); } public boolean containsValue(Object arg0) { return addrTypes.containsValue(arg0); } public AddressingType get(Object arg0) { return addrTypes.get(arg0); } public AddressingType put(QName arg0, AddressingType arg1) { return addrTypes.put(arg0, arg1); } public AddressingType remove(Object arg0) { return addrTypes.remove(arg0); } public void putAll(Map arg0) { addrTypes.putAll(arg0); } public void clear() { addrTypes.clear(); } public Set keySet() { return addrTypes.keySet(); } public Collection values() { return addrTypes.values(); } public Set> entrySet() { return addrTypes.entrySet(); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AddressingBuilderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Addres0000644000175000017500000000504310542776150031657 0ustar godgod/* * 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.addressing; //$Id: AddressingBuilderImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.net.URI; import java.net.URISyntaxException; import javax.xml.namespace.QName; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingConstants; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.AttributedQName; import javax.xml.ws.addressing.AttributedURI; import javax.xml.ws.addressing.EndpointReference; import javax.xml.ws.addressing.Relationship; /** * Factory for AddressingElements. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class AddressingBuilderImpl extends AddressingBuilder { public AttributedURI newURI(URI uri) { return new AttributedURIImpl(uri); } public AttributedURI newURI(String uri) throws URISyntaxException { return newURI(new URI(uri)); } public AttributedQName newQName(QName name) { return new AttributedQNameImpl(name); } public Relationship newRelationship(URI uri) { return new RelationshipImpl(uri); } public EndpointReference newEndpointReference(URI uri) { return new EndpointReferenceImpl(uri); } public AddressingProperties newAddressingProperties() { return new AddressingPropertiesImpl(); } public AddressingConstants newAddressingConstants() { return new AddressingConstantsImpl(); } public String getNamespaceURI() { return new AddressingTypeImpl().getNamespaceURI(); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/AddressingClientUtil.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Addres0000644000175000017500000000641310644640763031664 0ustar godgodpackage org.jboss.ws.extensions.addressing; import java.net.URI; import java.net.URISyntaxException; import javax.xml.rpc.Stub; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingConstants; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.AttributedURI; import org.jboss.ws.core.utils.UUIDGenerator; /** * @author Heiko Braun, * @since 04-Mar-2006 */ public class AddressingClientUtil { private static AddressingBuilder BUILDER; private static AddressingConstants CONSTANTS; static { BUILDER = AddressingBuilder.getAddressingBuilder(); CONSTANTS = BUILDER.newAddressingConstants(); } /* creates outbound addressing properties */ public static AddressingProperties createRequestProperties() { AddressingProperties addrProps = BUILDER.newAddressingProperties(); addrProps.setMessageID(BUILDER.newURI(generateMessageID())); return addrProps; } /** * create default outbound addressing properties. */ public static AddressingProperties createDefaultProps(String wsaAction, String wsaTo) { try { AddressingProperties addrProps = createRequestProperties(); addrProps.setMessageID(BUILDER.newURI(generateMessageID())); addrProps.setAction(BUILDER.newURI(wsaAction)); addrProps.setTo(BUILDER.newURI(wsaTo)); return addrProps; } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } } /** * create anonymous request properties. * wsa:ReplyTo is set to anonymous and a messageID is supplied. */ public static AddressingProperties createAnonymousProps(String wsaAction, String wsaTo) { try { AddressingProperties addrProps = createDefaultProps(wsaAction, wsaTo); addrProps.setReplyTo(BUILDER.newEndpointReference(new URI(CONSTANTS.getAnonymousURI()))); return addrProps; } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } } /** * one-way properties cary a wsa:ReplyTo of none * upon which no response is expected. */ public static AddressingProperties createOneWayProps(String wsaAction, String wsaTo) { try { AddressingProperties addrProps = createDefaultProps(wsaAction, wsaTo); addrProps.setReplyTo(BUILDER.newEndpointReference(new URI(CONSTANTS.getNoneURI()))); return addrProps; } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } } /** * customize a stubs endpooint url */ public static void setTargetAddress(Stub stub, String url) { stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url); } /** * generate a UUID based message id. */ public static URI generateMessageID() { URI messageId = null; try { messageId = new URI("urn:uuid:" + UUIDGenerator.generateRandomUUIDString()); } catch (URISyntaxException e) { // Doesnt happen } return messageId; } public static AttributedURI createMessageID() { return BUILDER.newURI(generateMessageID()); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/EndpointReferenceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Endpoi0000644000175000017500000002337310650145103031665 0ustar godgod/* * 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.addressing; //$Id: EndpointReferenceImpl.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import java.io.StringWriter; import java.net.URI; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.ws.addressing.AddressingConstants; import javax.xml.ws.addressing.AddressingException; import javax.xml.ws.addressing.AttributedURI; import javax.xml.ws.addressing.EndpointReference; import javax.xml.ws.addressing.Metadata; import javax.xml.ws.addressing.ReferenceParameters; import javax.xml.ws.addressing.soap.SOAPAddressingBuilder; import org.jboss.ws.WSException; import org.jboss.ws.extensions.addressing.soap.SOAPAddressingBuilderImpl; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * Abstraction of EndpointReference. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class EndpointReferenceImpl extends AttributeElementExtensibleImpl implements EndpointReference { private static AddressingConstants ADDR = new AddressingConstantsImpl(); // The REQUIRED root element name private QName rootQName = new QName(ADDR.getNamespaceURI(), "EndpointReference", ADDR.getNamespacePrefix()); // This REQUIRED element (whose content is of type xs:anyURI) specifies the [address] property of the endpoint reference. private AttributedURIImpl address = new AttributedURIImpl(ADDR.getAnonymousURI()); // This OPTIONAL element may contain elements from any namespace. Such elements form the [reference parameters] of the reference. private ReferenceParametersImpl refParams = new ReferenceParametersImpl(); // This OPTIONAL element may contain elements from any namespace. private MetadataImpl metadata = new MetadataImpl(); public EndpointReferenceImpl(URI uri) { this.address = new AttributedURIImpl(uri); } public EndpointReferenceImpl(Element elRoot) { initFromElement(elRoot); } public QName getRootQName() { return rootQName; } public void setRootQName(QName rootElementName) { this.rootQName = rootElementName; } public AttributedURI getAddress() { return address; } public ReferenceParameters getReferenceParameters() { return refParams; } public Metadata getMetadata() { return metadata; } private void initFromElement(Element elRoot) { if (elRoot == null) throw new IllegalArgumentException("Cannot initialize from null element"); try { Map attributes = DOMUtils.getAttributes(elRoot); for (QName attqname : attributes.keySet()) { String value = attributes.get(attqname); addAttribute(attqname, value); } Iterator it = DOMUtils.getChildElements(elRoot); while (it.hasNext()) { Element el = (Element)it.next(); QName qname = DOMUtils.getElementQName(el); // Parse Address if (qname.equals(ADDR.getAddressQName())) { address = new AttributedURIImpl(DOMUtils.getTextContent(el)); attributes = DOMUtils.getAttributes(el); for (QName attqname : attributes.keySet()) { String value = attributes.get(attqname); address.addAttribute(attqname, value); } } // Parse ReferenceParameters else if (qname.equals(ADDR.getReferenceParametersQName())) { attributes = DOMUtils.getAttributes(el); for (QName attqname : attributes.keySet()) { String value = attributes.get(attqname); refParams.addAttribute(attqname, value); } Iterator itel = DOMUtils.getChildElements(el); while (itel.hasNext()) { Element child = (Element)itel.next(); refParams.addElement(child); } } // Parse Metadata else if (qname.equals(ADDR.getMetadataQName())) { attributes = DOMUtils.getAttributes(el); for (QName attqname : attributes.keySet()) { String value = attributes.get(attqname); metadata.addAttribute(attqname, value); } Iterator itel = DOMUtils.getChildElements(el); while (itel.hasNext()) { Element child = (Element)itel.next(); metadata.addElement(child); } } else { addElement(el); } } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new AddressingException("Cannot init EPR from element", ex); } } public Element toElement() { String xmlString = toXMLString(false); try { return DOMUtils.parse(xmlString); } catch (IOException ex) { throw new WSException("Cannot parse: " + xmlString, ex); } } public String toXMLString(boolean pretty) { if (pretty) { Element epRef = toElement(); return DOMWriter.printNode(epRef, true); } SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl(); AddressingConstants ADDR = builder.newAddressingConstants(); String rootname = getPrefixedName(rootQName); StringBuilder xmlBuffer = new StringBuilder("<" + rootname); appendAttributes(xmlBuffer, getAttributes()); xmlBuffer.append(">"); // insert xmlns:wsa String wsaURI = ADDR.getNamespaceURI(); String wsaPrefix = ADDR.getNamespacePrefix(); String wsaDeclaration = " xmlns:" + wsaPrefix + "='" + wsaURI + "'"; if (xmlBuffer.indexOf(wsaDeclaration) < 0) { xmlBuffer.insert(rootname.length() + 1, wsaDeclaration); } // append address xmlBuffer.append("<" + getPrefixedName(ADDR.getAddressQName())); appendAttributes(xmlBuffer, address.getAttributes()); xmlBuffer.append(">"); xmlBuffer.append(address.getURI() + ""); // append parameters if (refParams.getElements().size() > 0 || refParams.getAttributes().size() > 0) { xmlBuffer.append("<" + getPrefixedName(ADDR.getReferenceParametersQName())); appendAttributes(xmlBuffer, refParams.getAttributes()); xmlBuffer.append(">"); appendElements(xmlBuffer, refParams.getElements()); xmlBuffer.append(""); } // append metadata if (metadata.getElements().size() > 0 || metadata.getAttributes().size() > 0) { xmlBuffer.append("<" + getPrefixedName(ADDR.getMetadataQName())); appendAttributes(xmlBuffer, metadata.getAttributes()); xmlBuffer.append(">"); appendElements(xmlBuffer, metadata.getElements()); xmlBuffer.append(""); } // append custom elements appendElements(xmlBuffer, getElements()); xmlBuffer.append(""); String xmlString = xmlBuffer.toString(); return xmlString; } private void appendAttributes(StringBuilder xmlBuffer, Map attributes) { for (QName qname : attributes.keySet()) { String qualname = getPrefixedName(qname); String value = attributes.get(qname); xmlBuffer.append(" " + qualname + "='" + value + "'"); } } private void appendElements(StringBuilder xmlBuffer, List elements) { for (Object obj : elements) { if (obj instanceof Element) { StringWriter strwr = new StringWriter(); DOMWriter domWriter = new DOMWriter(strwr).setCompleteNamespaces(false); domWriter.print((Element)obj); String xmlFragment = strwr.toString(); xmlBuffer.append(xmlFragment); } else if (obj instanceof String) { xmlBuffer.append(obj); } else { throw new AddressingException("Unsupported element: " + obj.getClass().getName()); } } } private String getPrefixedName(QName qname) { String prefix = qname.getPrefix(); String localPart = qname.getLocalPart(); String qualname = (prefix != null && prefix.length() > 0 ? prefix + ":" + localPart : localPart); return qualname; } public String toString() { return toXMLString(true); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/RelationshipImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Relati0000644000175000017500000000406510542776150031700 0ustar godgod/* * 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.addressing; import java.net.URI; import javax.xml.namespace.QName; import javax.xml.ws.addressing.Relationship; // $Id: RelationshipImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * Abstraction of the RelatesToType defined by WS-Addressing. Includes an ID * property that references the MessageID of the related message and a Type * property corresponding to the RelationshipType attribute of the * RelatesToType. Implementing classes must supply a single argument constructor * with parameter type java.net.URI, which is used to initialize * the ID property. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class RelationshipImpl extends AttributeExtensibleImpl implements Relationship { private URI uri; private QName type; public RelationshipImpl(URI uri) { this.uri = uri; } public URI getID() { return uri; } public QName getType() { return type; } public void setType(QName type) { this.type = type; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/ElementExtensibleImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/addressing/Elemen0000644000175000017500000000353710542776150031670 0ustar godgod/* * 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.addressing; //$Id: ElementExtensibleImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.List; import javax.xml.ws.addressing.ElementExtensible; /** * Implemented by classes exposing a List of * SOAPElements. Used to represent addressing classes that * support collections of arbitrary XML Elements. * * @author Thomas.Diesler@jboss.org * @since 14-Nov-2005 */ public class ElementExtensibleImpl extends AddressingTypeImpl implements ElementExtensible { private List elements = new ArrayList(); public List getElements() { return elements; } public void addElement(Object element) { elements.add(element); } public boolean removeElement(Object element) { return elements.remove(element); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/0000755000175000017500000000000010755000255027203 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/0000755000175000017500000000000010755000255030472 5ustar godgod././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/XOPScanner.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/XOPSca0000644000175000017500000001205110542776150031521 0ustar godgod/* * 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.xop.jaxrpc; import java.util.ArrayList; import java.util.List; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; /** * Scans complex type definitions for nested XOP type declarations. * A XOP type declaration is identified as a complex type * that derives from xsd:base64Binary, i.e: * *
       * <xs:complexType name="MyXOPElement" >
       *   <xs:simpleContent>
       *       <xs:extension base="xs:base64Binary" >
       *           <xs:attribute ref="xmime:contentType" />
       *       </xs:extension>
       *   </xs:simpleContent>
       * </xs:complexType>
       * 
      * * @author Heiko Braun * @since Jun 9, 2006 * @version $Id: XOPScanner.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ */ public class XOPScanner { // avoid circular scans private List scannedItems = new ArrayList(); private static final String BASE64_BINARY = "base64Binary"; /** * Query a complex type for nested XOP type definitions. */ public XSTypeDefinition findXOPTypeDef(XSTypeDefinition typeDef) { if(typeDef==null) return typeDef; XSTypeDefinition result = null; String name = typeDef.getName(); String namespace = typeDef.getNamespace()!=null ? typeDef.getNamespace():""; if(typeDef instanceof XSSimpleTypeDefinition && BASE64_BINARY.equals(name)) { return typeDef; } else if(typeDef instanceof XSComplexTypeDefinition) { XSComplexTypeDefinition complexTypeDef = (XSComplexTypeDefinition)typeDef; if(name!=null) { String typeKey = namespace+":"+name; if(scannedItems.contains(typeKey)) { return null; } else { scannedItems.add(typeKey); } } // An XOP parameter is detected if it is a complex type // that derives from xsd:base64Binary if (complexTypeDef.getSimpleType() != null) { String typeName = complexTypeDef.getSimpleType().getName(); if (BASE64_BINARY.equals(typeName)) return complexTypeDef; } else { XSModelGroup xm = null; if(complexTypeDef.getContentType() != XSComplexTypeDefinition.CONTENTTYPE_EMPTY) { XSParticle xp = complexTypeDef.getParticle(); if (xp != null) { XSTerm xterm = xp.getTerm(); if(xterm instanceof XSModelGroup) { xm = (XSModelGroup)xterm; //System.out.println("xm -> " + xm); XSObjectList xo = xm.getParticles(); // interate over nested particles for(int i=0; i " + xe.getName()); result = findXOPTypeDef(nestedTypeDef); } } } } } } //System.out.println("result -> " + result); } return result; } public void reset() { scannedItems.clear(); } }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/JBossXBContentAdapter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/JBossX0000644000175000017500000002142310650145103031563 0ustar godgod/* * 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.xop.jaxrpc; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry; import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource; import org.jboss.ws.core.utils.MimeUtils; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.wsf.common.IOUtils; import org.jboss.xb.binding.sunday.marshalling.MarshallingContext; import org.jboss.xb.binding.sunday.marshalling.TermBeforeMarshallingCallback; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBeforeSetParentCallback; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnmarshallingContext; /** * Adopts raw binary contents to java types. * This class works in conjunction with the XOPUnmarshallerImpl * and XOPMarshallerImpl. * * @see XOPUnmarshallerImpl * @see XOPMarshallerImpl * * @author Heiko Braun * @version $Id: JBossXBContentAdapter.java 1322 2006-10-27 13:27:04Z heiko.braun@jboss.com $ * @since Oct 19, 2006 */ public class JBossXBContentAdapter implements TermBeforeMarshallingCallback, TermBeforeSetParentCallback { private static final Logger log = Logger.getLogger(JBossXBContentAdapter.class); private static final QName XMIME_BASE_64 = new QName(Constants.NS_XML_MIME, "base64Binary"); private static final QName XOP_INCLUDE = new QName(Constants.NS_XOP, "Include"); static { // Load JAF content handlers ContentHandlerRegistry.register(); } /** * When XOP is disabled we need to convert java types to byte[] * before handing off to XB. */ public Object beforeMarshalling(Object object, MarshallingContext marshallingContext) { boolean mtomDisabled = !XOPContext.isMTOMEnabled(); boolean convertableType = object!=null && !(object instanceof byte[]); if( mtomDisabled && convertableType ) { String contentType = MimeUtils.resolveMimeType(object); if(log.isDebugEnabled()) log.debug("Adopt " + object.getClass() + " to byte[], contentType " + contentType); DataHandler dh = new DataHandler(object, contentType); ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { IOUtils.copyStream(bout, dh.getInputStream()); object = bout.toByteArray(); } catch (IOException e) { throw new WSException("Failed to adopt XOP content type", e); } } return object; } /** * When XOP is disabled (inlined request) we receive a byte[] from XB * that needs to be converted in to java type */ public Object beforeSetParent(Object object, UnmarshallingContext ctx) { if(null==object) return object; // may be null when it's actually an encoded request ?! Class targetClass = ctx.resolvePropertyType(); if(null==targetClass) { throw new WSException("Failed to resolve target property type on "+ ctx.getParticle()); } boolean isRegularMessage = !XOPContext.isXOPMessage(); boolean isSimpleType = (object instanceof byte[]); boolean doTypesMatch = ( targetClass.equals(object.getClass()) ); // Handle inlined requests. // In this case XB treats binaries as simple types that are unmarshalled to byte[] // Still type conversion will be necessary. if( isRegularMessage && isSimpleType && !doTypesMatch) { String contentType = MimeUtils.resolveMimeType(targetClass); if(log.isDebugEnabled()) log.debug("Adopt byte[] to " + targetClass +", contentType "+ contentType); try { DataHandler dh = new DataHandler( wrapAsDataSource(object, contentType) ); if(targetClass.equals(DataHandler.class)) object = dh; else object = dh.getContent(); } catch (IOException e) { throw new WSException("Failed to adopt XOP content type", e); } } // Handle XOP encoded requests. // XB will use the XOPUnmarshaller callback and receive a DataHandler instance. // In this case we are be able to instantiate the correct content object // from the data handler, with the exception of content-type 'application/octet-stream'. // These attachments will be returned as DataHandler instances. else if(XOPContext.isXOPMessage() && (object instanceof DataHandler) && !doTypesMatch) { try { String contentType = MimeUtils.resolveMimeType(targetClass); if(log.isDebugEnabled()) log.debug("Adopt DataHandler to " + targetClass +", contentType "+ contentType); DataHandler dh = new DataHandler( wrapAsDataSource(object, contentType) ); object = dh.getContent(); // 'application/octet-stream' will return a byte[] instead fo the stream if(object instanceof InputStream) { ByteArrayOutputStream bout = new ByteArrayOutputStream(); dh.writeTo(bout); object = bout.toByteArray(); } } catch (IOException e) { throw new WSException("Failed to adopt XOP content type", e); } } return object; } private DataSource wrapAsDataSource(Object object, String contentType) throws IOException { DataSource ds; if(object instanceof byte[]) { ds = new SwapableMemoryDataSource(new ByteArrayInputStream((byte[])object), contentType); } else if(object instanceof DataHandler) { ds = new SwapableMemoryDataSource(((DataHandler)object).getInputStream(), contentType); } else { throw new IllegalArgumentException("Failed to wrap as data source: "+object.getClass()); } return ds; } /** * A factory method that registers the XB (un)marshalling adapters with schema binding. * These adapters convert java types into byte[] and reverse, * in order to match the jaxrpc-mapping declaration in case we receive or send an inlined request. */ public static void register(SchemaBinding schemaBinding) { JBossXBContentAdapter contentAdapter = new JBossXBContentAdapter(); // base64 simple types TypeBinding base64Type = schemaBinding.getType(org.jboss.xb.binding.Constants.QNAME_BASE64BINARY); base64Type.setBeforeMarshallingCallback( contentAdapter ); base64Type.setBeforeSetParentCallback( contentAdapter ); // xmime complex types TypeBinding xmimeBase64Type = schemaBinding.getType(XMIME_BASE_64); if(xmimeBase64Type!=null) { xmimeBase64Type.setBeforeMarshallingCallback( contentAdapter ); xmimeBase64Type.setBeforeSetParentCallback( contentAdapter ); // xop:Include /*ModelGroupBinding modelGroup = (ModelGroupBinding)xmimeBase64Type.getParticle().getTerm(); ParticleBinding particle = (ParticleBinding)modelGroup.getParticles().iterator().next(); ElementBinding xopInclude = (ElementBinding)particle.getTerm(); if(! xopInclude.getQName().equals(XOP_INCLUDE)) throw new WSException("Looks like the JBossXB XOP implementation has changed, please open a JIRA issue"); xopInclude.setBeforeMarshallingCallback(contentAdapter); xopInclude.setBeforeSetParentCallback(contentAdapter); */ } } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/XOPMarshallerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/XOPMar0000644000175000017500000000753010561611275031535 0ustar godgod/* * 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.xop.jaxrpc; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.soap.AttachmentPart; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry; import org.jboss.ws.core.soap.attachment.MimeConstants; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.xb.binding.sunday.xop.XOPMarshaller; import org.jboss.xb.binding.sunday.xop.XOPObject; /** * The XOPUnmarshallerImpl allows callbacks from the binding layer towards the * soap processing components in order to optimize binary processing. * * @see XOPUnmarshallerImpl * * @author Heiko Braun * @since May 9, 2006 * @version $Id: XOPMarshallerImpl.java 2275 2007-02-05 11:19:25Z heiko.braun@jboss.com $ */ public class XOPMarshallerImpl implements XOPMarshaller { private static final Logger log = Logger.getLogger(XOPMarshallerImpl.class); static { // Load JAF content handlers ContentHandlerRegistry.register(); } public boolean isXOPPackage() { return XOPContext.isXOPMessage(); } public String addMtomAttachment(XOPObject obj, String elementNamespace, String elementName) { CommonMessageContext msgContext = (CommonMessageContext)MessageContextAssociation.peekMessageContext(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); QName xmlName = new QName(elementNamespace, elementName); if(log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + "]"); String cid = soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart()); DataHandler dataHandler = XOPContext.createDataHandler(obj); AttachmentPart xopPart = soapMessage.createAttachmentPart(dataHandler); xopPart.addMimeHeader(MimeConstants.CONTENT_ID, '<'+cid+'>'); // RFC2392 requirement soapMessage.addAttachmentPart(xopPart); if(log.isDebugEnabled()) log.debug("Created attachment part " +cid+", with content-type " +xopPart.getContentType()); return "cid:" + cid; } public String addMtomAttachment(byte[] data, String elementNamespace, String elementName) { /* TODO: this requires a java mail upgrade ByteArrayDataSource ds = new ByteArrayDataSource(data, MimeConstants.TYPE_APPLICATION_OCTET_STREAM); return addMtomAttachment( new DataHandler( ds, MimeConstants.TYPE_APPLICATION_OCTET_STREAM), elementNamespace, elementName );*/ throw new NotImplementedException("Not implemented yet"); } public String addSwaRefAttachment(Object obj) { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/XOPUnmarshallerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxrpc/XOPUnm0000644000175000017500000000661110542776150031557 0ustar godgod/* * 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.xop.jaxrpc; import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.soap.AttachmentPart; import javax.xml.soap.SOAPException; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.xb.binding.sunday.xop.XOPObject; import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller; /** * The XOPUnmarshallerImpl allows callbacks from the binding layer towards the * soap processing components in order to optimize binary processing. * * @see XOPMarshallerImpl * * @author Heiko Braun * @since May 9, 2006 * @version $Id: XOPUnmarshallerImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ */ public class XOPUnmarshallerImpl implements XOPUnmarshaller { private static final Logger log = Logger.getLogger(XOPUnmarshallerImpl.class); private static final QName XOP_INCLUDE = new QName(Constants.NS_XOP, "Include"); static { // Load JAF content handlers ContentHandlerRegistry.register(); } public boolean isXOPPackage() { return XOPContext.isXOPMessage(); } public XOPObject getAttachmentAsDataHandler(String cid) { try { AttachmentPart part = XOPContext.getAttachmentByCID(cid); DataHandler dataHandler = part.getDataHandler(); String contentType = dataHandler.getContentType(); // Wrapping the DataHandler shields XB from the JAF dependency XOPObject xopObject = new XOPObject(dataHandler); xopObject.setContentType(contentType); return xopObject; } catch(SOAPException e) { throw new WSException("Failed to access attachment part", e); } } public byte[] getAttachmentAsByteArray(String cid) { try { AttachmentPart part = XOPContext.getAttachmentByCID(cid); DataHandler dh = part.getDataHandler(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); dh.writeTo(bout); return bout.toByteArray(); } catch (SOAPException ex) { throw new WSException(ex); } catch(IOException e) { throw new WSException(e); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/0000755000175000017500000000000010755000255030337 5ustar godgod././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/Reflect0000644000175000017500000001717110650145103031651 0ustar godgod/* * 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.xop.jaxws; import org.jboss.wsf.common.JavaUtils; import javax.activation.DataHandler; import javax.xml.bind.annotation.XmlAttachmentRef; import javax.xml.bind.annotation.XmlMimeType; import javax.xml.transform.Source; import java.awt.*; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.List; /** * Scans java beans for MTOM and swaRef declarations.
      * It basically searches for *
        *
      • @XmlMimeType *
      • @XmlAttachmentRef *
      * and returns the appropriate mimetype.
      * In order to re-use an instance of this class you need to invoke reset() * in between scans. * * @author Heiko Braun * @since 04.12.2006 * */ public class ReflectiveAttachmentRefScanner { private static List SUPPORTED_TYPES = new ArrayList(5); public static enum ResultType {XOP, SWA_REF}; static { SUPPORTED_TYPES.add(String.class); SUPPORTED_TYPES.add(byte[].class); SUPPORTED_TYPES.add(Image.class); SUPPORTED_TYPES.add(Source.class); SUPPORTED_TYPES.add(DataHandler.class); } private List scannedFields = new ArrayList(); /** * Scan java types for MTOM declarations * * @param xmlRoot * @return the first matching XmlMimeType#value() or null if none found */ public AttachmentScanResult scanBean(Class xmlRoot) { if( isJDKType(xmlRoot) ) return null; AttachmentScanResult result = null; for(Field field : xmlRoot.getDeclaredFields()) { Class type = field.getType(); boolean exceptionToTheRule = isAttachmentDataType(type); // only non JDK types are inspected except for byte[] and java.lang.String if( !alreadyScanned(field) && (exceptionToTheRule || !isJDKType(type)) ) { // Scan for swa:Ref type declarations first if(field.isAnnotationPresent(XmlAttachmentRef.class)) { // arbitrary, it's not used result = new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF); } // Scan for XOP field annotations else if(field.isAnnotationPresent(XmlMimeType.class)) { XmlMimeType mimeTypeDecl = field.getAnnotation(XmlMimeType.class); result = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP); } if(null == result) // try getter methods { result = scanGetterAnnotation(xmlRoot, field); } // avoid recursive loops if(!isAttachmentDataType(type)) scannedFields.add(field); // drill down if none found so far if(null == result) result = scanBean(type); } } return result; } public static List scanMethod(Method method) { List results = new ArrayList(); // return type if(method.getReturnType() != void.class) { AttachmentScanResult result = null; if(method.isAnnotationPresent(XmlAttachmentRef.class)) { result = new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF); } else if (method.isAnnotationPresent(XmlMimeType.class)) { XmlMimeType mimeTypeDecl = method.getAnnotation(XmlMimeType.class); result = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP); } if(result!=null) { result.setIndex(-1); // default for return values results.add(result); } } // method parameter int index = 0; for (Annotation[] parameterAnnotations : method.getParameterAnnotations()) { if (parameterAnnotations!=null) { for (Annotation annotation : parameterAnnotations) { AttachmentScanResult paramResult = null; if(XmlAttachmentRef.class == annotation.annotationType()) { paramResult = new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF); } else if(XmlMimeType.class == annotation.annotationType()) { XmlMimeType mimeTypeDecl = method.getAnnotation(XmlMimeType.class); paramResult = new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP); } if(paramResult!=null) { paramResult.setIndex(index); results.add(paramResult); } } } index++; } return results; } public static AttachmentScanResult getResultByIndex(List results, int index) { AttachmentScanResult result = null; for(AttachmentScanResult asr : results) { if(asr.getIndex() == index) { result = asr; break; } } return result; } private boolean alreadyScanned(Field field) { for(Field f : scannedFields) { if(f.equals(field)) return true; } return false; } public void reset() { scannedFields.clear(); } private static boolean isAttachmentDataType(Class clazz) { for(Class cl : SUPPORTED_TYPES) { if(JavaUtils.isAssignableFrom(cl, clazz)) return true; } return false; } private static boolean isJDKType(Class clazz) { return clazz.getCanonicalName().startsWith("java") || clazz.isPrimitive(); } private static AttachmentScanResult scanGetterAnnotation(Class owner, Field field) { String getterMethodName = "get"+field.getName(); for(Method method : owner.getDeclaredMethods()) { if(method.getName().equalsIgnoreCase(getterMethodName)) { if(method.isAnnotationPresent(XmlMimeType.class)) { XmlMimeType mimeTypeDecl = method.getAnnotation(XmlMimeType.class); return new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP); } else if(method.isAnnotationPresent(XmlAttachmentRef.class)) { return new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF); } } } return null; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/AttachmentMarshallerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/Attachm0000644000175000017500000001434610626770234031663 0ustar godgod/* * 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.xop.jaxws; import javax.activation.DataHandler; import javax.xml.bind.attachment.AttachmentMarshaller; import javax.xml.namespace.QName; import javax.xml.soap.AttachmentPart; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry; import org.jboss.ws.core.soap.attachment.MimeConstants; import org.jboss.ws.extensions.xop.XOPContext; /** * Enable JAXB marshalling to optimize storage of binary data.
      * This API enables an efficient cooperative creation of optimized binary data formats between a JAXB marshalling process * and a MIME-based package processor. A JAXB implementation marshals the root body of a MIME-based package, * delegating the creation of referenceable MIME parts to the MIME-based package processor * that implements this abstraction.

      * XOP processing is enabled when isXOPPackage() is true. * See addMtomAttachment(DataHandler, String, String) for details. *

      * WS-I Attachment Profile 1.0 is supported by addSwaRefAttachment(DataHandler) * being called by the marshaller for each JAXB property related to {http://ws-i.org/profiles/basic/1.1/xsd}swaRef. * * @author Heiko Braun * @version $Revision: 3220 $ */ public class AttachmentMarshallerImpl extends AttachmentMarshaller { // provide logging private static final Logger log = Logger.getLogger(AttachmentMarshallerImpl.class); static { // Load JAF content handlers ContentHandlerRegistry.register(); } public AttachmentMarshallerImpl() { super(); } /** * @param data - represents the data to be attached. Must be non-null. * @param elementNamespace - the namespace URI of the element that encloses the base64Binary data. Can be empty but never null. * @param elementLocalName - The local name of the element. Always a non-null valid string. * * @return content-id URI, cid, to the attachment containing data or null if data should be inlined. */ public String addMtomAttachment(DataHandler data, String elementNamespace, String elementLocalName) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); QName xmlName = new QName(elementNamespace, elementLocalName); if(log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + "]"); String cid = soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart()); AttachmentPart xopPart = soapMessage.createAttachmentPart(data); xopPart.addMimeHeader(MimeConstants.CONTENT_ID, '<' + cid + '>'); // RFC2392 requirement soapMessage.addAttachmentPart(xopPart); if(log.isDebugEnabled()) log.debug("Created attachment part " + cid + ", with content-type " + xopPart.getContentType()); return "cid:" + cid; } /** * @param data - represents the data to be attached. Must be non-null. The actual data region is specified by (data,offset,length) tuple. * @param offset - The offset within the array of the first byte to be read; must be non-negative and no larger than array.length * @param length - The number of bytes to be read from the given array; must be non-negative and no larger than array.length * @param mimeType - If the data has an associated MIME type known to JAXB, that is passed as this parameter. If none is known, "application/octet-stream". This parameter may never be null. * @param elementNamespace - the namespace URI of the element that encloses the base64Binary data. Can be empty but never null. * @param elementLocalName - The local name of the element. Always a non-null valid string. * * @return content-id URI, cid, to the attachment containing data or null if data should be inlined. */ public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String elementNamespace, String elementLocalName) { if(true) mimeType = null; // ignore the mime type. otherwise the content handlers will fail String contentType = mimeType != null ? mimeType : "application/octet-stream"; DataHandler dh = new DataHandler(data, contentType); return addMtomAttachment(dh, elementNamespace, elementLocalName); } public String addSwaRefAttachment(DataHandler dataHandler) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); String cid = soapMessage.getCidGenerator().generateFromCount(); AttachmentPart swaRefPart = soapMessage.createAttachmentPart(dataHandler); swaRefPart.addMimeHeader(MimeConstants.CONTENT_ID, '<' + cid + '>'); // RFC2392 requirement soapMessage.addAttachmentPart(swaRefPart); if(log.isDebugEnabled()) log.debug("Created attachment part " + cid + ", with content-type " + swaRefPart.getContentType()); return "cid:" + cid; } public boolean isXOPPackage() { return XOPContext.isXOPMessage(); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/AttachmentUnmarshallerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/Attachm0000644000175000017500000000771710626770234031667 0ustar godgod/* * 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.xop.jaxws; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.attachment.ContentHandlerRegistry; import org.jboss.ws.extensions.xop.XOPContext; import javax.activation.DataHandler; import javax.xml.bind.attachment.AttachmentUnmarshaller; import javax.xml.soap.AttachmentPart; import javax.xml.soap.SOAPException; import java.io.ByteArrayOutputStream; import java.io.IOException; /** *

      Enables JAXB unmarshalling of a root document containing optimized binary data formats.

      * *

      This API enables an efficient cooperative processing of optimized * binary data formats between a JAXB 2.0 implementation and MIME-based package * processor (MTOM/XOP and WS-I AP 1.0). JAXB unmarshals the body of a package, delegating the * understanding of the packaging format being used to a MIME-based * package processor that implements this abstract class.

      * *

      This abstract class identifies if a package requires XOP processing, isXOPPackage() and provides retrieval of binary content stored as attachments by content-id.

      * *

      Identifying the content-id, cid, to pass to getAttachment*(String cid)

      * *

      */ public class AttachmentUnmarshallerImpl extends AttachmentUnmarshaller { static { // Load JAF content handlers ContentHandlerRegistry.register(); } public AttachmentUnmarshallerImpl() { super(); } public boolean isXOPPackage() { return XOPContext.isXOPMessage(); } public DataHandler getAttachmentAsDataHandler(String cid) { try { AttachmentPart part = XOPContext.getAttachmentByCID(cid); return part.getDataHandler(); } catch (SOAPException e) { throw new WSException("Failed to access attachment part", e); } } public byte[] getAttachmentAsByteArray(String cid) { try { AttachmentPart part = XOPContext.getAttachmentByCID(cid); DataHandler dh = part.getDataHandler(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); dh.writeTo(bout); return bout.toByteArray(); } catch (SOAPException ex) { throw new WSException(ex); } catch (IOException e) { throw new WSException(e); } } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/AttachmentScanResult.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/jaxws/Attachm0000644000175000017500000000355710626770234031665 0ustar godgod/* * 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.xop.jaxws; /** * @author Heiko.Braun@jboss.org * @version $Id$ * @since Mar 7, 2007 */ public final class AttachmentScanResult { public enum Type {XOP, SWA_REF}; private String mimeType; private Type type; // distinguish return value and method parameters private int index = -1; public AttachmentScanResult(String mimeType, Type type) { this.mimeType = mimeType; this.type = type; } public String getMimeType() { return mimeType; } public Type getType() { return type; } /** * *

          * -1 - return value
          * 0 - 1st method parameter
          * n - n'th method parameter
          * 
      * * * @return */ public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/RestoreXOPElementVisitor.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/RestoreXOPEle0000644000175000017500000000472410542776150031605 0ustar godgod/* * 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.xop; import java.util.Iterator; import org.jboss.ws.core.soap.SAAJVisitor; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.soap.SOAPElementImpl; /** * Visit soap object model and restore XOP contents. * This visitor is invoked when: *
        *
      • Client side request handler chain has been executed *
      • Server side response or fault handler chain been executed *
      * * It basically takes care that when jaxrpc handlers have been in place, * the XOP contents are being restored upon request and response. * * @author Heiko Braun * @version $Id: RestoreXOPElementVisitor.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ * @since Sep 26, 2006 */ public class RestoreXOPElementVisitor implements SAAJVisitor { public void visitXOPElements(SOAPElementImpl root) { boolean isSCE = (root instanceof SOAPContentElement); // don't expand SOAPContentElements if(isSCE) { root.accept(this); } else { Iterator it = root.getChildElements(); while(it.hasNext()) { final Object o = it.next(); if(o instanceof SOAPElementImpl) visitXOPElements((SOAPElementImpl)o); } } } public void visitSOAPElement(SOAPElementImpl soapElement) { // nada } public void visitSOAPContentElement(SOAPContentElement scElement) { scElement.handleMTOMTransitions(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/XOPContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/XOPContext.ja0000644000175000017500000003573710650145103031545 0ustar godgod/* * 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.xop; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.Iterator; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.soap.AttachmentPart; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.StubExt; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.NameImpl; import org.jboss.ws.core.soap.SOAPElementImpl; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.attachment.MimeConstants; import org.jboss.ws.core.utils.MimeUtils; import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.JavaUtils; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.sunday.xop.XOPMarshaller; import org.jboss.xb.binding.sunday.xop.XOPObject; /** * XOP context associated with a message context. * Acts as a facade to the current soap message and supports the various XOP transitions.

      * A good starting point to understand how MTOM in JBossWS works is to take a * look at the SOAPContentElement implementation. * * @see org.jboss.ws.core.soap.SOAPContentElement#handleMTOMTransitions() * @see org.jboss.ws.extensions.xop.jaxrpc.XOPUnmarshallerImpl * @see XOPMarshallerImpl * * @author Heiko Braun * @since May 10, 2006 * @version $Id: XOPContext.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ */ public class XOPContext { // provide logging private static final Logger log = Logger.getLogger(XOPContext.class); private static final String NS_XOP_JBOSSWS = "http://org.jboss.ws/xop"; /** * Check if the current soap message flagged as a XOP package. * This may differ from the wire format when jaxrpc handlers are in place. */ public static boolean isXOPMessage() { boolean isXOP = false; CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null) { SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); isXOP = (soapMessage != null && soapMessage.isXOPMessage()); } return isXOP; } public static boolean isSWARefMessage() { boolean isSWARef = false; CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null) { SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); isSWARef = (soapMessage != null && soapMessage.isSWARefMessage()); } return isSWARef; } /** * Check if the wire format is actually a xop encoded multipart message */ public static boolean isXOPEncodedRequest() { boolean isMultippartXOP = false; CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null) { MessageAbstraction message = msgContext.getMessageAbstraction(); String[] contentType = message.getMimeHeaders().getHeader("content-type"); if (contentType != null) { for (String value : contentType) { if (value.indexOf(MimeConstants.TYPE_APPLICATION_XOP_XML) != -1) { isMultippartXOP = true; break; } } } } return isMultippartXOP; } /** * Check if MTOM is enabled.
      * * Even though the client API to enable/disable MTOM is different * between JAX-WS and JAXRPC, both do will cases will propagate a message context property. * (org.jboss.ws.mtom.enabled)
      */ public static boolean isMTOMEnabled() { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); Boolean mtomEnabled = (Boolean)msgContext.get(StubExt.PROPERTY_MTOM_ENABLED); return Boolean.TRUE.equals(mtomEnabled); } public static void setMTOMEnabled(boolean b) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); msgContext.put(StubExt.PROPERTY_MTOM_ENABLED, Boolean.valueOf(b)); } /** * Replace all xop:Include elements with it's base64 representation. * This happens when the associated SOAPContentElement transitions to state dom-valid.
      * All attachement parts will be removed. */ public static void inlineXOPData(SOAPElement xopElement) { String ns = xopElement.getNamespaceURI() != null ? xopElement.getNamespaceURI() : ""; String localName = xopElement.getLocalName(); // rpc/lit if (ns.equals(Constants.NS_XOP) && localName.equals("Include")) { replaceXOPInclude(xopElement.getParentElement(), xopElement); } else { // doc/lit Iterator it = DOMUtils.getChildElements(xopElement); while (it.hasNext()) { SOAPElement childElement = (SOAPElement)it.next(); String childNS = childElement.getNamespaceURI() != null ? childElement.getNamespaceURI() : ""; String childName = childElement.getLocalName(); if (childNS.equals(Constants.NS_XOP) && childName.equals("Include")) { replaceXOPInclude(xopElement, childElement); } else { inlineXOPData(childElement); } } } } /** * When handlers jump in, the SOAPMessage flag that indicates * a xop encoded message (derived from wire format) becomes stale. * * @param isXOPMessage */ private static void setXOPMessage(boolean isXOPMessage) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPMessageImpl soapMsg = (SOAPMessageImpl)msgContext.getSOAPMessage(); soapMsg.setXOPMessage(isXOPMessage); } /** * The XOP attachments need to be created before the actual message is written * to an output stream. This is necessary because it changes the overall message content-type. * If we would do this lazily (i.e. upon remoting callback) the previous content-type * would already have been written. * * @see org.jboss.ws.core.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object, boolean) * @see org.jboss.ws.core.soap.SOAPMessageMarshaller#write(Object, java.io.OutputStream) */ public static void eagerlyCreateAttachments() { if (!isXOPMessage() && !isSWARefMessage()) return; try { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPMessage soapMessage = msgContext != null ? msgContext.getSOAPMessage() : null; SOAPBody body = soapMessage != null ? soapMessage.getSOAPBody() : null; if (body != null) { CreateAttachmentVisitor visitor = new CreateAttachmentVisitor(); visitor.visitXOPElements((SOAPElementImpl)body); } } catch (SOAPException e) { throw new WSException("Failed to eagerly create XOP attachments", e); } } /** * Visit the soap object model elements and restore xop data. */ public static void visitAndRestoreXOPData() { try { if (!isXOPMessage() && isMTOMEnabled()) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPBody body = msgContext.getSOAPMessage().getSOAPBody(); RestoreXOPElementVisitor visitor = new RestoreXOPElementVisitor(); visitor.visitXOPElements((SOAPElementImpl)body); } } catch (SOAPException e) { throw new WSException("Failed to restore XOP data", e); } } /** * Restore previously inlined XOP elements. * All base64 representations will be replaced by xop:Include * elements and the attachment parts will be recreated.
      * This happens when a SOAPContentElement is written to an output stream. */ public static void restoreXOPDataDOM(SOAPElement xopElement) { String contentType = xopElement.getAttributeNS(NS_XOP_JBOSSWS, "content-type"); if (contentType != null && contentType.length() > 0) { replaceBase64Representation(xopElement, contentType); xopElement.removeAttribute(new NameImpl(new QName(NS_XOP_JBOSSWS, "content-type"))); } else { Iterator it = DOMUtils.getChildElements(xopElement); while (it.hasNext()) { SOAPElement childElement = (SOAPElement)it.next(); restoreXOPDataDOM(childElement); } } } private static void replaceBase64Representation(SOAPElement xopElement, String contentType) { SOAPElement parentElement = xopElement.getParentElement(); if (log.isDebugEnabled()) log.debug("Replace base64 representation on element [xmlName=" + parentElement.getLocalName() + "]"); String base64 = xopElement.getValue(); byte[] data = SimpleTypeBindings.unmarshalBase64(base64); MimeUtils.ByteArrayConverter converter = MimeUtils.getConverterForContentType(contentType); Object converted = converter.readFrom(new ByteArrayInputStream(data)); XOPObject xopObject = new XOPObject(converted); xopObject.setContentType(contentType); XOPMarshaller xopMarshaller = new XOPMarshallerImpl(); String cid = xopMarshaller.addMtomAttachment(xopObject, xopElement.getNamespaceURI(), xopElement.getLocalName()); // remove base64 node with the xop:Include element org.w3c.dom.Node child = (org.w3c.dom.Node)xopElement.getFirstChild(); xopElement.removeChild(child); try { SOAPElement xopInclude = xopElement.addChildElement(Constants.NAME_XOP_INCLUDE); xopInclude.setAttribute("href", cid); if (log.isDebugEnabled()) log.debug("Restored xop:Include element on [xmlName=" + xopElement.getLocalName() + "]"); XOPContext.setXOPMessage(true); } catch (SOAPException e) { throw new WSException("Failed to create XOP include element", e); } } private static void replaceXOPInclude(SOAPElement parent, SOAPElement xopIncludeElement) { if (log.isDebugEnabled()) log.debug("Replace xop:Include on element [xmlName=" + parent.getLocalName() + "]"); String cid = xopIncludeElement.getAttribute("href"); byte[] data; String contentType; try { AttachmentPart part = XOPContext.getAttachmentByCID(cid); DataHandler dh = part.getDataHandler(); contentType = dh.getContentType(); // TODO: can't we create base64 directly from stream? ByteArrayOutputStream bout = new ByteArrayOutputStream(); dh.writeTo(bout); data = bout.toByteArray(); } catch (Exception e) { throw new WSException("Failed to inline XOP data", e); } // create base64 contents String base64 = SimpleTypeBindings.marshalBase64(data); parent.removeChild(xopIncludeElement); parent.setValue(base64); parent.setAttributeNS(NS_XOP_JBOSSWS, "content-type", contentType); if (log.isDebugEnabled()) log.debug("Created base64 representation for content-type " + contentType); // cleanup the attachment part CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); if (cid.startsWith("cid:")) cid = cid.substring(4); cid = '<' + cid + '>'; AttachmentPart removedPart = soapMessage.removeAttachmentByContentId(cid); if (null == removedPart) throw new WSException("Unable to remove attachment part " + cid); if (log.isDebugEnabled()) log.debug("Removed attachment part " + cid); // leave soap object model in a valid state setXOPMessage(false); } /** * Access an XOP attachment part by content id (CID). */ public static AttachmentPart getAttachmentByCID(String cid) throws SOAPException { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); // RFC2392 requires the 'cid:' part to be stripped from the cid if (cid.startsWith("cid:")) cid = cid.substring(4); cid = '<' + cid + '>'; AttachmentPart part = soapMessage.getAttachmentByContentId(cid); if (part == null) throw new WSException("Cannot find attachment part for: " + cid); return part; } /** * Create a DataHandler for an object. * The handlers content type is based on the java type. */ public static DataHandler createDataHandler(XOPObject xopObject) { DataHandler dataHandler; Object o = xopObject.getContent(); if (o instanceof DataHandler) { dataHandler = (DataHandler)o; } else if (xopObject.getContentType() != null) { dataHandler = new DataHandler(o, xopObject.getContentType()); } else { dataHandler = new DataHandler(o, getContentTypeForClazz(o.getClass())); } return dataHandler; } public static String getContentTypeForClazz(Class clazz) { if (JavaUtils.isAssignableFrom(java.awt.Image.class, clazz)) { return "image/jpeg"; } else if (JavaUtils.isAssignableFrom(javax.xml.transform.Source.class, clazz)) { return "application/xml"; } else if (JavaUtils.isAssignableFrom(java.lang.String.class, clazz)) { return "text/plain"; } else { return "application/octet-stream"; } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/CreateAttachmentVisitor.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/xop/CreateAttachm0000644000175000017500000000512610542776150031647 0ustar godgod/* * 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.xop; import java.io.IOException; import java.io.Writer; import java.util.Iterator; import org.jboss.ws.core.soap.SAAJVisitor; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.soap.SOAPElementImpl; /** * @author Heiko Braun * @version $Id: CreateAttachmentVisitor.java 1408 2006-11-07 13:42:25Z heiko.braun@jboss.com $ * @since Nov 7, 2006 */ public class CreateAttachmentVisitor implements SAAJVisitor { public void visitXOPElements(SOAPElementImpl root) { boolean isSCE = (root instanceof SOAPContentElement); // don't expand SOAPContentElements if(isSCE) { root.accept(this); } else { Iterator it = root.getChildElements(); while(it.hasNext()) { final Object o = it.next(); if(o instanceof SOAPElementImpl) visitXOPElements((SOAPElementImpl)o); } } } public void visitSOAPElement(SOAPElementImpl soapElement) { // nada } public void visitSOAPContentElement(SOAPContentElement scElement) { // Calling writeElement will enforce marshalling of this object // Any attachment will be created while doing this. try { scElement.writeElement( new NoopWriter() ); } catch (IOException e) { // } } class NoopWriter extends Writer { public void write(char cbuf[], int off, int len) throws IOException { } public void flush() throws IOException { } public void close() throws IOException { } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/0000755000175000017500000000000010755000256030245 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxrpc/0000755000175000017500000000000010755000255031533 5ustar godgod././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxrpc/W0000644000175000017500000001024710654066746031707 0ustar godgod/* * 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.security.jaxrpc; // $Id: WSSecurityHandler.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.rpc.handler.GenericHandler; import javax.xml.rpc.handler.MessageContext; import javax.xml.soap.SOAPException; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.WSSecurityDispatcher; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; /** * An abstract JAXRPC handler that delegates to the WSSecurityDispatcher * * @author Thomas.Diesler@jboss.org * @since 12-Nov-2005 */ public abstract class WSSecurityHandler extends GenericHandler { // provide logging private static Logger log = Logger.getLogger(WSSecurityHandler.class); public QName[] getHeaders() { return new QName[] {Constants.WSSE_HEADER_QNAME}; } protected boolean handleInboundSecurity(MessageContext msgContext) { try { if (getSecurityConfiguration(msgContext) != null) { WSSecurityDispatcher.handleInbound((CommonMessageContext)msgContext); } } catch (SOAPException ex) { log.error("Cannot handle inbound ws-security", ex); return false; } return true; } protected boolean handleOutboundSecurity(MessageContext msgContext) { try { if (getSecurityConfiguration(msgContext) != null) { WSSecurityDispatcher.handleOutbound((CommonMessageContext)msgContext); } } catch (SOAPException ex) { log.error("Cannot handle outbound ws-security", ex); return false; } return true; } /** * Load security config from vfsRoot * @param msgContext */ private WSSecurityConfiguration getSecurityConfiguration(MessageContext msgContext) { EndpointMetaData epMetaData = ((CommonMessageContext)msgContext).getEndpointMetaData(); ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData(); WSSecurityConfiguration config = serviceMetaData.getSecurityConfiguration(); if (config == null) // might be set through ServiceObjectFactory { try { WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance(); UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile(); config = wsseConfFactory.createConfiguration(vfsRoot, getConfigResourceName()); } catch (IOException e) { throw new WSException("Cannot obtain security config: " + getConfigResourceName()); } // it's required further down the processing chain serviceMetaData.setSecurityConfiguration(config); } return config; } protected abstract String getConfigResourceName(); } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandlerOutbound.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxrpc/W0000644000175000017500000000341610560063272031672 0ustar godgod/* * 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.security.jaxrpc; // $Id: WSSecurityHandlerOutbound.java 2210 2007-01-31 09:51:54Z thomas.diesler@jboss.com $ import javax.xml.rpc.handler.MessageContext; import org.jboss.ws.metadata.wsse.WSSecurityOMFactory; /** * A JAXRPC handler that delegates to the WSSecurityDispatcher * * @author Thomas.Diesler@jboss.org * @since 12-Nov-2005 */ public class WSSecurityHandlerOutbound extends WSSecurityHandler { public boolean handleRequest(MessageContext msgContext) { return handleOutboundSecurity(msgContext); } public boolean handleResponse(MessageContext msgContext) { return handleInboundSecurity(msgContext); } protected String getConfigResourceName() { return WSSecurityOMFactory.CLIENT_RESOURCE_NAME; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandlerInbound.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxrpc/W0000644000175000017500000000347010560063272031672 0ustar godgod/* * 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.security.jaxrpc; // $Id: WSSecurityHandlerInbound.java 2210 2007-01-31 09:51:54Z thomas.diesler@jboss.com $ import javax.xml.rpc.handler.MessageContext; import org.jboss.ws.metadata.wsse.WSSecurityOMFactory; /** * A JAXRPC handler that delegates to the WSSecurityDispatcher * where the request is an inbound message. * * @author Thomas.Diesler@jboss.org * @since 12-Nov-2005 */ public class WSSecurityHandlerInbound extends WSSecurityHandler { public boolean handleRequest(MessageContext msgContext) { return handleInboundSecurity(msgContext); } public boolean handleResponse(MessageContext msgContext) { return handleOutboundSecurity(msgContext); } protected String getConfigResourceName() { return WSSecurityOMFactory.SERVER_RESOURCE_NAME; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireEncryptionOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireE0000644000175000017500000000256710716057127031731 0ustar godgod/* * 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.security; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.exception.WSSecurityException; public class RequireEncryptionOperation extends RequireTargetableOperation { public RequireEncryptionOperation(SecurityHeader header, SecurityStore store) throws WSSecurityException { super(header, store); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Operation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Operatio0000644000175000017500000000232010542776150031756 0ustar godgod/* * 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.security; /** * Marker interface for all WS-Security operations * * @author Jason T. Greene * @version $Revision: 1757 $ */ public interface Operation { } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/DecryptionOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Decrypti0000644000175000017500000001244410716057127031766 0ustar godgod/* * 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.security; import java.util.Collection; import java.util.HashSet; import javax.crypto.SecretKey; import org.apache.xml.security.encryption.XMLCipher; import org.apache.xml.security.encryption.XMLEncryptionException; import org.jboss.ws.extensions.security.element.EncryptedKey; import org.jboss.ws.extensions.security.element.ReferenceList; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.SecurityProcess; import org.jboss.ws.extensions.security.exception.FailedCheckException; import org.jboss.ws.extensions.security.exception.InvalidSecurityHeaderException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; public class DecryptionOperation implements DecodingOperation { private SecurityHeader header; private SecurityStore store; public DecryptionOperation(SecurityHeader header, SecurityStore store) throws WSSecurityException { this.header = header; this.store = store; } private boolean isContent(Element element) { return Constants.XENC_CONTENT_TYPE.equals(element.getAttribute("Type")); } private String getEncryptionAlgorithm(Element element) throws WSSecurityException { element = Util.findElement(element, "EncryptionMethod", Constants.XML_ENCRYPTION_NS); if (element == null) throw new InvalidSecurityHeaderException("Encrypted element corrupted, no encryption method"); String alg = element.getAttribute("Algorithm"); if (alg == null || alg.length() == 0) throw new InvalidSecurityHeaderException("Encrypted element corrupted, no algorithm specified"); return alg; } private String decryptElement(Element element, SecretKey key) throws WSSecurityException { Element previous; boolean parent; boolean isContent; // We find the decrypted element by traversing to the element before the // encrypted data. If there is no sibling before the encrypted data, then // we traverse to the parent. // "Now take a step back . . . and then a step forward . . . and then a // step back . . . and then we're cha-chaing." -Chris Knight parent = isContent = isContent(element); if (parent) { previous = (Element) element.getParentNode(); } else { previous = Util.getPreviousSiblingElement(element); if (previous == null) { parent = true; previous = (Element) element.getParentNode(); } } String alg = getEncryptionAlgorithm(element); try { XMLCipher cipher = XMLCipher.getInstance(alg); cipher.init(XMLCipher.DECRYPT_MODE, key); cipher.doFinal(element.getOwnerDocument(), element); } catch (XMLEncryptionException e) { throw new FailedCheckException("Decryption was invalid."); } catch (Exception e) { throw new WSSecurityException("Could not decrypt element: " + e.getMessage(), e); } if (isContent) return Util.getWsuId(previous); Element decrypted = (parent) ? Util.getFirstChildElement(previous) : Util.getNextSiblingElement(previous); if (decrypted == null) return null; return Util.getWsuId(decrypted); } private boolean isEncryptedData(Element element) { return "EncryptedData".equals(element.getLocalName()) && Constants.XML_ENCRYPTION_NS.equals(element.getNamespaceURI()); } public Collection process(Document message, SecurityProcess process) throws WSSecurityException { Collection ids = new HashSet(); EncryptedKey key = (EncryptedKey) process; ReferenceList list = key.getReferenceList(); for (String uri : list.getAllReferences()) { Element element = Util.findElementByWsuId(message.getDocumentElement(), uri); if (element == null) throw new WSSecurityException("A reference list refered to an element that was not found: " + uri); if (!isEncryptedData(element)) throw new WSSecurityException("Malformed reference list, a non encrypted data element was referenced: " + uri); ids.add(decryptElement(element, key.getSecretKey())); } return ids; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/TokenOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/TokenOpe0000644000175000017500000000307010716057127031722 0ustar godgod/* * 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.security; import org.jboss.ws.extensions.security.element.Token; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; /** * DecodingOperation represents an operation that is applied to a * WS-Security encoded message to both convert and verify the contents of the * message. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public interface TokenOperation { public void process(Document message, Token token) throws WSSecurityException; } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000755000175000017500000000000010755000256031676 5ustar godgod././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/SecurityTokenReference.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000577210716057127031721 0ustar godgod/* * 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.security.element; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.Util; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Id: SecurityTokenReference.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ public class SecurityTokenReference { private String id; private Reference reference; private Element cachedElement; public SecurityTokenReference(Reference reference) { this.reference = reference; } public SecurityTokenReference(Element element) throws WSSecurityException { if (! "SecurityTokenReference".equals(element.getLocalName())) throw new WSSecurityException("SecurityTokenReference was passed an invalid local name"); String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID); if (id == null || id.length() == 0) setId(id); Element child = Util.getFirstChildElement(element); if (child == null) throw new WSSecurityException("Invalid message, SecurityTokenRefence is empty: " + id); this.reference = Reference.getReference(child); } public Reference getReference() { return reference; } public String getId() { if (id == null) id = Util.generateId("reference"); return id; } public void setId(String id) { this.id = id; } public Element getElement() throws WSSecurityException { if (cachedElement != null) return cachedElement; Element referenceElement = reference.getElement(); Document doc = referenceElement.getOwnerDocument(); Element element = doc.createElementNS(Constants.WSSE_NS, Constants.WSSE_PREFIX + ":" + "SecurityTokenReference"); element.setAttributeNS(Constants.WSU_NS, Constants.WSU_ID, getId()); element.appendChild(referenceElement); cachedElement = element; return cachedElement; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/BinarySecurityToken.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000626710716057127031721 0ustar godgod/* * 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.security.element; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.Util; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Id: BinarySecurityToken.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ abstract public class BinarySecurityToken implements Token { private Document doc; private String id; private Element cachedElement; public static BinarySecurityToken createBinarySecurityToken(Element element) throws WSSecurityException { String valueType = element.getAttribute("ValueType"); if (X509Token.TYPE.equals(valueType)) return new X509Token(element); else throw new WSSecurityException("Unkown Binary Security Token!!!"); } public BinarySecurityToken(Document doc) { this.doc = doc; } abstract public String getValueType(); abstract public String getEncodingType(); abstract public String getEncodedValue(boolean noWhitespace); public String getId() { if (id == null) id = Util.generateId("token"); return id; } public void setId(String id) { this.id = id; } public Element getElement() { if (cachedElement != null) return cachedElement; Element element = doc.createElementNS(Constants.WSSE_NS, Constants.WSSE_PREFIX + ":" + "BinarySecurityToken"); element.setAttributeNS(Constants.WSU_NS, Constants.WSU_ID, getId()); element.setAttribute("ValueType", getValueType()); element.setAttribute("EncodingType", getEncodingType()); element.appendChild(doc.createTextNode(getEncodedValue(false))); cachedElement = element; return cachedElement; } public Element getSTRTransformElement() { Element element = doc.createElementNS(Constants.WSSE_NS, Constants.WSSE_PREFIX + ":" + "BinarySecurityToken"); Util.addNamespace(element, Constants.WSSE_PREFIX, Constants.WSSE_NS); element.setAttribute("ValueType", getValueType()); element.appendChild(doc.createTextNode(getEncodedValue(true))); return element; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/X509IssuerSerial.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000001167010716057127031713 0ustar godgod/* * 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.security.element; import java.security.cert.X509Certificate; import org.apache.xml.security.utils.XMLUtils; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.Util; import org.jboss.ws.extensions.security.exception.InvalidSecurityHeaderException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * X509IssuerSerial is a reference type within a * SecurityTokenReference that referes to a token that * using the Issuer's DN, and certificate serial number. * * @see org.jboss.ws.extensions.security.element.SecurityTokenReference * @see org.jboss.ws.extensions.security.element.BinarySecurityToken * * @author Jason T. Greene * @version $Id: X509IssuerSerial.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ public class X509IssuerSerial extends Reference { private Document doc; private String issuer; private String serial; private Element cachedElement; public X509IssuerSerial(Document doc, BinarySecurityToken token) throws WSSecurityException { this.doc = doc; referenceToken(token); } public X509IssuerSerial(Element element) throws WSSecurityException { this.doc = element.getOwnerDocument(); if (! "X509Data".equals(element.getLocalName())) throw new InvalidSecurityHeaderException("Invalid message, invalid local name on a X509Data element"); element = Util.getFirstChildElement(element); if (element == null) throw new InvalidSecurityHeaderException("X509DataElement empty"); if (! element.getLocalName().equals("X509IssuerSerial")) throw new InvalidSecurityHeaderException("Only X509IssuerSerial is supported for an X509Data element"); element = Util.getFirstChildElement(element); if (element == null) throw new InvalidSecurityHeaderException("X509IssuerSerial empty"); while (element != null) { String name = element.getLocalName(); if (name.equals("X509IssuerName")) issuer = XMLUtils.getFullTextChildrenFromElement(element); else if (name.equals("X509SerialNumber")) serial = XMLUtils.getFullTextChildrenFromElement(element); element = Util.getNextSiblingElement(element); } if (serial == null) throw new InvalidSecurityHeaderException("X509SerialNumber missing from X509IssuerSerial"); if (issuer == null) throw new InvalidSecurityHeaderException("X509IssuerName missing from X509IssuerSerial"); } public void referenceToken(BinarySecurityToken token) throws WSSecurityException { if (! (token instanceof X509Token)) throw new WSSecurityException("X509IssuerSerial tried to reference something besides an X509 token"); X509Token x509 = (X509Token) token; X509Certificate cert = x509.getCert(); this.issuer = cert.getIssuerDN().toString(); this.serial = cert.getSerialNumber().toString(); } public String getIssuer() { return issuer; } public String getSerial() { return serial; } public Document getDocument() { return doc; } public Element getElement() { if (cachedElement != null) return cachedElement; Element element = doc.createElementNS(Constants.XML_SIGNATURE_NS, "ds:X509Data"); Element issuerSerial = doc.createElementNS(Constants.XML_SIGNATURE_NS, "ds:X509IssuerSerial"); element.appendChild(issuerSerial); element = doc.createElementNS(Constants.XML_SIGNATURE_NS, "ds:X509IssuerName"); element.appendChild(doc.createTextNode(issuer)); issuerSerial.appendChild(element); element = doc.createElementNS(Constants.XML_SIGNATURE_NS, "ds:X509SerialNumber"); element.appendChild(doc.createTextNode(serial)); issuerSerial.appendChild(element); cachedElement = element; return cachedElement; } }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/Signature.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000500610716057127031707 0ustar godgod/* * 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.security.element; import java.security.PublicKey; import org.apache.xml.security.exceptions.XMLSecurityException; import org.apache.xml.security.signature.XMLSignature; import org.jboss.ws.extensions.security.KeyResolver; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Id: Signature.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ public class Signature implements SecurityProcess { private XMLSignature signature; /* Used only for decoding */ private PublicKey publicKey; private Element cachedElement; public Signature(XMLSignature signature) { this.signature = signature; } public Signature(Element element, KeyResolver resolver) throws WSSecurityException { try { signature = new XMLSignature(element, null); publicKey = resolver.resolvePublicKey(signature.getKeyInfo()); } catch (XMLSecurityException e) { throw new WSSecurityException("Error decoding xml signature: " + e.getMessage(), e); } } public XMLSignature getSignature() { return signature; } public void setSignature(XMLSignature signature) { this.signature = signature; } public Element getElement() { if (cachedElement != null) return cachedElement; cachedElement = signature.getElement(); return cachedElement; } public PublicKey getPublicKey() { return publicKey; } }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/Timestamp.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000001006110716057127031704 0ustar godgod/* * 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.security.element; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; import org.apache.xml.security.utils.XMLUtils; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.Util; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.jboss.xb.binding.SimpleTypeBindings; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class Timestamp implements SecurityElement { private String id = "timestamp"; private Integer ttl; private Document doc; private Calendar created; private Calendar expires; private Element cachedElement; public Timestamp(Integer ttl, Document doc) { this.doc = doc; this.ttl = ttl; } public Timestamp(Element element) throws WSSecurityException { this.doc = element.getOwnerDocument(); String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID); if (id == null || id.length() == 0) throw new WSSecurityException("Invalid message, Timestamp is missing an id"); this.id = id; Element child = Util.getFirstChildElement(element); if (child == null || !Constants.WSU_NS.equals(child.getNamespaceURI()) || !"Created".equals(child.getLocalName())) throw new WSSecurityException("Created child expected in Timestamp element"); this.created = SimpleTypeBindings.unmarshalDateTime(XMLUtils.getFullTextChildrenFromElement(child)); child = Util.getNextSiblingElement(child); if (child == null) return; this.expires = SimpleTypeBindings.unmarshalDateTime(XMLUtils.getFullTextChildrenFromElement(child)); } private void setupTime() { created = new GregorianCalendar(TimeZone.getTimeZone("UTC")); if (ttl != null) { expires = (Calendar) created.clone(); expires.add(Calendar.SECOND, ttl.intValue()); } } private String getId() { return id; } public Calendar getCreated() { return created; } public Calendar getExpires() { return expires; } public Element getElement() throws WSSecurityException { if (cachedElement != null) return cachedElement; setupTime(); Element element = doc.createElementNS(Constants.WSU_NS, Constants.WSU_PREFIX + ":" + "Timestamp"); element.setAttributeNS(Constants.WSU_NS, Constants.WSU_ID, getId()); Element child = doc.createElementNS(Constants.WSU_NS, Constants.WSU_PREFIX + ":" + "Created"); child.appendChild(doc.createTextNode(SimpleTypeBindings.marshalDateTime(created))); element.appendChild(child); if (expires != null) { child = doc.createElementNS(Constants.WSU_NS, Constants.WSU_PREFIX + ":" + "Expires"); child.appendChild(doc.createTextNode(SimpleTypeBindings.marshalDateTime(expires))); element.appendChild(child); } cachedElement = element; return cachedElement; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/X509Token.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000702310716057127031710 0ustar godgod/* * 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.security.element; import java.io.ByteArrayInputStream; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import org.apache.xml.security.utils.XMLUtils; import org.jboss.util.Base64; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; public class X509Token extends BinarySecurityToken { private X509Certificate cert; public static final String TYPE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"; public X509Token(X509Certificate cert, Document doc) { super(doc); this.cert = cert; } public X509Token(Element element) throws WSSecurityException { super(element.getOwnerDocument()); String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID); if (id == null || id.length() == 0) throw new WSSecurityException("Invalid message, BinarySecurityToken is missing an id"); setId(id); if (! Constants.BASE64_ENCODING_TYPE.equals(element.getAttribute("EncodingType"))) throw new WSSecurityException("Invalid encoding type (only base64 is supported) for token:" + id); setCert(decodeCert(XMLUtils.getFullTextChildrenFromElement(element))); } @Override public String getEncodingType() { return Constants.BASE64_ENCODING_TYPE; } @Override public String getValueType() { return TYPE; } @Override public String getEncodedValue(boolean noWhitespace) { try { return Base64.encodeBytes(cert.getEncoded(), (noWhitespace) ? Base64.DONT_BREAK_LINES : 0); } catch (CertificateEncodingException e) { throw new RuntimeException("Could not encode X509 token", e); } } public X509Certificate getCert() { return cert; } public void setCert(X509Certificate cert) { this.cert = cert; } public X509Certificate decodeCert(String data) throws WSSecurityException { try { CertificateFactory factory = CertificateFactory.getInstance("X.509"); return (X509Certificate)factory.generateCertificate(new ByteArrayInputStream(Base64.decode(data))); } catch(Exception e) { throw new WSSecurityException("Error decoding BinarySecurityToken: " + e.getMessage()); } } public Object getUniqueContent() { return cert; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/SecurityProcess.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000232110542776150031705 0ustar godgod/* * 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.security.element; /** * @author Jason T. Greene * @version $Id: SecurityProcess.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ */ public interface SecurityProcess extends SecurityElement { } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/EncryptedKey.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000001613510716057127031714 0ustar godgod/* * 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.security.element; import java.security.PrivateKey; import java.util.HashMap; import javax.crypto.SecretKey; import org.apache.xml.security.encryption.XMLCipher; import org.apache.xml.security.exceptions.XMLSecurityException; import org.apache.xml.security.keys.KeyInfo; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.KeyResolver; import org.jboss.ws.extensions.security.Util; import org.jboss.ws.extensions.security.exception.InvalidSecurityHeaderException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * EncryptedKey represents the am XMLSecurity encrypted key. * * @author Jason T. Greene * @version $Id: EncryptedKey.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ public class EncryptedKey implements SecurityProcess { private Document document; private SecretKey secretKey; private X509Token token; private ReferenceList list; private String wrapAlgorithm; private Element cachedElement; private String tokenRefType; private static HashMap keyWrapAlgorithms; private static final String DEFAULT_ALGORITHM = "rsa_15"; static { keyWrapAlgorithms = new HashMap(2); keyWrapAlgorithms.put("rsa_15", XMLCipher.RSA_v1dot5); keyWrapAlgorithms.put("rsa_oaep", XMLCipher.RSA_OAEP); } public EncryptedKey(Document document, SecretKey secretKey, X509Token token, String wrap, String tokenRefType) { this(document, secretKey, token, new ReferenceList(), wrap, tokenRefType); } public EncryptedKey(Document document, SecretKey secretKey, X509Token token, ReferenceList list, String wrap, String tokenRefType) { this.document = document; this.secretKey = secretKey; this.token = token; this.list = list; this.wrapAlgorithm = keyWrapAlgorithms.get(wrap); if (wrapAlgorithm ==null) wrapAlgorithm = keyWrapAlgorithms.get(DEFAULT_ALGORITHM); this.tokenRefType = tokenRefType; } public EncryptedKey(Element element, KeyResolver resolver) throws WSSecurityException { org.apache.xml.security.encryption.EncryptedKey key; XMLCipher cipher; try { cipher = XMLCipher.getInstance(); key = cipher.loadEncryptedKey(element); } catch (XMLSecurityException e) { throw new WSSecurityException("Could not parse encrypted key: " + e.getMessage(), e); } KeyInfo info = key.getKeyInfo(); if (info == null) throw new WSSecurityException("EncryptedKey element did not contain KeyInfo"); PrivateKey privateKey = resolver.resolvePrivateKey(info); // Locate the reference list. We have to manually parse this because xml security doesn't handle // shorthand xpointer references (URI="#fooid") Element referenceList = Util.findElement(element, Constants.XENC_REFERENCELIST, Constants.XML_ENCRYPTION_NS); if (referenceList == null) throw new WSSecurityException("Encrypted key did not contain a reference list"); this.list = new ReferenceList(referenceList); // Now use the element list to determine the encryption alg String alg = getKeyAlgorithm(element); if (alg == null) throw new WSSecurityException("Could not determine encrypted key algorithm!"); try { cipher.init(XMLCipher.UNWRAP_MODE, privateKey); this.secretKey = (SecretKey) cipher.decryptKey(key, alg); } catch (XMLSecurityException e) { throw new WSSecurityException("Could not parse encrypted key: " + e.getMessage(), e); } this.document = element.getOwnerDocument(); this.token = new X509Token(resolver.resolveCertificate(info), this.document); } private String getKeyAlgorithm(Element element) throws WSSecurityException { // We obtain the keys algorithm by looking at the first data element in our reference list String id = this.list.getAllReferences().iterator().next(); if (id == null) return null; Element dataElement = Util.findElementByWsuId(element.getOwnerDocument().getDocumentElement(), id); if (dataElement == null) return null; return getEncryptionAlgorithm(dataElement); } private String getEncryptionAlgorithm(Element element) throws WSSecurityException { element = Util.findElement(element, "EncryptionMethod", Constants.XML_ENCRYPTION_NS); if (element == null) throw new InvalidSecurityHeaderException("Encrypted element corrupted, no encryption method"); String alg = element.getAttribute("Algorithm"); if (alg == null || alg.length() == 0) throw new InvalidSecurityHeaderException("Encrypted element corrupted, no algorithm specified"); return alg; } public Element getElement() throws WSSecurityException { if (cachedElement != null) return cachedElement; XMLCipher cipher; org.apache.xml.security.encryption.EncryptedKey key; try { cipher = XMLCipher.getInstance(wrapAlgorithm); cipher.init(XMLCipher.WRAP_MODE, token.getCert().getPublicKey()); key = cipher.encryptKey(document, secretKey); } catch (XMLSecurityException e) { throw new WSSecurityException("Error encrypting key: " + e.getMessage(), e); } SecurityTokenReference reference = new SecurityTokenReference(Reference.getReference(tokenRefType, document, token)); KeyInfo keyInfo = new KeyInfo(document); keyInfo.addUnknownElement(reference.getElement()); key.setKeyInfo(keyInfo); key.setReferenceList(cipher.createReferenceList(org.apache.xml.security.encryption.ReferenceList.DATA_REFERENCE)); list.populateRealReferenceList(key.getReferenceList()); cachedElement = cipher.martial(key); return cachedElement; } public void addReference(String id) { list.add(id); } public SecretKey getSecretKey() { return secretKey; } public ReferenceList getReferenceList() { return list; } }././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/SecurityHeader.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000001414410716057127031712 0ustar godgod/* * 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.security.element; import java.util.HashMap; import java.util.LinkedList; import org.jboss.ws.extensions.security.BinarySecurityTokenValidator; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.KeyResolver; import org.jboss.ws.extensions.security.SecurityStore; import org.jboss.ws.extensions.security.Util; import org.jboss.ws.extensions.security.exception.UnsupportedSecurityTokenException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * SecurityHeader represents the wsse:security element of WS-Security, * and is responsible for storing the processing state of a message. * * @author Jason T. Greene * @version $Id: SecurityHeader.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ public class SecurityHeader implements SecurityElement { private Document document; private Timestamp timestamp; private LinkedList tokens = new LinkedList(); private HashMap sharedTokens = new HashMap(); private LinkedList securityProcesses = new LinkedList(); // Looks like this is only for embedded tokens private LinkedList securityTokenReferences = new LinkedList(); public SecurityHeader(Document document) { this.document = document; } public SecurityHeader(Element element, SecurityStore store) throws WSSecurityException { document = element.getOwnerDocument(); KeyResolver resolver = new KeyResolver(store); BinarySecurityTokenValidator validator = new BinarySecurityTokenValidator(store); Element child = Util.getFirstChildElement(element); while (child != null) { String tag = child.getLocalName(); if (tag.equals("BinarySecurityToken")) { BinarySecurityToken token = BinarySecurityToken.createBinarySecurityToken(child); validator.validateToken(token); resolver.cacheToken(token); tokens.add(token); } else if (tag.equals("UsernameToken")) tokens.add(new UsernameToken(child)); else if (tag.equals("Timestamp")) timestamp = new Timestamp(child); else if (tag.equals("Signature")) securityProcesses.add(new Signature(child, resolver)); else if (tag.equals("EncryptedKey")) securityProcesses.add(new EncryptedKey(child, resolver)); else if (tag.equals("ReferenceList")) throw new UnsupportedSecurityTokenException("ReferenceLists outside of encrypted keys (shared secrets) are not supported."); child = Util.getNextSiblingElement(child); } } public Timestamp getTimestamp() { return timestamp; } public void setTimestamp(Timestamp timestamp) { this.timestamp = timestamp; } /** * @return Returns the securityTokenReferences. */ public LinkedList getSecurityTokenReferences() { return securityTokenReferences; } /** * @param securityTokenReferences The securityTokenReferences to set. */ public void setSecurityTokenReferences(LinkedList securityTokenReferences) { this.securityTokenReferences = securityTokenReferences; } /** * @return Returns the securityProcesses. */ public LinkedList getSecurityProcesses() { return securityProcesses; } /** * @param securityProcesses The securityProcesses to set. */ public void setSecurityProcesses(LinkedList securityProcesses) { this.securityProcesses = securityProcesses; } /** * @return the tokens. */ public LinkedList getTokens() { return tokens; } public void addToken(Token token) { tokens.addFirst(token); Object content = token.getUniqueContent(); if (content != null) sharedTokens.put(content, token); } public Token getSharedToken(Object uniqueContent) { if (uniqueContent == null) return null; return sharedTokens.get(uniqueContent); } public void addSecurityProcess(SecurityProcess process) { securityProcesses.addFirst(process); } public void addSecurityTokenReference(SecurityTokenReference reference) { securityTokenReferences.addFirst(reference); } public Element getElement() throws WSSecurityException { Element element = document.createElementNS(Constants.WSSE_NS, Constants.WSSE_HEADER); Util.addNamespace(element, Constants.WSSE_PREFIX, Constants.WSSE_NS); Util.addNamespace(element, Constants.WSU_PREFIX, Constants.WSU_NS); if (timestamp != null) element.appendChild(timestamp.getElement()); for (Token t : tokens) element.appendChild(t.getElement()); for (SecurityTokenReference r : securityTokenReferences) element.appendChild(r.getElement()); for (SecurityProcess p : securityProcesses) element.appendChild(p.getElement()); return element; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/UsernameToken.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000001002610716057127031705 0ustar godgod/* * 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.security.element; import org.apache.xml.security.utils.XMLUtils; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.Util; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Id: UsernameToken.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ public class UsernameToken implements Token { private String username; private String password; private Document doc; private String id; private Element cachedElement; public UsernameToken(String username, String password, Document doc) { this.username = username; this.password = password; this.doc = doc; } public UsernameToken(Element element) throws WSSecurityException { this.doc = element.getOwnerDocument(); String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID); if (id == null || id.length() == 0) throw new WSSecurityException("Invalid message, UsernameToken is missing an id"); setId(id); Element child = Util.getFirstChildElement(element); if (child == null || ! Constants.WSSE_NS.equals(child.getNamespaceURI()) || ! "Username".equals(child.getLocalName())) throw new WSSecurityException("Username child expected in UsernameToken element"); this.username = XMLUtils.getFullTextChildrenFromElement(child); child = Util.getNextSiblingElement(child); if (child == null || ! Constants.WSSE_NS.equals(child.getNamespaceURI()) || ! "Password".equals(child.getLocalName())) throw new WSSecurityException("Password child expected in UsernameToken element"); this.password = XMLUtils.getFullTextChildrenFromElement(child); } public String getId() { if (id == null) id = Util.generateId("token"); return id; } public void setId(String id) { this.id = id; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Element getElement() { if (cachedElement != null) return cachedElement; Element element = doc.createElementNS(Constants.WSSE_NS, Constants.WSSE_PREFIX + ":" + "UsernameToken"); element.setAttributeNS(Constants.WSU_NS, Constants.WSU_ID, getId()); Element child = doc.createElementNS(Constants.WSSE_NS, Constants.WSSE_PREFIX + ":" + "Username"); child.appendChild(doc.createTextNode(username)); element.appendChild(child); child = doc.createElementNS(Constants.WSSE_NS, Constants.WSSE_PREFIX + ":" + "Password"); child.appendChild(doc.createTextNode(password)); element.appendChild(child); cachedElement = element; return cachedElement; } public Object getUniqueContent() { return null; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/Token.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000301510542776150031706 0ustar godgod/* * 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.security.element; /** * Token represnts an authenticated identifier contained in a * WS-Security message. * * @author Jason T. Greene * @version $Id: Token.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ */ public interface Token extends SecurityElement { /** * Returns a uniquely identifying content that facilitates reuse of that token * (by making an additional reference instead of copying). * * @return the unique content */ public Object getUniqueContent(); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/SecurityElement.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000250710716057127031712 0ustar godgod/* * 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.security.element; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public interface SecurityElement { public Element getElement() throws WSSecurityException; } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/DirectReference.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000713610716057127031715 0ustar godgod/* * 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.security.element; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * DirectReference is a reference type within a * SecurityTokenReference that referes to a token that is * retrievable via a URL. This is typically used for refering to a * BinarySecurityToken that is within the same message. * * @see org.jboss.ws.extensions.security.element.SecurityTokenReference * @see org.jboss.ws.extensions.security.element.BinarySecurityToken * * @author Jason T. Greene * @version $Id: DirectReference.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ public class DirectReference extends Reference { private Document doc; private String uri; private String valueType; private Element cachedElement; public DirectReference(Document doc) { this.doc = doc; } public DirectReference(Document doc, BinarySecurityToken token) { this.doc = doc; referenceToken(token); } public DirectReference(Element element) throws WSSecurityException { this.doc = element.getOwnerDocument(); if (!"Reference".equals(element.getLocalName())) throw new WSSecurityException("Invalid message, invalid local name on a DirectReference"); String uri = element.getAttribute("URI"); if (uri == null || uri.length() == 0) throw new WSSecurityException("Inavliad message, Reference element is missing a URI"); setUri(uri); String valueType = element.getAttribute("ValueType"); if (valueType == null || valueType.length() == 0) throw new WSSecurityException("Inavliad message, Reference element is missing a ValueType"); setValueType(valueType); } public String getUri() { return uri; } public void referenceToken(BinarySecurityToken token) { setUri("#" + token.getId()); setValueType(token.getValueType()); } public void setUri(String uri) { this.uri = uri; } public String getValueType() { return valueType; } public void setValueType(String valueType) { this.valueType = valueType; } public Element getElement() { if (cachedElement != null) return cachedElement; Element element = doc.createElementNS(Constants.WSSE_NS, Constants.WSSE_PREFIX + ":" + "Reference"); element.setAttribute("ValueType", getValueType()); element.setAttribute("URI", getUri()); cachedElement = element; return cachedElement; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/ReferenceList.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000554110542776150031714 0ustar godgod/* * 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.security.element; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import org.apache.xml.security.encryption.Reference; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.Util; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Id: ReferenceList.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ */ public class ReferenceList { private LinkedList references = new LinkedList(); public ReferenceList() { } public ReferenceList(Element element) { Element child = Util.getFirstChildElement(element); while (child != null) { // Skip key references, they aren't used by WS-Security if (Constants.XML_ENCRYPTION_NS.equals(child.getNamespaceURI()) && Constants.XENC_DATAREFERENCE.equals(child.getLocalName())) { String uri = child.getAttribute("URI"); if (uri != null && uri.length() > 1 && uri.charAt(0) == '#') references.add(uri.substring(1)); } child = Util.getNextSiblingElement(child); } } public ReferenceList(org.apache.xml.security.encryption.ReferenceList list) { Iterator i = list.getReferences(); while (i.hasNext()) { Reference r = (Reference) i.next(); references.add(r.getURI()); } } public void add(String id) { // We prepend so that decryption can handle nested elements by just // following the order references.addFirst(id); } public void populateRealReferenceList(org.apache.xml.security.encryption.ReferenceList list) { for (String i : references) { list.add(list.newDataReference("#" + i)); } } public Collection getAllReferences() { return references; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/KeyIdentifier.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000001201610716057127031706 0ustar godgod/* * 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.security.element; import java.security.cert.X509Certificate; import org.apache.xml.security.exceptions.Base64DecodingException; import org.apache.xml.security.utils.Base64; import org.apache.xml.security.utils.XMLUtils; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * KeyIdentifier is a reference type within a * SecurityTokenReference that referes to a token that * using some uniquely identifying characteristic. An example is an * X.509v3 Subject Key Identifier, which is the only currently * supported key identifier by this class. * * @see org.jboss.ws.extensions.security.element.SecurityTokenReference * @see org.jboss.ws.extensions.security.element.BinarySecurityToken * * @author Jason T. Greene * @version $Id: KeyIdentifier.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ */ public class KeyIdentifier extends Reference { public static final String SKI_TYPE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier"; private Document doc; private String value; private Element cachedElement; public KeyIdentifier(Document doc, BinarySecurityToken token) throws WSSecurityException { this.doc = doc; referenceToken(token); } public KeyIdentifier(Element element) throws WSSecurityException { this.doc = element.getOwnerDocument(); if (! "KeyIdentifier".equals(element.getLocalName())) throw new WSSecurityException("Invalid message, invalid local name on a KeyIdentifier"); String valueType = element.getAttribute("ValueType"); if (valueType == null || valueType.length() == 0) throw new WSSecurityException("Inavliad message, KeyIdentifier element is missing an ValueType"); if (! SKI_TYPE.equals(valueType)) throw new WSSecurityException("Currently only SubjectKeyIdentifiers are supported, was passed: " + valueType); // Lets be soft on encoding type since other clients don't properly use it this.value = XMLUtils.getFullTextChildrenFromElement(element); } public void referenceToken(BinarySecurityToken token) throws WSSecurityException { if (! (token instanceof X509Token)) throw new WSSecurityException("KeyIdentifier tried to reference something besides an X509 token"); X509Token x509 = (X509Token) token; X509Certificate cert = x509.getCert(); // Maybee we should make one ourselves if it isn't there? byte[] encoded = cert.getExtensionValue("2.5.29.14"); if (encoded == null) throw new WSSecurityException("Certificate did not contain a subject key identifier!"); // We need to skip 4 bytes [(OCTET STRING) (LENGTH)[(OCTET STRING) (LENGTH) (Actual data)]] int trunc = encoded.length - 4; byte[] identifier = new byte[trunc]; System.arraycopy(encoded, 4, identifier, 0, trunc); value = Base64.encode(identifier); } public String getValue() { return value; } public String getValueType() { // Support only SKI at the moment return SKI_TYPE; } public Document getDocument() { return doc; } public byte[] getIdentifier() throws WSSecurityException { if (value == null) return null; try { return Base64.decode(value); } catch (Base64DecodingException e) { throw new WSSecurityException("Error decoding key identifier", e); } } public Element getElement() { if (cachedElement != null) return cachedElement; Element element = doc.createElementNS(Constants.WSSE_NS, Constants.WSSE_PREFIX + ":" + "KeyIdentifier"); element.setAttribute("ValueType", getValueType()); element.setAttribute("EncodingType", Constants.BASE64_ENCODING_TYPE); element.appendChild(doc.createTextNode(value)); cachedElement = element; return cachedElement; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/Reference.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/element/0000644000175000017500000000511710716057127031712 0ustar godgod/* * 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.security.element; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; abstract public class Reference implements SecurityElement { public static final String DIRECT_REFERENCE = "directReference"; public static final String KEY_IDENTIFIER = "keyIdentifier"; public static final String X509ISSUER_SERIAL = "x509IssuerSerial"; public static Reference getReference(Element element) throws WSSecurityException { String name = element.getLocalName(); if ("Reference".equals(name)) { return new DirectReference(element); } else if ("KeyIdentifier".equals(name)) { return new KeyIdentifier(element); } else if ("X509Data".equals(name)) { return new X509IssuerSerial(element); } else { throw new WSSecurityException("Unkown reference element: " + name); } } public static Reference getReference(String tokenRefType, Document message, BinarySecurityToken token) throws WSSecurityException { if (tokenRefType == null || DIRECT_REFERENCE.equals(tokenRefType)) { return new DirectReference(message, token); } else if (KEY_IDENTIFIER.equals(tokenRefType)) { return new KeyIdentifier(message, token); } else if (X509ISSUER_SERIAL.equals(tokenRefType)) { return new X509IssuerSerial(message, token); } else { throw new WSSecurityException("Unkown token reference type: " + tokenRefType); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxws/0000755000175000017500000000000010755000256031401 5ustar godgod././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxws/WSSecurityHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxws/WS0000644000175000017500000001064610654066746031702 0ustar godgod/* * 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.security.jaxws; // $Id: WSSecurityHandler.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import java.io.IOException; import java.util.Collections; import java.util.HashSet; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.SOAPException; import javax.xml.ws.handler.MessageContext; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler; import org.jboss.ws.extensions.security.Constants; import org.jboss.ws.extensions.security.WSSecurityDispatcher; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; /** * An abstract JAXWS handler that delegates to the WSSecurityDispatcher * * @author Thomas.Diesler@jboss.org * @since 12-Nov-2005 */ public abstract class WSSecurityHandler extends GenericSOAPHandler { // provide logging private static Logger log = Logger.getLogger(WSSecurityHandler.class); private static Set headers; static { HashSet set = new HashSet(); set.add(Constants.WSSE_HEADER_QNAME); headers = Collections.unmodifiableSet(set); } public Set getHeaders() { return headers; } protected boolean handleInboundSecurity(MessageContext msgContext) { try { if (getSecurityConfiguration(msgContext) != null) { WSSecurityDispatcher.handleInbound((CommonMessageContext)msgContext); } } catch (SOAPException ex) { log.error("Cannot handle inbound ws-security", ex); return false; } return true; } protected boolean handleOutboundSecurity(MessageContext msgContext) { try { if (getSecurityConfiguration(msgContext) != null) { WSSecurityDispatcher.handleOutbound((CommonMessageContext)msgContext); } } catch (SOAPException ex) { log.error("Cannot handle outbound ws-security", ex); return false; } return true; } /** * Load security config from vfsRoot * @param msgContext */ private WSSecurityConfiguration getSecurityConfiguration(MessageContext msgContext) { EndpointMetaData epMetaData = ((CommonMessageContext)msgContext).getEndpointMetaData(); ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData(); if(serviceMetaData.getSecurityConfiguration() == null) // might be set through ServiceObjectFactory { UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile(); WSSecurityConfiguration config = null; try { WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance(); config = wsseConfFactory.createConfiguration(vfsRoot, getConfigResourceName()); } catch (IOException ex) { WSException.rethrow("Cannot load ws-security config", ex); } // it's required further down the processing chain serviceMetaData.setSecurityConfiguration(config); } return serviceMetaData.getSecurityConfiguration(); } protected abstract String getConfigResourceName(); } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxws/WSSecurityHandlerServer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxws/WS0000644000175000017500000000347010560063272031662 0ustar godgod/* * 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.security.jaxws; import javax.xml.ws.handler.MessageContext; import org.jboss.ws.metadata.wsse.WSSecurityOMFactory; // $Id: WSSecurityHandlerServer.java 2210 2007-01-31 09:51:54Z thomas.diesler@jboss.com $ /** * A JAXWS handler that delegates to the WSSecurityDispatcher * where the request is an inbound message. * * @author Thomas.Diesler@jboss.org * @since 12-Nov-2005 */ public class WSSecurityHandlerServer extends WSSecurityHandler { protected boolean handleInbound(MessageContext msgContext) { return handleInboundSecurity(msgContext); } protected boolean handleOutbound(MessageContext msgContext) { return handleOutboundSecurity(msgContext); } protected String getConfigResourceName() { return WSSecurityOMFactory.SERVER_RESOURCE_NAME; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxws/WSSecurityHandlerClient.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/jaxws/WS0000644000175000017500000000341310560063272031657 0ustar godgod/* * 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.security.jaxws; import javax.xml.ws.handler.MessageContext; import org.jboss.ws.metadata.wsse.WSSecurityOMFactory; // $Id: WSSecurityHandlerClient.java 2210 2007-01-31 09:51:54Z thomas.diesler@jboss.com $ /** * A JAXWS handler that delegates to the WSSecurityDispatcher * * @author Thomas.Diesler@jboss.org * @since 12-Nov-2005 */ public class WSSecurityHandlerClient extends WSSecurityHandler { protected boolean handleInbound(MessageContext msgContext) { return handleInboundSecurity(msgContext); } protected boolean handleOutbound(MessageContext msgContext) { return handleOutboundSecurity(msgContext); } protected String getConfigResourceName() { return WSSecurityOMFactory.CLIENT_RESOURCE_NAME; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/STRTransform.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/STRTrans0000644000175000017500000001424710716057127031666 0ustar godgod/* * 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.security; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import org.apache.xml.security.c14n.CanonicalizationException; import org.apache.xml.security.c14n.Canonicalizer; import org.apache.xml.security.c14n.InvalidCanonicalizerException; import org.apache.xml.security.signature.XMLSignatureInput; import org.apache.xml.security.transforms.Transform; import org.apache.xml.security.transforms.TransformSpi; import org.apache.xml.security.transforms.TransformationException; import org.apache.xml.security.utils.XMLUtils; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.ws.core.utils.ThreadLocalAssociation; import org.jboss.ws.extensions.security.element.BinarySecurityToken; import org.jboss.ws.extensions.security.element.SecurityTokenReference; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Element; import org.xml.sax.SAXException; /** * STRTransform implements the STR-Transform specified in the * WS-Security specification. This class dynamically registers itself with * XML Security on its first load (using a static initializer). * * You must call the static yet thread safe setSecurityStore() before use of * this class. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public class STRTransform extends TransformSpi { public static final String STR_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform"; static { try { Transform.register(STR_URI, STRTransform.class.getName()); } catch (Exception e) { // Eat } } private String canonicalize(Element element, Element method) throws TransformationException, InvalidCanonicalizerException, CanonicalizationException { if (method == null || ! method.getLocalName().equals("CanonicalizationMethod")) throw new TransformationException("CanonicalizationMethod expected!"); String algorithm = method.getAttribute("Algorithm"); if (algorithm == null || algorithm.length() == 0) throw new TransformationException("CanonicalizationMethod missing algorithm!"); Canonicalizer canon = Canonicalizer.getInstance(algorithm); return new String(canon.canonicalizeSubtree(element, "#default")); } @Override protected String engineGetURI() { return STR_URI; } @Override protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input) throws IOException, CanonicalizationException, InvalidCanonicalizerException, TransformationException, ParserConfigurationException, SAXException { SecurityStore store = ThreadLocalAssociation.localStrTransformAssoc().get(); if (store == null) throw new WSException("SecurityStore Thread Local not initialized before call!"); try { if (! input.isElement()) throw new NotImplementedException("Only element input is supported"); // Resolve the BinarySecurityToken associated with this SecurityTokenReference Element element = (Element)input.getSubNode(); SecurityTokenReference ref = new SecurityTokenReference(element); KeyResolver resolver = new KeyResolver(store); BinarySecurityToken token = resolver.resolve(ref); // Get the specially formated dom element for this element element = token.getSTRTransformElement(); // Obtain the canonicalizer specified in the transformation parameters Element parameters = XMLUtils.selectNode(this._transformObject.getElement().getFirstChild(), Constants.WSSE_NS, "TransformationParameters", 0); if (parameters == null) throw new TransformationException("wsse:TransformationParameters expected!"); Element method = Util.getFirstChildElement(parameters); String transformed = canonicalize(element, method); // Now WS-Security says we must augment the transformed output to ensure that there is // a default namespace int startTag = transformed.indexOf('<'); int endTag = transformed.indexOf('>', startTag + 1); String within = transformed.substring(startTag + 1, endTag); if (! within.contains("xmlns=")) { int insPos = within.indexOf(" ") + startTag + 1; transformed = new StringBuilder(transformed).insert(insPos, " xmlns=\"\"").toString(); } return new XMLSignatureInput(transformed.getBytes()); } catch (WSSecurityException e) { throw new TransformationException(e.getMessage(), e); } finally { ThreadLocalAssociation.localStrTransformAssoc().set(null); } } public static void setSecurityStore(SecurityStore store) { ThreadLocalAssociation.localStrTransformAssoc().set(store); } public boolean wantsOctetStream() { return false; } public boolean wantsNodeSet() { return false; } public boolean returnsOctetStream() { return false; } public boolean returnsNodeSet() { return false; } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000755000175000017500000000000010755000256032006 5ustar godgod././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/UnsupportedSecurityTokenException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000644000175000017500000000417710716057127032027 0ustar godgod/* * 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.security.exception; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.Constants; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class UnsupportedSecurityTokenException extends WSSecurityException { public static final QName faultCode = new QName("UnsupportedSecurityToken", Constants.WSSE_PREFIX, Constants.WSSE_NS); public static final String faultString = "An unsupported token was provided."; public UnsupportedSecurityTokenException() { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public UnsupportedSecurityTokenException(Throwable cause) { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public UnsupportedSecurityTokenException(String message) { super(message); setFaultCode(faultCode); setFaultString(message); } public UnsupportedSecurityTokenException(String message, Throwable cause) { super(message, cause); setFaultCode(faultCode); setFaultString(message); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/WSSecurityException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000644000175000017500000000421110716057127032014 0ustar godgod/* * 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.security.exception; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.Constants; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class WSSecurityException extends Exception { private boolean internal = false; private QName faultCode = new QName(Constants.JBOSS_WSSE_NS, "InternalError", Constants.JBOSS_WSSE_PREFIX); private String faultString = "An internal WS-Security error occurred. See log for details"; public WSSecurityException(String message) { super(message); this.internal = true; } public WSSecurityException(String message, Throwable cause) { super(message, cause); this.internal = true; } protected void setFaultCode(QName faultCode) { this.faultCode = faultCode; } protected void setFaultString(String faultMessage) { this.faultString = faultMessage; } public boolean isInternalError() { return internal; } public QName getFaultCode() { return faultCode; } public String getFaultString() { return faultString; } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/FailedCheckException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000644000175000017500000000406710716057127032025 0ustar godgod/* * 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.security.exception; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.Constants; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class FailedCheckException extends WSSecurityException { public static final QName faultCode = new QName(Constants.WSSE_NS, "FailedCheck", Constants.WSSE_PREFIX); public static final String faultString = "The signature or decryption was invlaid."; public FailedCheckException() { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public FailedCheckException(Throwable cause) { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public FailedCheckException(String message) { super(message); setFaultCode(faultCode); setFaultString(message); } public FailedCheckException(String message, Throwable cause) { super(message, cause); setFaultCode(faultCode); setFaultString(message); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/FailedAuthenticationException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000644000175000017500000000420110716057127032013 0ustar godgod/* * 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.security.exception; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.Constants; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class FailedAuthenticationException extends WSSecurityException { public static final QName faultCode = new QName(Constants.WSSE_NS, "FailedAuthentication", Constants.WSSE_PREFIX); public static final String faultString = "The security token could not be authenticated or authorized."; public FailedAuthenticationException() { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public FailedAuthenticationException(Throwable cause) { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public FailedAuthenticationException(String message) { super(message); setFaultCode(faultCode); setFaultString(message); } public FailedAuthenticationException(String message, Throwable cause) { super(message, cause); setFaultCode(faultCode); setFaultString(message); } } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/InvalidSecurityHeaderException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000644000175000017500000000420210716057127032014 0ustar godgod/* * 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.security.exception; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.Constants; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class InvalidSecurityHeaderException extends WSSecurityException { public static final QName faultCode = new QName(Constants.WSSE_NS, "InvalidSecurity", Constants.WSSE_PREFIX); public static final String faultString = "An error was dicovered processing the header."; public InvalidSecurityHeaderException() { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public InvalidSecurityHeaderException(Throwable cause) { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public InvalidSecurityHeaderException(String message) { super(message); setFaultCode(faultCode); setFaultString(message); } public InvalidSecurityHeaderException(String message, Throwable cause) { super(message, cause); setFaultCode(faultCode); setFaultString(message); } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/SecurityTokenUnavailableException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000644000175000017500000000421610716057127032021 0ustar godgod/* * 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.security.exception; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.Constants; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class SecurityTokenUnavailableException extends WSSecurityException { public static final QName faultCode = new QName(Constants.WSSE_NS, "SecurityTokenUnavailable", Constants.WSSE_PREFIX); public static final String faultString = "Referenced security token could not be retrieved."; public SecurityTokenUnavailableException() { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public SecurityTokenUnavailableException(Throwable cause) { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public SecurityTokenUnavailableException(String message) { super(message); setFaultCode(faultCode); setFaultString(message); } public SecurityTokenUnavailableException(String message, Throwable cause) { super(message, cause); setFaultCode(faultCode); setFaultString(message); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/InvalidSecurityTokenException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000644000175000017500000000415510716057127032023 0ustar godgod/* * 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.security.exception; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.Constants; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class InvalidSecurityTokenException extends WSSecurityException { public static final QName faultCode = new QName(Constants.WSSE_NS, "InvlalidSecurityToken", Constants.WSSE_PREFIX); public static final String faultString = "An invlaid security token was provided."; public InvalidSecurityTokenException() { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public InvalidSecurityTokenException(Throwable cause) { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public InvalidSecurityTokenException(String message) { super(message); setFaultCode(faultCode); setFaultString(message); } public InvalidSecurityTokenException(String message, Throwable cause) { super(message, cause); setFaultCode(faultCode); setFaultString(message); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exception/UnsupportedAlgorithmException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/exceptio0000644000175000017500000000420010716057127032012 0ustar godgod/* * 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.security.exception; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.Constants; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class UnsupportedAlgorithmException extends WSSecurityException { public static final QName faultCode = new QName("UnsupportedAlgorithm", Constants.WSSE_PREFIX, Constants.WSSE_NS); public static final String faultString = "An unsupported signature or encryption algorithm was used."; public UnsupportedAlgorithmException() { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public UnsupportedAlgorithmException(Throwable cause) { super(faultString); setFaultCode(faultCode); setFaultString(faultString); } public UnsupportedAlgorithmException(String message) { super(message); setFaultCode(faultCode); setFaultString(message); } public UnsupportedAlgorithmException(String message, Throwable cause) { super(message, cause); setFaultCode(faultCode); setFaultString(message); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/WSSecurityDispatcher.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/WSSecuri0000644000175000017500000003123210716057127031703 0ustar godgod/* * 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.security; // $Id: WSSecurityDispatcher.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import javax.xml.rpc.Stub; import javax.xml.rpc.soap.SOAPFaultException; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.ws.BindingProvider; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.CommonSOAPFaultException; import org.jboss.ws.core.StubExt; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.extensions.security.exception.InvalidSecurityHeaderException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.wsse.Config; import org.jboss.ws.metadata.wsse.Encrypt; import org.jboss.ws.metadata.wsse.Operation; import org.jboss.ws.metadata.wsse.Port; import org.jboss.ws.metadata.wsse.RequireEncryption; import org.jboss.ws.metadata.wsse.RequireSignature; import org.jboss.ws.metadata.wsse.RequireTimestamp; import org.jboss.ws.metadata.wsse.Requires; import org.jboss.ws.metadata.wsse.Sign; import org.jboss.ws.metadata.wsse.Timestamp; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; public class WSSecurityDispatcher { // provide logging private static Logger log = Logger.getLogger(WSSecurityDispatcher.class); private static List convertTargets(List targets) { if (targets == null) return null; ArrayList newList = new ArrayList(targets.size()); for (org.jboss.ws.metadata.wsse.Target target : targets) { if ("qname".equals(target.getType())) { QNameTarget qnameTarget = new QNameTarget(QName.valueOf(target.getValue()), target.isContentOnly()); newList.add(qnameTarget); } else if ("wsuid".equals(target.getType())) { newList.add(new WsuIdTarget(target.getValue())); } } return newList; } private static Config getConfig(WSSecurityConfiguration config, String portName, String opName) { Port port = config.getPorts().get(portName); if (port == null) return config.getDefaultConfig(); Operation operation = port.getOperations().get(opName); if (operation == null) { Config portConfig = port.getDefaultConfig(); return (portConfig == null) ? config.getDefaultConfig() : portConfig; } return operation.getConfig(); } private static CommonSOAPFaultException convertToFault(WSSecurityException e) { return new CommonSOAPFaultException(e.getFaultCode(), e.getFaultString()); } public static void handleInbound(CommonMessageContext ctx) throws SOAPException, SOAPFaultException { WSSecurityConfiguration config = getSecurityConfig(ctx); SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage(); SOAPHeader soapHeader = soapMessage.getSOAPHeader(); QName secQName = new QName(Constants.WSSE_NS, "Security"); Element secHeaderElement = Util.findElement(soapHeader, secQName); if (secHeaderElement == null) { // This is ok, we always allow faults to be received because WS-Security does not encrypt faults if (soapMessage.getSOAPBody().getFault() != null) return; OperationMetaData opMetaData = ctx.getOperationMetaData(); if (opMetaData == null) { // Get the operation meta data from the soap message // for the server side inbound message. EndpointMetaData epMetaData = ctx.getEndpointMetaData(); opMetaData = soapMessage.getOperationMetaData(epMetaData); } String operation = opMetaData.getQName().toString(); String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart(); if (hasRequirements(config, operation, port)) throw convertToFault(new InvalidSecurityHeaderException("This service requires , which is missing.")); return; } try { SecurityStore securityStore = new SecurityStore(config.getKeyStoreURL(), config.getKeyStoreType(), config.getKeyStorePassword(), config.getKeyPasswords(), config.getTrustStoreURL(), config.getTrustStoreType(), config.getTrustStorePassword()); SecurityDecoder decoder = new SecurityDecoder(securityStore); decoder.decode(soapMessage.getSOAPPart(), secHeaderElement); if (log.isTraceEnabled()) log.trace("Decoded Message:\n" + DOMWriter.printNode(soapMessage.getSOAPPart(), true)); OperationMetaData opMetaData = ctx.getOperationMetaData(); if (opMetaData == null) { // Get the operation meta data from the soap message // for the server side inbound message. EndpointMetaData epMetaData = ctx.getEndpointMetaData(); opMetaData = soapMessage.getOperationMetaData(epMetaData); } String operation = opMetaData.getQName().toString(); String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart(); List> operations = buildRequireOperations(config, operation, port); decoder.verify(operations); if(log.isDebugEnabled()) log.debug("Verification is successful"); decoder.complete(); } catch (WSSecurityException e) { if (e.isInternalError()) log.error("Internal error occured handling inbound message:", e); else if(log.isDebugEnabled()) log.debug("Returning error to sender: " + e.getMessage()); throw convertToFault(e); } } private static WSSecurityConfiguration getSecurityConfig(CommonMessageContext ctx) { WSSecurityConfiguration config = ctx.getEndpointMetaData().getServiceMetaData().getSecurityConfiguration(); if (config == null) throw new WSException("Cannot obtain security configuration from message context"); return config; } private static boolean hasRequirements(WSSecurityConfiguration config, String operation, String port) { Config operationConfig = getConfig(config, port, operation); return (operationConfig != null && operationConfig.getRequires() != null); } private static List> buildRequireOperations(WSSecurityConfiguration config, String operation, String port) { Config operationConfig = getConfig(config, port, operation); if (operationConfig == null) return null; Requires requires = operationConfig.getRequires(); if (requires == null) return null; ArrayList> operations = new ArrayList>(); RequireTimestamp requireTimestamp = requires.getRequireTimestamp(); if (requireTimestamp != null) operations.add(new OperationDescription(RequireTimestampOperation.class, null, requireTimestamp.getMaxAge(), null, null, null, null)); RequireSignature requireSignature = requires.getRequireSignature(); if (requireSignature != null) { List targets = convertTargets(requireSignature.getTargets()); operations.add(new OperationDescription(RequireSignatureOperation.class, targets, null, null, null, null, null)); } RequireEncryption requireEncryption = requires.getRequireEncryption(); if (requireEncryption != null) { List targets = convertTargets(requireEncryption.getTargets()); operations.add(new OperationDescription(RequireEncryptionOperation.class, targets, null, null, null, null, null)); } return operations; } public static void handleOutbound(CommonMessageContext ctx) throws SOAPException, SOAPFaultException { WSSecurityConfiguration config = getSecurityConfig(ctx); SOAPMessageImpl soapMessage = (SOAPMessageImpl)ctx.getSOAPMessage(); EndpointMetaData epMetaData = ctx.getEndpointMetaData(); String port = epMetaData.getPortName().getLocalPart(); String opName = null; OperationMetaData opMetaData = ctx.getOperationMetaData(); if (opMetaData != null) opName = opMetaData.getQName().toString(); Config opConfig = getConfig(config, port, opName); log.debug("WS-Security config: " + opConfig); // Nothing to process if (opConfig == null) return; ArrayList> operations = new ArrayList>(); Timestamp timestamp = opConfig.getTimestamp(); if (timestamp != null) { operations.add(new OperationDescription(TimestampOperation.class, null, null, timestamp.getTtl(), null, null, null)); } if (opConfig.getUsername() != null) { Object user = ctx.get(Stub.USERNAME_PROPERTY); Object pass = ctx.get(Stub.PASSWORD_PROPERTY); if (user == null && pass == null) { user = ctx.get(BindingProvider.USERNAME_PROPERTY); pass = ctx.get(BindingProvider.PASSWORD_PROPERTY); } if (user != null && pass != null) { operations.add(new OperationDescription(SendUsernameOperation.class, null, user.toString(), pass.toString(), null, null, null)); ctx.put(StubExt.PROPERTY_AUTH_TYPE, StubExt.PROPERTY_AUTH_TYPE_WSSE); } } Sign sign = opConfig.getSign(); if (sign != null) { List targets = convertTargets(sign.getTargets()); if (sign.isIncludeTimestamp()) { if (timestamp == null) operations.add(new OperationDescription(TimestampOperation.class, null, null, null, null, null, null)); if (targets != null && targets.size() > 0) targets.add(new WsuIdTarget("timestamp")); } operations.add(new OperationDescription(SignatureOperation.class, targets, sign.getAlias(), null, null, null, sign.getTokenRefType())); } Encrypt encrypt = opConfig.getEncrypt(); if (encrypt != null) { List targets = convertTargets(encrypt.getTargets()); operations.add(new OperationDescription(EncryptionOperation.class, targets, encrypt.getAlias(), null, encrypt.getAlgorithm(), encrypt.getWrap(), encrypt.getTokenRefType())); } if (operations.size() == 0) return; if(log.isDebugEnabled()) log.debug("Encoding Message:\n" + DOMWriter.printNode(soapMessage.getSOAPPart(), true)); try { SecurityStore securityStore = new SecurityStore(config.getKeyStoreURL(), config.getKeyStoreType(), config.getKeyStorePassword(), config.getKeyPasswords() , config.getTrustStoreURL(), config.getTrustStoreType(), config.getTrustStorePassword()); SecurityEncoder encoder = new SecurityEncoder(operations, securityStore); encoder.encode(soapMessage.getSOAPPart()); } catch (WSSecurityException e) { if (e.isInternalError()) log.error("Internal error occured handling outbound message:", e); else if(log.isDebugEnabled()) log.debug("Returning error to sender: " + e.getMessage()); throw convertToFault(e); } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Constants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Constant0000644000175000017500000000553310576442423031776 0ustar godgod/* * 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.security; import javax.xml.namespace.QName; import org.apache.xml.security.utils.EncryptionConstants; /** * @author Jason T. Greene * @version $Id: Constants.java 2629 2007-03-16 07:19:47Z jason.greene@jboss.com $ */ public class Constants { public static final String WSS_SOAP_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0"; public static final String JBOSS_WSSE_NS = "http://www.jboss.com/jbossws/ws-security"; public static final String JBOSS_WSSE_PREFIX = "jboss-wsse"; public static final String WSSE_PREFIX = "wsse"; public static final String WSSE_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; public static final String WSU_PREFIX = "wsu"; public static final String WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; public static final String XML_SIGNATURE_NS = org.apache.xml.security.utils.Constants.SignatureSpecNS; public static final String XML_ENCRYPTION_NS = EncryptionConstants.EncryptionSpecNS; public static final String XML_ENCRYPTION_PREFIX = "xenc"; public static final String ID = "Id"; public static final String WSU_ID = WSU_PREFIX + ":" + ID; public static final String BASE64_ENCODING_TYPE = WSS_SOAP_NS + "#Base64Binary"; public static final String WSSE_HEADER = WSSE_PREFIX + ":Security"; public static final String XMLNS_NS = "http://www.w3.org/2000/xmlns/"; public static final String XENC_DATAREFERENCE = "DataReference"; public static final String XENC_REFERENCELIST = "ReferenceList"; public static final String XENC_ELEMENT_TYPE = EncryptionConstants.TYPE_ELEMENT; public static final String XENC_CONTENT_TYPE = EncryptionConstants.TYPE_CONTENT; public static final QName WSSE_HEADER_QNAME = new QName(WSSE_NS, "Security"); } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SendUsernameOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SendUser0000644000175000017500000000345710716057127031737 0ustar godgod/* * 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.security; import java.util.List; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.UsernameToken; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; public class SendUsernameOperation implements EncodingOperation { private SecurityHeader header; private SecurityStore store; public SendUsernameOperation(SecurityHeader header, SecurityStore store) { this.header = header; this.store = store; } public void process(Document message, List targets, String username, String credential, String algorithm, String keyWrapAlgorithm, String tokenRefType) throws WSSecurityException { header.addToken(new UsernameToken(username, credential, message)); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/KeyResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/KeyResol0000644000175000017500000001430710716057127031740 0ustar godgod/* * 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.security; import java.security.PrivateKey; import java.security.PublicKey; import java.security.cert.X509Certificate; import java.util.HashMap; import org.apache.xml.security.keys.KeyInfo; import org.jboss.util.NotImplementedException; import org.jboss.ws.extensions.security.element.BinarySecurityToken; import org.jboss.ws.extensions.security.element.DirectReference; import org.jboss.ws.extensions.security.element.KeyIdentifier; import org.jboss.ws.extensions.security.element.Reference; import org.jboss.ws.extensions.security.element.SecurityTokenReference; import org.jboss.ws.extensions.security.element.X509IssuerSerial; import org.jboss.ws.extensions.security.element.X509Token; import org.jboss.ws.extensions.security.exception.SecurityTokenUnavailableException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Element; /** * KeyResolver is responsible for locating security tokens * within a WS-Security message. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public class KeyResolver { private HashMap tokenCache = new HashMap(); private SecurityStore store; public KeyResolver(SecurityStore store) { this.store = store; } private SecurityTokenReference extractSecurityTokenReference(KeyInfo info) throws WSSecurityException { Element child = Util.getFirstChildElement(info.getElement()); if (child == null) throw new WSSecurityException("Empty KeyInfo"); if (! child.getLocalName().equals("SecurityTokenReference")) throw new WSSecurityException("KeyInfo did not contain expected SecurityTokenReference, instead got: " + child.getLocalName()); return new SecurityTokenReference(child); } public void cacheToken(BinarySecurityToken token) { tokenCache.put(token.getId(), token); } public BinarySecurityToken resolve(SecurityTokenReference reference) throws WSSecurityException { Reference ref = reference.getReference(); if (ref instanceof DirectReference) { DirectReference direct = (DirectReference) ref; return resolveDirectReference(direct); } else if (ref instanceof KeyIdentifier) { KeyIdentifier identifier = (KeyIdentifier) ref; return resolveKeyIdentifier(identifier); } else if (ref instanceof X509IssuerSerial) { X509IssuerSerial issuerSerial = (X509IssuerSerial) ref; return resolveX509IssuerSerial(issuerSerial); } throw new NotImplementedException("Currently only DirectReference is supported!"); } private BinarySecurityToken resolveDirectReference(DirectReference direct) throws WSSecurityException { String id = direct.getUri().substring(1); BinarySecurityToken token = tokenCache.get(id); if (token == null) throw new SecurityTokenUnavailableException("Could not resolve token id: " + id); return token; } private BinarySecurityToken resolveKeyIdentifier(KeyIdentifier identifier) throws WSSecurityException { // Support only SKI at the moment X509Certificate cert = store.getCertificateBySubjectKeyIdentifier(identifier.getIdentifier()); if (cert == null) throw new SecurityTokenUnavailableException("Could not locate certificate by key identifier"); return new X509Token(cert, identifier.getDocument()); } private BinarySecurityToken resolveX509IssuerSerial(X509IssuerSerial issuerSerial) throws WSSecurityException { X509Certificate cert = store.getCertificateByIssuerSerial(issuerSerial.getIssuer(), issuerSerial.getSerial()); if (cert == null) throw new SecurityTokenUnavailableException("Could not locate certificate by issuer and serial number"); return new X509Token(cert, issuerSerial.getDocument()); } public X509Certificate resolveCertificate(SecurityTokenReference reference) throws WSSecurityException { BinarySecurityToken token = resolve(reference); if (! (token instanceof X509Token)) throw new WSSecurityException("Expected X509Token, cache contained: " + token.getClass().getName()); return ((X509Token)token).getCert(); } public PublicKey resolvePublicKey(SecurityTokenReference reference) throws WSSecurityException { return resolveCertificate(reference).getPublicKey(); } public PrivateKey resolvePrivateKey(SecurityTokenReference reference) throws WSSecurityException { return store.getPrivateKey(resolveCertificate(reference)); } public BinarySecurityToken resolve(KeyInfo info) throws WSSecurityException { return resolve(extractSecurityTokenReference(info)); } public X509Certificate resolveCertificate(KeyInfo info) throws WSSecurityException { return resolveCertificate(extractSecurityTokenReference(info)); } public PublicKey resolvePublicKey(KeyInfo info) throws WSSecurityException { return resolvePublicKey(extractSecurityTokenReference(info)); } public PrivateKey resolvePrivateKey(KeyInfo info) throws WSSecurityException { return resolvePrivateKey(extractSecurityTokenReference(info)); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SignatureOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Signatur0000644000175000017500000001413110716057127031772 0ustar godgod/* * 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.security; import java.security.PrivateKey; import java.security.cert.X509Certificate; import java.util.List; import javax.xml.namespace.QName; import org.apache.xml.security.c14n.Canonicalizer; import org.apache.xml.security.exceptions.XMLSecurityException; import org.apache.xml.security.signature.XMLSignature; import org.apache.xml.security.signature.XMLSignatureException; import org.apache.xml.security.transforms.TransformationException; import org.apache.xml.security.transforms.Transforms; import org.jboss.util.NotImplementedException; import org.jboss.ws.extensions.security.element.Reference; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.SecurityTokenReference; import org.jboss.ws.extensions.security.element.Signature; import org.jboss.ws.extensions.security.element.X509Token; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; public class SignatureOperation implements EncodingOperation { private SecurityHeader header; private SecurityStore store; public SignatureOperation(SecurityHeader header, SecurityStore store) throws WSSecurityException { this.header = header; this.store = store; } private void processTarget(XMLSignature sig, Document message, Target target) { if (target instanceof QNameTarget) processQNameTarget(sig, message, (QNameTarget) target); else if (target instanceof WsuIdTarget) processWsuIdTarget(sig, message, (WsuIdTarget) target); else throw new NotImplementedException(); } private void processQNameTarget(XMLSignature sig, Document message, QNameTarget target) { QName name = target.getName(); Transforms transforms = new Transforms(message); try { transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); } catch (TransformationException e) { throw new RuntimeException(e); } Element element = Util.findElement(message.getDocumentElement(), name); if (element == null) throw new RuntimeException("Could not find element"); String id = Util.assignWsuId(element); try { sig.addDocument("#" + id, transforms); } catch (XMLSignatureException e) { throw new RuntimeException(e); } } private void processWsuIdTarget(XMLSignature sig, Document message, WsuIdTarget target) { String id = target.getId(); Transforms transforms = new Transforms(message); try { transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS); } catch (TransformationException e) { throw new RuntimeException(e); } try { sig.addDocument("#" + id, transforms); } catch (XMLSignatureException e) { throw new RuntimeException(e); } } public void process(Document message, List targets, String alias, String credential, String algorithm, String keyWrapAlgorithm, String tokenRefType) throws WSSecurityException { Element envelope = message.getDocumentElement(); XMLSignature sig; try { sig = new XMLSignature(message, null, XMLSignature.ALGO_ID_SIGNATURE_RSA, Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); } catch (XMLSecurityException e) { throw new WSSecurityException("Error building signature", e); } // For now we pass our resolver the root document because the signature element isn't attached // to the evelope yet (no wsse header). Perhaps we should do this differently sig.addResourceResolver(new WsuIdResolver(message, header.getElement())); PrivateKey key = store.getPrivateKey(alias); if (targets == null || targets.size() == 0) { // By default we sign the body element, and a timestamp if it is available String namespace = envelope.getNamespaceURI(); processTarget(sig, message, new QNameTarget(new QName(namespace, "Body"))); if (header.getTimestamp() != null) processTarget(sig, message, new WsuIdTarget("timestamp")); } else { for (Target target : targets) processTarget(sig, message, target); } try { sig.sign(key); } catch (XMLSignatureException e) { throw new WSSecurityException("Error signing message: " + e.getMessage(), e); } X509Certificate cert = store.getCertificate(alias); X509Token token = (X509Token) header.getSharedToken(cert); // Can we reuse an existing token? if (token == null) { token = new X509Token(cert, message); if (tokenRefType == null || Reference.DIRECT_REFERENCE.equals(tokenRefType)) header.addToken(token); } SecurityTokenReference reference = new SecurityTokenReference(Reference.getReference(tokenRefType, message, token)); sig.getKeyInfo().addUnknownElement(reference.getElement()); header.addSecurityProcess(new Signature(sig)); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/WsuIdResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/WsuIdRes0000644000175000017500000000557610542776150031721 0ustar godgod/* * 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.security; import org.apache.xml.security.signature.XMLSignatureInput; import org.apache.xml.security.utils.resolver.ResourceResolverException; import org.apache.xml.security.utils.resolver.ResourceResolverSpi; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Id: WsuIdResolver.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ */ public class WsuIdResolver extends ResourceResolverSpi { Document doc; Element header; public WsuIdResolver(Document doc) { this.doc = doc; } public WsuIdResolver(Document doc, Element header) { this.doc = doc; this.header = header; } /** * @see org.apache.xml.security.utils.resolver.ResourceResolverSpi#engineCanResolve(org.w3c.dom.Attr, java.lang.String) */ public boolean engineCanResolve(Attr uri, String baseURI) { if (uri == null) return false; String nodeValue = uri.getNodeValue(); return nodeValue != null && nodeValue.startsWith("#"); } /** * @see org.apache.xml.security.utils.resolver.ResourceResolverSpi#engineResolve(org.w3c.dom.Attr, java.lang.String) */ public XMLSignatureInput engineResolve(Attr uri, String BaseURI) throws ResourceResolverException { //Document doc = uri.getOwnerDocument(); String id = uri.getValue().substring(1); Element element = doc.getDocumentElement(); element = Util.findElementByWsuId(element, id); // If its not in the document, try the header if (element == null && header != null) element = Util.findElementByWsuId(header, id); if (element == null) throw new ResourceResolverException(id, uri, BaseURI); XMLSignatureInput input = new XMLSignatureInput(element); input.setMIMEType("text/xml"); input.setSourceURI(BaseURI + uri); return input; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireTargetableOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireT0000644000175000017500000000661310716057127031744 0ustar godgod/* * 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.security; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.xml.namespace.QName; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.exception.FailedCheckException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; public class RequireTargetableOperation implements RequireOperation { public RequireTargetableOperation(SecurityHeader header, SecurityStore store) throws WSSecurityException { } private Collection resolveTarget(Document message, Target target) throws WSSecurityException { if (target instanceof QNameTarget) return resolveQNameTarget(message, (QNameTarget) target); else if (target instanceof WsuIdTarget) { Collection result = new ArrayList(1); result.add(((WsuIdTarget)target).getId()); return result; } throw new WSSecurityException("Unknown target"); } private Collection resolveQNameTarget(Document message, QNameTarget target) throws WSSecurityException { QName name = target.getName(); Element element = Util.findElement(message.getDocumentElement(), name); if (element == null) throw new FailedCheckException("Required QName was not present: " + name); String id = Util.getWsuId(element); if (id == null) throw new FailedCheckException("Required element did not contain a wsu:id."); Collection result = new ArrayList(1); result.add(id); return result; } public void process(Document message, List targets, String alias, String credential, Collection processedIds) throws WSSecurityException { if (targets == null || targets.size() == 0) { // By default we require just the body element String namespace = message.getDocumentElement().getNamespaceURI(); targets = new ArrayList(1); targets.add(new QNameTarget(new QName(namespace, "Body"), true)); } for (Target target : targets) { Collection ids = resolveTarget(message, target); if (! processedIds.containsAll(ids)) throw new FailedCheckException("Required elements for encryption and or signing are not all present."); } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/TimestampOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Timestam0000644000175000017500000000376510716057127031774 0ustar godgod/* * 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.security; import java.util.List; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.Timestamp; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; public class TimestampOperation implements EncodingOperation { private SecurityHeader header; private SecurityStore store; public TimestampOperation(SecurityHeader header, SecurityStore store) { this.header = header; this.store = store; } public void process(Document message, List targets, String alias, String credential, String algorithm, String keyWrapAlgorithm, String tokenRefType) throws WSSecurityException { Integer ttl = null; try { // Time to live is stuffed in the credential field ttl = Integer.valueOf(credential); } catch (NumberFormatException e) { // Eat } header.setTimestamp(new Timestamp(ttl, message)); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireSignatureOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireS0000644000175000017500000000256510716057127031745 0ustar godgod/* * 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.security; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.exception.WSSecurityException; public class RequireSignatureOperation extends RequireTargetableOperation { public RequireSignatureOperation(SecurityHeader header, SecurityStore store) throws WSSecurityException { super(header, store); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireTimestampOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireT0000644000175000017500000000447110716057127031744 0ustar godgod/* * 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.security; import java.util.Calendar; import java.util.Collection; import java.util.List; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.Timestamp; import org.jboss.ws.extensions.security.exception.FailedCheckException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; public class RequireTimestampOperation implements RequireOperation { private SecurityHeader header; public RequireTimestampOperation(SecurityHeader header, SecurityStore store) throws WSSecurityException { this.header = header; } public void process(Document message, List targets, String maxAge, String credential, Collection processedIds) throws WSSecurityException { Timestamp stamp = header.getTimestamp(); if (stamp == null) throw new FailedCheckException("Required timestamp not present."); // If there is no maxAge specified then we are done if (maxAge == null) return; int max = Integer.parseInt(maxAge); Calendar expired = (Calendar)stamp.getCreated().clone(); expired.add(Calendar.SECOND, max); if (! Calendar.getInstance().before(expired)) throw new FailedCheckException("Timestamp of message is too old."); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SecurityStore.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Security0000644000175000017500000004007410716057127032012 0ustar godgod/* * 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.security; // $Id: SecurityStore.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ import java.io.BufferedReader; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.security.InvalidAlgorithmParameterException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.PrivateKey; import java.security.cert.CertPath; import java.security.cert.CertPathValidator; import java.security.cert.CertPathValidatorException; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.PKIXParameters; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.StringTokenizer; import org.jboss.logging.Logger; import org.jboss.ws.extensions.security.exception.FailedAuthenticationException; import org.jboss.ws.extensions.security.exception.WSSecurityException; /** * SecurityStore holds and loads the keystore and truststore required for encyption and signing. * * @author Jason T. Greene * @author Magesh Kumar B * @author Thomas.Diesler@jboss.com */ public class SecurityStore { private static Logger log = Logger.getLogger(SecurityStore.class); private KeyStore keyStore; private String keyStorePassword; private KeyStore trustStore; private String trustStorePassword; private HashMap keyPasswords; public SecurityStore() throws WSSecurityException { this(null, null, null, null, null, null, null); } public SecurityStore(URL keyStoreURL, String keyStoreType, String keyStorePassword, HashMap keyPasswords) throws WSSecurityException { loadKeyStore(keyStoreURL, keyStoreType, keyStorePassword); loadTrustStore(keyStoreURL, keyStoreType, keyStorePassword); this.keyPasswords = keyPasswords; } public SecurityStore(URL keyStoreURL, String keyStoreType, String keyStorePassword, HashMap keyPasswords, URL trustStoreURL, String trustStoreType, String trustStorePassword) throws WSSecurityException { loadKeyStore(keyStoreURL, keyStoreType, keyStorePassword); loadTrustStore(trustStoreURL, trustStoreType, trustStorePassword); this.keyPasswords = keyPasswords; } private void loadKeyStore(URL keyStoreURL, String keyStoreType, String keyStorePassword) throws WSSecurityException { if (keyStorePassword == null) keyStorePassword = System.getProperty("org.jboss.ws.wsse.keyStorePassword"); keyStore = loadStore("org.jboss.ws.wsse.keyStore", "Keystore", keyStoreURL, keyStoreType, keyStorePassword); this.keyStorePassword = keyStorePassword; } private void loadTrustStore(URL trustStoreURL, String trustStoreType, String trustStorePassword) throws WSSecurityException { if (trustStorePassword == null) trustStorePassword = System.getProperty("org.jboss.ws.wsse.trustStorePassword"); trustStore = loadStore("org.jboss.ws.wsse.trustStore", "Truststore", trustStoreURL, trustStoreType, trustStorePassword); this.trustStorePassword = trustStorePassword; } private KeyStore loadStore(String property, String type, URL storeURL, String storeType, String storePassword) throws WSSecurityException { if (storeURL == null) { String defaultStore = System.getProperty(property); if (defaultStore == null) { return null; } File storeFile = new File(defaultStore); try { storeURL = storeFile.toURL(); } catch (MalformedURLException e) { throw new WSSecurityException("Problems loading " + type + ": " + e.getMessage(), e); } } if (storeType == null) storeType = System.getProperty(property + "Type"); if (storeType == null) storeType = "jks"; KeyStore keyStore = null; try { log.debug("loadStore: " + storeURL); InputStream stream = storeURL.openStream(); if (stream == null) throw new WSSecurityException("Cannot load store from: " + storeURL); keyStore = KeyStore.getInstance(storeType); if (keyStore == null) throw new WSSecurityException("Cannot get keystore for type: " + storeType); String decryptedPassword = decryptPassword(storePassword); if (decryptedPassword == null) throw new WSSecurityException("Cannot decrypt store password"); keyStore.load(stream, decryptedPassword.toCharArray()); } catch (RuntimeException rte) { throw rte; } catch (WSSecurityException ex) { throw ex; } catch (Exception ex) { throw new WSSecurityException("Problems loading " + type + ": " + ex.getMessage(), ex); } return keyStore; } /** * This method examines the password for the presence of a encryption algorithm, if found * decrypts and returns the password, else returns the password as is. */ private String decryptPassword(String password) throws WSSecurityException { log.trace("decrypt password: " + password); if (password == null) throw new WSSecurityException("Invalid null password for security store"); if (password.charAt(0) == '{') { StringTokenizer tokenizer = new StringTokenizer(password, "{}"); String keyStorePasswordCmdType = tokenizer.nextToken(); String keyStorePasswordCmd = tokenizer.nextToken(); if (keyStorePasswordCmdType.equals("EXT")) { password = execPasswordCmd(keyStorePasswordCmd); } else if (keyStorePasswordCmdType.equals("CLASS")) { password = invokePasswordClass(keyStorePasswordCmd); } else { throw new WSSecurityException("Unknown keyStorePasswordCmdType: " + keyStorePasswordCmdType); } } if (password == null) throw new WSSecurityException("Cannot decrypt password, result is null"); log.trace("decrypted password: " + password); return password; } private String execPasswordCmd(String keyStorePasswordCmd) throws WSSecurityException { log.debug("Executing cmd: " + keyStorePasswordCmd); try { String password = null; Runtime rt = Runtime.getRuntime(); Process p = rt.exec(keyStorePasswordCmd); int status = p.waitFor(); if (status == 0) { InputStream stdin = p.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(stdin)); password = reader.readLine(); stdin.close(); } else { InputStream stderr = p.getErrorStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(stderr)); String line = reader.readLine(); while (line != null) { log.error(line); line = reader.readLine(); } stderr.close(); } log.debug("Command exited with: " + status); return password; } catch (Exception e) { throw new WSSecurityException("Problems executing password cmd: " + keyStorePasswordCmd, e); } } private String invokePasswordClass(String keyStorePasswordCmd) throws WSSecurityException { String password = null; String classname = keyStorePasswordCmd; String ctorArg = null; int colon = keyStorePasswordCmd.indexOf(':'); if (colon > 0) { classname = keyStorePasswordCmd.substring(0, colon); ctorArg = keyStorePasswordCmd.substring(colon + 1); } log.debug("Loading class: " + classname + ", ctorArg=" + ctorArg); try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class c = loader.loadClass(classname); Object instance = null; if (ctorArg != null) { Class[] sig = { String.class }; Constructor ctor = c.getConstructor(sig); Object[] args = { ctorArg }; instance = ctor.newInstance(args); } else { instance = c.newInstance(); } try { log.debug("Checking for toCharArray"); Class[] sig = {}; Method toCharArray = c.getMethod("toCharArray", sig); Object[] args = {}; log.debug("Invoking toCharArray"); password = new String((char[])toCharArray.invoke(instance, args)); } catch (NoSuchMethodException e) { log.debug("No toCharArray found, invoking toString"); password = instance.toString(); } } catch (Exception e) { throw new WSSecurityException("Problems loading or invoking Password class : " + classname, e); } return password; } public static byte[] getSubjectKeyIdentifier(X509Certificate cert) { // Maybee we should make one ourselves if it isn't there? byte[] encoded = cert.getExtensionValue("2.5.29.14"); if (encoded == null) return null; // We need to skip 4 bytes [(OCTET STRING) (LENGTH)[(OCTET STRING) (LENGTH) (Actual data)]] int trunc = encoded.length - 4; byte[] identifier = new byte[trunc]; System.arraycopy(encoded, 4, identifier, 0, trunc); return identifier; } public X509Certificate getCertificate(String alias) throws WSSecurityException { if (keyStore == null) { throw new WSSecurityException("KeyStore not set."); } X509Certificate cert; try { cert = (X509Certificate)keyStore.getCertificate(alias); } catch (Exception e) { throw new WSSecurityException("Problems retrieving cert: " + e.getMessage(), e); } if (cert == null) throw new WSSecurityException("Certificate (" + alias + ") not in keystore"); return cert; } public X509Certificate getCertificateBySubjectKeyIdentifier(byte[] identifier) throws WSSecurityException { if (identifier == null) return null; if (keyStore == null) { throw new WSSecurityException("KeyStore not set."); } try { Enumeration i = keyStore.aliases(); while (i.hasMoreElements()) { String alias = (String)i.nextElement(); Certificate cert = keyStore.getCertificate(alias); if (!(cert instanceof X509Certificate)) continue; byte[] subjectKeyIdentifier = getSubjectKeyIdentifier((X509Certificate)cert); if (subjectKeyIdentifier == null) continue; if (Arrays.equals(identifier, subjectKeyIdentifier)) return (X509Certificate)cert; } } catch (KeyStoreException e) { throw new WSSecurityException("Problems retrieving cert: " + e.getMessage(), e); } return null; } public X509Certificate getCertificateByIssuerSerial(String issuer, String serial) throws WSSecurityException { if (keyStore == null) { throw new WSSecurityException("KeyStore not set."); } try { Enumeration i = keyStore.aliases(); while (i.hasMoreElements()) { String alias = (String)i.nextElement(); Certificate cert = keyStore.getCertificate(alias); if (!(cert instanceof X509Certificate)) continue; X509Certificate x509 = (X509Certificate)cert; if (issuer.equals(x509.getIssuerDN().toString()) && serial.equals(x509.getSerialNumber().toString())) return x509; } } catch (KeyStoreException e) { throw new WSSecurityException("Problems retrieving cert: " + e.getMessage(), e); } return null; } public PrivateKey getPrivateKey(String alias) throws WSSecurityException { if (keyStore == null) { throw new WSSecurityException("KeyStore not set."); } PrivateKey key; try { String password = keyStorePassword; if (keyPasswords != null && keyPasswords.containsKey(alias)) password = keyPasswords.get(alias); key = (PrivateKey)keyStore.getKey(alias, decryptPassword(password).toCharArray()); } catch (Exception e) { throw new WSSecurityException("Problems retrieving private key: " + e.getMessage(), e); } if (key == null) throw new WSSecurityException("Private key (" + alias + ") not in keystore"); return key; } public PrivateKey getPrivateKey(X509Certificate cert) throws WSSecurityException { if (keyStore == null) { throw new WSSecurityException("KeyStore not set."); } try { String alias = keyStore.getCertificateAlias(cert); return getPrivateKey(alias); } catch (Exception e) { throw new WSSecurityException("Problems retrieving private key: " + e.getMessage(), e); } } public void validateCertificate(X509Certificate cert) throws WSSecurityException { try { cert.checkValidity(); } catch (Exception e) { log.debug("Certificate is invalid", e); throw new FailedAuthenticationException(); } if (keyStore == null) { throw new WSSecurityException("TrustStore not set."); } // Check for the exact entry in the truststore first, then fallback to a CA check try { if (trustStore.getCertificateAlias(cert) != null) { return; } } catch (KeyStoreException e) { throw new WSSecurityException("Problems searching truststore", e); } List list = new ArrayList(1); list.add(cert); CertPath cp; CertPathValidator cpv; PKIXParameters parameters; try { cp = CertificateFactory.getInstance("X.509").generateCertPath(list); cpv = CertPathValidator.getInstance("PKIX"); parameters = new PKIXParameters(trustStore); // We currently don't support CRLs parameters.setRevocationEnabled(false); } catch (Exception e) { throw new WSSecurityException("Problems setting up certificate validation", e); } try { cpv.validate(cp, parameters); } catch (CertPathValidatorException cpve) { log.debug("Certificate is invalid:", cpve); throw new FailedAuthenticationException(); } catch (InvalidAlgorithmParameterException e) { throw new WSSecurityException("Problems setting up certificate validation", e); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Util.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Util.jav0000644000175000017500000001454010542776150031677 0ustar godgod/* * 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.security; import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * @author Jason T. Greene * @version $Id: Util.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ */ public class Util { public static int count = 0; public static String assignWsuId(Element element) { String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID); if (id == null || id.length() < 1) { id = generateId(); element.setAttributeNS(Constants.WSU_NS, Constants.WSU_ID, id); addNamespace(element, Constants.WSU_PREFIX, Constants.WSU_NS); } return id; } public static Element getFirstChildElement(Node node) { Node child = node.getFirstChild(); while (child != null && child.getNodeType() != Node.ELEMENT_NODE) child = child.getNextSibling(); return (Element)child; } public static Element getNextSiblingElement(Element element) { Node sibling = element.getNextSibling(); while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) sibling = sibling.getNextSibling(); return (Element)sibling; } public static Element getPreviousSiblingElement(Element element) { Node sibling = element.getPreviousSibling(); while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) sibling = sibling.getPreviousSibling(); return (Element)sibling; } public static Element findElement(Element root, String localName, String namespace) { return findElement(root, new QName(namespace, localName)); } public static Element findElement(Element root, QName name) { // Here lies your standard recusive DFS..... if (matchNode(root, name)) return root; // Search children for (Node child = root.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() != Node.ELEMENT_NODE) continue; Node possibleMatch = findElement((Element)child, name); if (possibleMatch != null) return (Element)possibleMatch; } return null; } public static List findAllElements(Element root, QName name, boolean local) { List list = new ArrayList(); if (matchNode(root, name, local)) list.add(root); for (Node child = root.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() != Node.ELEMENT_NODE) continue; list.addAll(findAllElements((Element) child, name, local)); } return list; } public static Element findElementByWsuId(Element root, String id) { // Here lies another standard recusive DFS..... if (id.equals(getWsuId(root))) return root; // Search children for (Node child = root.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() != Node.ELEMENT_NODE) continue; Node possibleMatch = findElementByWsuId((Element)child, id); if (possibleMatch != null) return (Element)possibleMatch; } return null; } public static Element findOrCreateSoapHeader(Element envelope) { String prefix = envelope.getPrefix(); String uri = envelope.getNamespaceURI(); QName name = new QName(uri, "Header"); Element header = findElement(envelope, name); if (header == null) { header = envelope.getOwnerDocument().createElementNS(uri, prefix + ":Header"); envelope.insertBefore(header, envelope.getFirstChild()); } return header; } public static String getWsuId(Element element) { if (element.hasAttributeNS(Constants.WSU_NS, Constants.ID)) return element.getAttributeNS(Constants.WSU_NS, Constants.ID); if (element.hasAttribute(Constants.ID)) { String ns = element.getNamespaceURI(); if (Constants.XML_SIGNATURE_NS.equals(ns) || Constants.XML_ENCRYPTION_NS.equals(ns)) return element.getAttribute(Constants.ID); } return null; } public static boolean equalStrings(String string1, String string2) { if (string1 == null && string2 == null) return true; return string1 != null && string1.equals(string2); } public static boolean matchNode(Node node, QName name) { return matchNode(node, name, false); } public static boolean matchNode(Node node, QName name, boolean local) { return equalStrings(node.getLocalName(), name.getLocalPart()) && (local || equalStrings(node.getNamespaceURI(), name.getNamespaceURI())); } public static String generateId() { return generateId("element"); } public static void addNamespace(Element element, String prefix, String uri) { element.setAttributeNS(Constants.XMLNS_NS, "xmlns:" + prefix, uri); } public static String generateId(String prefix) { StringBuilder id = new StringBuilder(); long time = System.currentTimeMillis(); // reasonably gaurantee uniqueness synchronized (Util.class) { count++; } id.append(prefix).append("-").append(count).append("-").append(time).append("-").append(id.hashCode()); return id.toString(); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/BinarySecurityTokenValidator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/BinarySe0000644000175000017500000000341310716057127031713 0ustar godgod/* * 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.security; import org.jboss.ws.extensions.security.element.BinarySecurityToken; import org.jboss.ws.extensions.security.element.X509Token; import org.jboss.ws.extensions.security.exception.WSSecurityException; /** * BinarySecurityTokenValidator is responsible for validating BSTs * * @author Jason T. Greene * @version $Revision: 5034 $ */ public class BinarySecurityTokenValidator { private SecurityStore store; public BinarySecurityTokenValidator(SecurityStore store) { this.store = store; } public void validateToken(BinarySecurityToken token) throws WSSecurityException { if (token instanceof X509Token) store.validateCertificate(((X509Token)token).getCert()); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/OperationDescription.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Operatio0000644000175000017500000000616510716057127031770 0ustar godgod/* * 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.security; import java.util.List; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class OperationDescription { private Class operation; private List targets; private String certificateAlias; private String credential; private String algorithm; private String keyWrapAlgorithm; private String tokenRefType; public OperationDescription(Class operation, List targets, String certicateAlias, String credential, String algorithm, String keyWrapAlgorithm, String tokenRefType) { this.operation = operation; this.targets = targets; this.certificateAlias = certicateAlias; this.credential = credential; this.algorithm = algorithm; this.keyWrapAlgorithm = keyWrapAlgorithm; this.tokenRefType = tokenRefType; } public Class getOperation() { return operation; } public void setOperation(Class operation) { this.operation = operation; } public List getTargets() { return targets; } public void setTargets(List targets) { this.targets = targets; } public String getCertificateAlias() { return certificateAlias; } public void setCertificateAlias(String certificateAlias) { this.certificateAlias = certificateAlias; } public String getCredential() { return credential; } public void setCredential(String credential) { this.credential = credential; } public String getAlgorithm() { return algorithm; } public void setAlgorithm(String algorithm) { this.algorithm = algorithm; } public String getKeyWrapAlgorithm() { return keyWrapAlgorithm; } public void setKeyWrapAlgorithm(String keyWrapAlgorithm) { this.keyWrapAlgorithm = keyWrapAlgorithm; } public String getTokenRefType() { return tokenRefType; } public void setTokenRefType(String tokenRefType) { this.tokenRefType = tokenRefType; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/RequireO0000644000175000017500000000306210716057127031732 0ustar godgod/* * 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.security; import java.util.Collection; import java.util.List; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; /** * Marker interface for all requirement based WS-Security operations. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public interface RequireOperation extends Operation { public void process(Document message, List targets, String alias, String credential, Collection processedIds) throws WSSecurityException; } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SimplePrincipal.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SimplePr0000644000175000017500000000350210542776150031732 0ustar godgod/* * 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.security; import java.io.Serializable; import java.security.Principal; /** A simple String based implementation of Principal. * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public class SimplePrincipal implements Principal, Serializable { private static final long serialVersionUID = 136345402844480211L; private String name; public SimplePrincipal(String name) { this.name = name; } public String getName() { return name; } public boolean equals(Object obj) { if (!(obj instanceof Principal)) return false; return toString().equals(((Principal)obj).getName()); } public int hashCode() { return (name == null ? 0 : name.hashCode()); } public String toString() { return "" + name; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/EncodingOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Encoding0000644000175000017500000000321410716057127031724 0ustar godgod/* * 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.security; import java.util.List; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; /** * EncodingOperation represents an encoding operation that is * applied to a standard SOAP message, transforming it into a WS-Security * encoded message. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public interface EncodingOperation extends Operation { public void process(Document message, List targets, String alias, String credential, String algorithm, String wrap, String tokenRefType) throws WSSecurityException; } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/WsuIdTarget.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/WsuIdTar0000644000175000017500000000303010542776150031675 0ustar godgod/* * 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.security; /** * @author Jason T. Greene * @version $Revision: 1757 $ */ public class WsuIdTarget extends Target { private String id; private boolean content; public WsuIdTarget(String url) { this.id = url; this.content = false; } public WsuIdTarget(String url, boolean content) { this(url); this.content = content; } public String getId() { return id; } public boolean isContent() { return content; } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SecurityEncoder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Security0000644000175000017500000000622710716057127032014 0ustar godgod/* * 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.security; import java.lang.reflect.Constructor; import java.util.List; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * SecurityEncoder is responsible for transforming a SOAP message * into a WS-Security encoded message. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public class SecurityEncoder { private List> operations; private SecurityStore store; public SecurityEncoder(List> operations, SecurityStore store) { org.apache.xml.security.Init.init(); this.operations = operations; this.store = store; } private void attachHeader(SecurityHeader header, Document message) { Element soapHeader = Util.findOrCreateSoapHeader(message.getDocumentElement()); try { Element wsse = header.getElement(); wsse.setAttributeNS(soapHeader.getNamespaceURI(), soapHeader.getPrefix() + ":mustUnderstand", "1"); soapHeader.insertBefore(wsse, soapHeader.getFirstChild()); } catch (Exception e) { e.printStackTrace(); } } public void encode(Document message) throws WSSecurityException { SecurityHeader header = new SecurityHeader(message); for (OperationDescription op : operations) { EncodingOperation operation; try { Constructor constructor = op.getOperation().getConstructor(SecurityHeader.class, SecurityStore.class); operation = constructor.newInstance(header, store); } catch (Exception e) { throw new WSSecurityException("Error constructing operation: " + op.getOperation()); } operation.process(message, op.getTargets(), op.getCertificateAlias(), op.getCredential(), op.getAlgorithm(), op.getKeyWrapAlgorithm(), op.getTokenRefType()); } attachHeader(header, message); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/QNameTarget.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/QNameTar0000644000175000017500000000310410542776150031645 0ustar godgod/* * 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.security; import javax.xml.namespace.QName; /** * @author Jason T. Greene * @version $Revision: 1757 $ */ public class QNameTarget extends Target { private QName name; private boolean content; public QNameTarget(QName name) { this.name = name; this.content = false; } public QNameTarget(QName name, boolean content) { this(name); this.content = content; } public QName getName() { return name; } public boolean isContent() { return content; } }././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/ReceiveUsernameOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/ReceiveU0000644000175000017500000000465610716057127031720 0ustar godgod/* * 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.security; // $Id: ReceiveUsernameOperation.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.Token; import org.jboss.ws.extensions.security.element.UsernameToken; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.invocation.SecurityAdaptor; import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory; import org.w3c.dom.Document; public class ReceiveUsernameOperation implements TokenOperation { private SecurityHeader header; private SecurityStore store; private SecurityAdaptorFactory secAdapterfactory; public ReceiveUsernameOperation(SecurityHeader header, SecurityStore store) { this.header = header; this.store = store; SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); secAdapterfactory = spiProvider.getSPI(SecurityAdaptorFactory.class); } public void process(Document message, Token token) throws WSSecurityException { UsernameToken user = (UsernameToken)token; SecurityAdaptor securityAdaptor = secAdapterfactory.newSecurityAdapter(); securityAdaptor.setPrincipal(new SimplePrincipal(user.getUsername())); securityAdaptor.setCredential(user.getPassword()); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/EncryptionOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Encrypti0000644000175000017500000001557710716057127032012 0ustar godgod/* * 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.security; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.cert.X509Certificate; import java.util.HashMap; import java.util.List; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.xml.namespace.QName; import org.apache.xml.security.encryption.EncryptedData; import org.apache.xml.security.encryption.XMLCipher; import org.apache.xml.security.exceptions.XMLSecurityException; import org.jboss.util.NotImplementedException; import org.jboss.ws.extensions.security.element.EncryptedKey; import org.jboss.ws.extensions.security.element.Reference; import org.jboss.ws.extensions.security.element.ReferenceList; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.X509Token; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; public class EncryptionOperation implements EncodingOperation { private SecurityHeader header; private SecurityStore store; private static class Algorithm { Algorithm(String jceName, String xmlName, int size) { this.jceName = jceName; this.xmlName = xmlName; this.size = size; } public String jceName; public String xmlName; public int size; } private static HashMap algorithms; private static final String DEFAULT_ALGORITHM = "aes-128"; static { algorithms = new HashMap(4); algorithms.put("aes-128", new Algorithm("AES", XMLCipher.AES_128, 128)); algorithms.put("aes-192", new Algorithm("AES", XMLCipher.AES_192, 192)); algorithms.put("aes-256", new Algorithm("AES", XMLCipher.AES_256, 256)); algorithms.put("tripledes", new Algorithm("TripleDes", XMLCipher.TRIPLEDES, 168)); } public EncryptionOperation(SecurityHeader header, SecurityStore store) throws WSSecurityException { this.header = header; this.store = store; } private void processTarget(XMLCipher cipher, Document message, Target target, ReferenceList list, SecretKey key) throws WSSecurityException { if (!(target instanceof QNameTarget)) throw new NotImplementedException(); QName name = ((QNameTarget)target).getName(); Element element = Util.findElement(message.getDocumentElement(), name); if (element == null) throw new RuntimeException("Could not find element"); // Ensure that the element has an id, so that encryption verification can be performed Util.assignWsuId(element); try { cipher.init(XMLCipher.ENCRYPT_MODE, key); EncryptedData encrypted = cipher.getEncryptedData(); String id = Util.generateId("encrypted"); encrypted.setId(id); list.add(id); cipher.doFinal(message, element, target.isContent()); } catch (Exception e) { throw new WSSecurityException("Error encrypting target: " + name, e); } } public SecretKey getSecretKey(String algorithm) throws WSSecurityException { Algorithm alg = algorithms.get(algorithm); try { KeyGenerator kgen = KeyGenerator.getInstance(alg.jceName); kgen.init(alg.size); return kgen.generateKey(); } catch (NoSuchAlgorithmException e) { throw new WSSecurityException(e.getMessage()); } } public void process(Document message, List targets, String alias, String credential, String algorithm, String wrap, String tokenRefType) throws WSSecurityException { if (! algorithms.containsKey(algorithm)) algorithm = DEFAULT_ALGORITHM; SecretKey secretKey = getSecretKey(algorithm); XMLCipher cipher; try { cipher = XMLCipher.getInstance(algorithms.get(algorithm).xmlName); cipher.init(XMLCipher.ENCRYPT_MODE, secretKey); } catch (XMLSecurityException e) { throw new WSSecurityException("Error initializing xml cipher" + e.getMessage(), e); } ReferenceList list = new ReferenceList(); if (targets == null || targets.size() == 0) { // By default we encrypt the content of the body element String namespace = message.getDocumentElement().getNamespaceURI(); processTarget(cipher, message, new QNameTarget(new QName(namespace, "Body"), true), list, secretKey); } else { for (Target target : targets) processTarget(cipher, message, target, list, secretKey); } X509Certificate cert = store.getCertificate(alias); X509Token token = (X509Token) header.getSharedToken(cert); // Can we reuse an existing token? if (token == null) { token = new X509Token(cert, message); if (tokenRefType == null || Reference.DIRECT_REFERENCE.equals(tokenRefType)) header.addToken(token); } EncryptedKey eKey = new EncryptedKey(message, secretKey, token, list, wrap, tokenRefType); header.addSecurityProcess(eKey); } public static boolean probeUnlimitedCrypto() throws WSSecurityException { try { //Check AES-256 KeyGenerator kgen = KeyGenerator.getInstance("AES"); kgen.init(256); SecretKey key = kgen.generateKey(); Cipher c = Cipher.getInstance("AES"); c.init(Cipher.ENCRYPT_MODE, key); //Check Blowfish kgen = KeyGenerator.getInstance("Blowfish"); key = kgen.generateKey(); c = Cipher.getInstance("Blowfish"); c.init(Cipher.ENCRYPT_MODE, key); return true; } catch (InvalidKeyException e) { return false; } catch (Exception e) { throw new WSSecurityException("Error probing cryptographic permissions", e); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Target.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Target.j0000644000175000017500000000234510542776150031661 0ustar godgod/* * 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.security; /** * @author Jason T. Greene * @version $Revision: 1757 $ */ abstract public class Target { // Applies only to encryption abstract public boolean isContent(); } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SecurityDecoder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Security0000644000175000017500000001460410716057127032012 0ustar godgod/* * 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.security; import java.lang.reflect.Constructor; import java.util.Calendar; import java.util.Collection; import java.util.HashSet; import java.util.List; import org.jboss.ws.extensions.security.element.EncryptedKey; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.SecurityProcess; import org.jboss.ws.extensions.security.element.Signature; import org.jboss.ws.extensions.security.element.Timestamp; import org.jboss.ws.extensions.security.element.Token; import org.jboss.ws.extensions.security.element.UsernameToken; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * @author Jason T. Greene * @version $Revision: 5034 $ */ public class SecurityDecoder { private Element headerElement; private Calendar now = null; private SecurityHeader header; private Document message; private SecurityStore store; private HashSet signedIds = new HashSet(); private HashSet encryptedIds = new HashSet(); public SecurityDecoder(SecurityStore store) { org.apache.xml.security.Init.init(); this.store = store; } /** * A special constructor that allows you to use a different value when validating the message. * DO NOT USE THIS UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!. * * @param SecurityStore the security store that contains key and trust information * @param now The timestamp to use as the current time when validating a message expiration */ public SecurityDecoder(SecurityStore store, Calendar now) { this(store); this.now = now; } private Element getHeader(Document message) throws WSSecurityException { Element header = Util.findElement(message.getDocumentElement(), "Security", Constants.WSSE_NS); if (header == null) throw new WSSecurityException("Expected security header was not found"); return header; } private void detachHeader() { headerElement.getParentNode().removeChild(headerElement); } private void decode() throws WSSecurityException { // Validate a timestamp if it is present Timestamp timestamp = header.getTimestamp(); if (timestamp != null) { TimestampVerificationOperation operation = (now == null) ? new TimestampVerificationOperation() : new TimestampVerificationOperation(now); operation.process(message, timestamp); } for (Token token : header.getTokens()) { if (token instanceof UsernameToken) new ReceiveUsernameOperation(header, store).process(message, token); } signedIds.clear(); encryptedIds.clear(); SignatureVerificationOperation signatureVerifier = new SignatureVerificationOperation(header, store); DecryptionOperation decrypter = new DecryptionOperation(header, store); for (SecurityProcess process : header.getSecurityProcesses()) { // If this list gets much larger it should probably be a hash lookup if (process instanceof Signature) { Collection ids = signatureVerifier.process(message, process); if (ids != null) signedIds.addAll(ids); } else if (process instanceof EncryptedKey) { Collection ids = decrypter.process(message, process); if (ids != null) encryptedIds.addAll(ids); } } } public void verify(List> requireOperations) throws WSSecurityException { if (requireOperations == null) return; for (OperationDescription o : requireOperations) { Class operation = o.getOperation(); RequireOperation op; Collection processedIds = null; if (operation.equals(RequireSignatureOperation.class)) { op = new RequireSignatureOperation(header, store); processedIds = signedIds; } else if (operation.equals(RequireEncryptionOperation.class)) { op = new RequireEncryptionOperation(header, store); processedIds = encryptedIds; } else { try { Constructor c = operation.getConstructor(SecurityHeader.class, SecurityStore.class); op = c.newInstance(header, store); } catch (Exception e) { throw new WSSecurityException("Error constructing operation: " + operation); } } op.process(message, o.getTargets(), o.getCertificateAlias(), o.getCredential(), processedIds); } } public void decode(Document message) throws WSSecurityException { decode(message, getHeader(message)); } public void decode(Document message, Element headerElement) throws WSSecurityException { this.headerElement = headerElement; this.header = new SecurityHeader(this.headerElement, store); this.message = message; decode(); } public void complete() { // On completion we must remove the header so that no one else can process this // message (required by the specification) detachHeader(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/DecodingOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Decoding0000644000175000017500000000321710716057127031715 0ustar godgod/* * 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.security; import java.util.Collection; import org.jboss.ws.extensions.security.element.SecurityProcess; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; /** * DecodingOperation represents an operation that is applied to a * WS-Security encoded message to both convert and verify the contents of the * message. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public interface DecodingOperation extends Operation { public Collection process(Document message, SecurityProcess process) throws WSSecurityException; } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/SignatureVerificationOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Signatur0000644000175000017500000000634410716057127032001 0ustar godgod/* * 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.security; import java.util.ArrayList; import java.util.Collection; import org.apache.xml.security.exceptions.XMLSecurityException; import org.apache.xml.security.signature.SignedInfo; import org.apache.xml.security.signature.XMLSignature; import org.apache.xml.security.signature.XMLSignatureException; import org.jboss.ws.extensions.security.element.SecurityHeader; import org.jboss.ws.extensions.security.element.SecurityProcess; import org.jboss.ws.extensions.security.element.Signature; import org.jboss.ws.extensions.security.exception.FailedCheckException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; public class SignatureVerificationOperation implements DecodingOperation { private SecurityHeader header; private SecurityStore store; public SignatureVerificationOperation(SecurityHeader header, SecurityStore store) throws WSSecurityException { this.header = header; this.store = store; } public Collection process(Document message, SecurityProcess process) throws WSSecurityException { Signature signature = (Signature) process; XMLSignature xmlSig = signature.getSignature(); xmlSig.addResourceResolver(new WsuIdResolver(message)); STRTransform.setSecurityStore(store); try { if (! xmlSig.checkSignatureValue(signature.getPublicKey())) throw new FailedCheckException("Signature is invalid."); } catch (XMLSignatureException e) { throw new WSSecurityException("An unexpected error occured while verifying signature", e); } finally { STRTransform.setSecurityStore(null); } SignedInfo info = xmlSig.getSignedInfo(); int length = info.getLength(); Collection processed = new ArrayList(length); try { for (int i = 0; i < length; i++) { String uri = info.item(i).getURI(); if (uri != null && uri.length() > 1 && uri.charAt(0)=='#') processed.add(uri.substring(1)); } } catch (XMLSecurityException e) { throw new WSSecurityException("Could not extract references", e); } return processed; } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/TimestampVerificationOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/security/Timestam0000644000175000017500000000442110716057127031762 0ustar godgod/* * 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.security; import java.util.Calendar; import org.jboss.ws.extensions.security.element.Timestamp; import org.jboss.ws.extensions.security.exception.FailedCheckException; import org.jboss.ws.extensions.security.exception.WSSecurityException; import org.w3c.dom.Document; public class TimestampVerificationOperation { private Calendar now = null; public TimestampVerificationOperation() { } /** * A special constructor that allows you to use a different value when validating the message. * DO NOT USE THIS UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!. * * @param now The timestamp to use as the current time when validating a message expiration */ public TimestampVerificationOperation(Calendar now) { this.now = now; } public void process(Document message, Timestamp timestamp) throws WSSecurityException { Calendar expired = timestamp.getExpires(); Calendar created = timestamp.getCreated(); Calendar now = (this.now == null) ? Calendar.getInstance() : this.now; if (created.after(now)) throw new WSSecurityException("Invalid timestamp, message claimed to be created after now"); if (expired != null && ! now.before(expired)) throw new FailedCheckException("Expired message."); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/0000755000175000017500000000000010755000260027361 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/0000755000175000017500000000000010755000257030657 5ustar godgod././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000755000175000017500000000000010755000257031703 5ustar godgod././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMAckRequestedSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000001414010723247145031711 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.stringToLong; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getOptionalElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * AckRequested object de/serializer * @author richard.opalka@jboss.com */ final class RMAckRequestedSerializer implements RMSerializer { private static final RMSerializer INSTANCE = new RMAckRequestedSerializer(); private RMAckRequestedSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize AckRequested using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMAckRequested o = (RMAckRequested)object; try { SOAPHeader soapHeader = soapMessage.getSOAPPart().getEnvelope().getHeader(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:AckRequested element QName ackRequestedQName = wsrmConstants.getAckRequestedQName(); SOAPElement ackRequestedElement = getRequiredElement(soapHeader, ackRequestedQName, "soap header"); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(ackRequestedElement, identifierQName, ackRequestedQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); o.setIdentifier(identifier); // read optional wsrm:MessageNumber element QName messageNumberQName = wsrmConstants.getMessageNumberQName(); SOAPElement messageNumberElement = getOptionalElement(ackRequestedElement, messageNumberQName, ackRequestedQName); if (messageNumberElement != null) { String messageNumberString = getRequiredTextContent(messageNumberElement, messageNumberQName); long messageNumberValue = stringToLong(messageNumberString, "Unable to parse MessageNumber element text content"); o.setMessageNumber(messageNumberValue); } } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize AckRequested using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMAckRequested o = (RMAckRequested)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:AckRequested element QName ackRequestedQName = wsrmConstants.getAckRequestedQName(); SOAPElement ackRequestedElement = soapEnvelope.getHeader().addChildElement(ackRequestedQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); ackRequestedElement.addChildElement(identifierQName).setValue(o.getIdentifier()); if (o.getMessageNumber() != 0) { // write optional wsrm:MessageNumber element QName messageNumberQName = wsrmConstants.getMessageNumberQName(); SOAPElement messageNumberElement = ackRequestedElement.addChildElement(messageNumberQName); messageNumberElement.setValue(String.valueOf(o.getMessageNumber())); } } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMAbstractSerializable.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000000466510723247145031724 0ustar godgod/* * 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.wsrm.common.serialization; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * Utility class which should be subclassed by all WS-RM protocol providers. * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable */ public abstract class RMAbstractSerializable implements RMSerializable { protected RMAbstractSerializable() { // intended to be subclassed } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Serializable#deserializeFrom(javax.xml.soap.SOAPMessage) */ public final void deserializeFrom(SOAPMessage soapMessage) throws RMException { RMSerializationRepository.deserialize(this, soapMessage); validate(); // finally ensure that object is in correct state } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Serializable#serializeTo(javax.xml.soap.SOAPMessage) */ public final void serializeTo(SOAPMessage soapMessage) throws RMException { validate(); // ensure object is in correct state first RMSerializationRepository.serialize(this, soapMessage); } /** * Each subclass must implement this method * @return RM provider to be used for de/serialization purposes */ public abstract RMProvider getProvider(); } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMSequenceSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000001466310723247145031723 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.stringToLong; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getOptionalElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.namespace.QName; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * Sequence object de/serializer * @author richard.opalka@jboss.com */ final class RMSequenceSerializer implements RMSerializer { private static final RMSerializer INSTANCE = new RMSequenceSerializer(); private RMSequenceSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize Sequence using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMSequence o = (RMSequence)object; try { SOAPHeader soapHeader = soapMessage.getSOAPPart().getEnvelope().getHeader(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:Sequence element QName sequenceQName = wsrmConstants.getSequenceQName(); SOAPElement sequenceElement = getRequiredElement(soapHeader, sequenceQName, "soap header"); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(sequenceElement, identifierQName, sequenceQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); o.setIdentifier(identifier); // read required wsrm:MessageNumber element QName messageNumberQName = wsrmConstants.getMessageNumberQName(); SOAPElement messageNumberElement = getRequiredElement(sequenceElement, messageNumberQName, sequenceQName); String messageNumberString = getRequiredTextContent(messageNumberElement, messageNumberQName); long messageNumberValue = stringToLong(messageNumberString, "Unable to parse MessageNumber element text content"); o.setMessageNumber(messageNumberValue); // read optional wsrm:LastMessage element QName lastMessageQName = wsrmConstants.getLastMessageQName(); SOAPElement lastMessageElement = getOptionalElement(sequenceElement, lastMessageQName, sequenceQName); if (lastMessageElement != null) { o.setLastMessage(); } } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize Sequence using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMSequence o = (RMSequence)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:Sequence element QName sequenceQName = wsrmConstants.getSequenceQName(); SOAPElement sequenceElement = soapEnvelope.getHeader().addChildElement(sequenceQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); sequenceElement.addChildElement(identifierQName).setValue(o.getIdentifier()); // write required wsrm:MessageNumber element QName messageNumberQName = wsrmConstants.getMessageNumberQName(); SOAPElement messageNumberElement = sequenceElement.addChildElement(messageNumberQName); messageNumberElement.setValue(String.valueOf(o.getMessageNumber())); if (o.isLastMessage()) { // write optional wsrm:LastMessage element QName lastMessageQName = wsrmConstants.getLastMessageQName(); sequenceElement.addChildElement(lastMessageQName); } } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000000401310723247145031707 0ustar godgod/* * 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.wsrm.common.serialization; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * Each WS-RM message de/serializer must implement this interface * @author richard.opalka@jboss.com */ interface RMSerializer { /** * Serialize the specified object using passed RM provider to the soapMessage * @param object to be serialized * @param provider RM provider to be used * @param soapMessage where to write the data */ void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage); /** * Deserialize the specified object using passed RM provider from the soapMessage * @param object to be deserialized * @param provider RM provider to be used * @param soapMessage from which to read the data */ void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage); } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMCreateSequenceResponseSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000002170710723766636031733 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getOptionalElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.namespace.QName; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingConstants; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.RMHelper; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMIncompleteSequenceBehavior; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * CreateSequenceResponse object de/serializer * @author richard.opalka@jboss.com */ final class RMCreateSequenceResponseSerializer implements RMSerializer { private static final AddressingConstants ADDRESSING_CONSTANTS = AddressingBuilder.getAddressingBuilder().newAddressingConstants(); private static final RMSerializer INSTANCE = new RMCreateSequenceResponseSerializer(); private RMCreateSequenceResponseSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize CreateSequenceResponse using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMCreateSequenceResponse o = (RMCreateSequenceResponse)object; try { SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:CreateSequenceResponse element QName createSequenceResponseQName = wsrmConstants.getCreateSequenceResponseQName(); SOAPElement createSequenceResponseElement = getRequiredElement(soapBody, createSequenceResponseQName, "soap body"); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(createSequenceResponseElement, identifierQName, createSequenceResponseQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); o.setIdentifier(identifier); // read optional wsrm:Expires element QName expiresQName = wsrmConstants.getExpiresQName(); SOAPElement expiresElement = getOptionalElement(createSequenceResponseElement, expiresQName, createSequenceResponseQName); if (expiresElement != null) { String duration = getRequiredTextContent(expiresElement, expiresQName); o.setExpires(RMHelper.stringToDuration(duration)); } // read optional wsrm:IncompleteSequenceBehavior element QName behaviorQName = wsrmConstants.getIncompleteSequenceBehaviorQName(); SOAPElement behaviorElement = getOptionalElement(createSequenceResponseElement, behaviorQName, createSequenceResponseQName); if (behaviorElement != null) { String behaviorString = getRequiredTextContent(behaviorElement, behaviorQName); o.setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior.getValue(behaviorString)); } // read optional wsrm:Accept element QName acceptQName = wsrmConstants.getAcceptQName(); SOAPElement acceptElement = getOptionalElement(createSequenceResponseElement, acceptQName, createSequenceResponseQName); if (acceptElement != null) { RMCreateSequenceResponse.RMAccept accept = o.newAccept(); // read required wsrm:AcksTo element QName acksToQName = wsrmConstants.getAcksToQName(); SOAPElement acksToElement = getRequiredElement(acceptElement, acksToQName, acceptQName); QName addressQName = ADDRESSING_CONSTANTS.getAddressQName(); SOAPElement acksToAddressElement = getRequiredElement(acksToElement, addressQName, acksToQName); String acksToAddress = getRequiredTextContent(acksToAddressElement, addressQName); accept.setAcksTo(acksToAddress); // set created accept o.setAccept(accept); } } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize CreateSequenceResponse using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMCreateSequenceResponse o = (RMCreateSequenceResponse)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:CreateSequenceResponse element QName createSequenceResponseQName = wsrmConstants.getCreateSequenceResponseQName(); SOAPElement createSequenceResponseElement = soapEnvelope.getBody().addChildElement(createSequenceResponseQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); createSequenceResponseElement.addChildElement(identifierQName).setValue(o.getIdentifier()); if (o.getExpires() != null) { // write optional wsrm:Expires element QName expiresQName = wsrmConstants.getExpiresQName(); createSequenceResponseElement.addChildElement(expiresQName).setValue(RMHelper.durationToString(o.getExpires())); } if (o.getIncompleteSequenceBehavior() != null) { // write optional wsrm:IncompleteSequenceBehavior element RMIncompleteSequenceBehavior behavior = o.getIncompleteSequenceBehavior(); QName behaviorQName = wsrmConstants.getIncompleteSequenceBehaviorQName(); SOAPElement behaviorElement = createSequenceResponseElement.addChildElement(behaviorQName); behaviorElement.setValue(behavior.toString()); } if (o.getAccept() != null) { // write optional wsrm:Accept element QName acceptQName = wsrmConstants.getAcceptQName(); SOAPElement acceptElement = createSequenceResponseElement.addChildElement(acceptQName); // write required wsrm:AcksTo element QName acksToQName = wsrmConstants.getAcksToQName(); QName addressQName = ADDRESSING_CONSTANTS.getAddressQName(); acceptElement.addChildElement(acksToQName) .addChildElement(addressQName) .setValue(o.getAccept().getAcksTo()); } } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMCreateSequenceSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000002466510723766636031741 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getOptionalElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.namespace.QName; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingConstants; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.RMHelper; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMIncompleteSequenceBehavior; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * CreateSequence object de/serializer * @author richard.opalka@jboss.com */ final class RMCreateSequenceSerializer implements RMSerializer { private static final AddressingConstants ADDRESSING_CONSTANTS = AddressingBuilder.getAddressingBuilder().newAddressingConstants(); private static final RMSerializer INSTANCE = new RMCreateSequenceSerializer(); private RMCreateSequenceSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize CreateSequence using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMCreateSequence o = (RMCreateSequence)object; try { SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:CreateSequence element QName createSequenceQName = wsrmConstants.getCreateSequenceQName(); SOAPElement createSequenceElement = getRequiredElement(soapBody, createSequenceQName, "soap body"); // read required wsrm:AcksTo element QName acksToQName = wsrmConstants.getAcksToQName(); SOAPElement acksToElement = getRequiredElement(createSequenceElement, acksToQName, createSequenceQName); QName addressQName = ADDRESSING_CONSTANTS.getAddressQName(); SOAPElement acksToAddressElement = getRequiredElement(acksToElement, addressQName, acksToQName); String acksToAddress = getRequiredTextContent(acksToAddressElement, addressQName); o.setAcksTo(acksToAddress); // read optional wsrm:Expires element QName expiresQName = wsrmConstants.getExpiresQName(); SOAPElement expiresElement = getOptionalElement(createSequenceElement, expiresQName, createSequenceQName); if (expiresElement != null) { String duration = getRequiredTextContent(expiresElement, expiresQName); o.setExpires(RMHelper.stringToDuration(duration)); } // read optional wsrm:Offer element QName offerQName = wsrmConstants.getOfferQName(); SOAPElement offerElement = getOptionalElement(createSequenceElement, offerQName, createSequenceQName); if (offerElement != null) { RMCreateSequence.RMOffer offer = o.newOffer(); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(offerElement, identifierQName, offerQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); offer.setIdentifier(identifier); // read optional wsrm:Endpoint element QName endpointQName = wsrmConstants.getEndpointQName(); SOAPElement endpointElement = getOptionalElement(offerElement, endpointQName, offerQName); if (endpointElement != null) { SOAPElement endpointAddressElement = getRequiredElement(endpointElement, addressQName, endpointQName); String endpointAddress = getRequiredTextContent(endpointAddressElement, addressQName); offer.setEndpoint(endpointAddress); } // read optional wsrm:Expires element SOAPElement offerExpiresElement = getOptionalElement(offerElement, expiresQName, offerQName); if (offerExpiresElement != null) { String duration = getRequiredTextContent(offerExpiresElement, expiresQName); offer.setExpires(duration); } // read optional wsrm:IncompleteSequenceBehavior element QName behaviorQName = wsrmConstants.getIncompleteSequenceBehaviorQName(); SOAPElement behaviorElement = getOptionalElement(offerElement, behaviorQName, offerQName); if (behaviorElement != null) { String behaviorString = getRequiredTextContent(behaviorElement, behaviorQName); offer.setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior.getValue(behaviorString)); } // set created offer o.setOffer(offer); } } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize CreateSequence using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMCreateSequence o = (RMCreateSequence)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:CreateSequence element QName createSequenceQName = wsrmConstants.getCreateSequenceQName(); SOAPElement createSequenceElement = soapEnvelope.getBody().addChildElement(createSequenceQName); // write required wsrm:AcksTo element QName acksToQName = wsrmConstants.getAcksToQName(); QName addressQName = ADDRESSING_CONSTANTS.getAddressQName(); createSequenceElement.addChildElement(acksToQName) .addChildElement(addressQName) .setValue(o.getAcksTo()); if (o.getExpires() != null) { // write optional wsrm:Expires element QName expiresQName = wsrmConstants.getExpiresQName(); createSequenceElement.addChildElement(expiresQName).setValue(RMHelper.durationToString(o.getExpires())); } if (o.getOffer() != null) { RMCreateSequence.RMOffer offer = o.getOffer(); // write optional wsrm:Offer element QName offerQName = wsrmConstants.getOfferQName(); SOAPElement offerElement = createSequenceElement.addChildElement(offerQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); offerElement.addChildElement(identifierQName).setValue(offer.getIdentifier()); if (offer.getEndpoint() != null) { // write optional wsrm:Endpoint element QName endpointQName = wsrmConstants.getEndpointQName(); offerElement.addChildElement(endpointQName) .addChildElement(addressQName) .setValue(offer.getEndpoint()); } if (offer.getExpires() != null) { // write optional wsrm:Expires element QName expiresQName = wsrmConstants.getExpiresQName(); offerElement.addChildElement(expiresQName).setValue(offer.getExpires()); } if (offer.getIncompleteSequenceBehavior() != null) { // write optional wsrm:IncompleteSequenceBehavior element RMIncompleteSequenceBehavior behavior = offer.getIncompleteSequenceBehavior(); QName behaviorQName = wsrmConstants.getIncompleteSequenceBehaviorQName(); SOAPElement behaviorElement = offerElement.addChildElement(behaviorQName); behaviorElement.setValue(behavior.toString()); } } } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMCloseSequenceResponseSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000001215710723247145031717 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.namespace.QName; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * CloseSequenceResponse object de/serializer * @author richard.opalka@jboss.com */ final class RMCloseSequenceResponseSerializer implements RMSerializer { private static final RMSerializer INSTANCE = new RMCloseSequenceResponseSerializer(); private RMCloseSequenceResponseSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize CloseSequenceResponse using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMCloseSequenceResponse o = (RMCloseSequenceResponse)object; try { SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:CloseSequenceResponse element QName closeSequenceResponseQName = wsrmConstants.getCloseSequenceResponseQName(); SOAPElement closeSequenceResponseElement = getRequiredElement(soapBody, closeSequenceResponseQName, "soap body"); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(closeSequenceResponseElement, identifierQName, closeSequenceResponseQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); o.setIdentifier(identifier); } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize CloseSequenceResponse using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMCloseSequenceResponse o = (RMCloseSequenceResponse)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:CloseSequenceResponse element QName closeSequenceResponseQName = wsrmConstants.getCloseSequenceResponseQName(); SOAPElement closeSequenceResponseElement = soapEnvelope.getBody().addChildElement(closeSequenceResponseQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); closeSequenceResponseElement.addChildElement(identifierQName).setValue(o.getIdentifier()); } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMCloseSequenceSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000001415510723247145031717 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.stringToLong; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getOptionalElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.namespace.QName; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * CloseSequence object de/serializer * @author richard.opalka@jboss.com */ final class RMCloseSequenceSerializer implements RMSerializer { private static final RMSerializer INSTANCE = new RMCloseSequenceSerializer(); private RMCloseSequenceSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize CloseSequence using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMCloseSequence o = (RMCloseSequence)object; try { SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:CloseSequence element QName closeSequenceQName = wsrmConstants.getCloseSequenceQName(); SOAPElement closeSequenceElement = getRequiredElement(soapBody, closeSequenceQName, "soap body"); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(closeSequenceElement, identifierQName, closeSequenceQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); o.setIdentifier(identifier); // read optional wsrm:LastMsgNumber element QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName(); SOAPElement lastMsgNumberElement = getOptionalElement(closeSequenceElement, lastMsgNumberQName, closeSequenceQName); if (lastMsgNumberElement != null) { String lastMsgNumberString = getRequiredTextContent(lastMsgNumberElement, lastMsgNumberQName); long lastMsgNumberValue = stringToLong(lastMsgNumberString, "Unable to parse LastMsgNumber element text content"); o.setLastMsgNumber(lastMsgNumberValue); } } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize CloseSequence using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMCloseSequence o = (RMCloseSequence)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:CloseSequence element QName closeSequenceQName = wsrmConstants.getCloseSequenceQName(); SOAPElement closeSequenceElement = soapEnvelope.getBody().addChildElement(closeSequenceQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); closeSequenceElement.addChildElement(identifierQName).setValue(o.getIdentifier()); if (o.getLastMsgNumber() != 0) { // write optional wsrm:LastMsgNumber element QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName(); SOAPElement lastMsgNumberElement = closeSequenceElement.addChildElement(lastMsgNumberQName); lastMsgNumberElement.setValue(String.valueOf(o.getLastMsgNumber())); } } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000023000000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMTerminateSequenceResponseSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000001231710723247145031715 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.namespace.QName; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse; /** * TerminateSequenceResponse object de/serializer * @author richard.opalka@jboss.com */ final class RMTerminateSequenceResponseSerializer implements RMSerializer { private static final RMSerializer INSTANCE = new RMTerminateSequenceResponseSerializer(); private RMTerminateSequenceResponseSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize TerminateSequenceResponse using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMTerminateSequenceResponse o = (RMTerminateSequenceResponse)object; try { SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:TerminateSequenceResponse element QName terminateSequenceResponseQName = wsrmConstants.getTerminateSequenceResponseQName(); SOAPElement terminateSequenceResponseElement = getRequiredElement(soapBody, terminateSequenceResponseQName, "soap body"); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(terminateSequenceResponseElement, identifierQName, terminateSequenceResponseQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); o.setIdentifier(identifier); } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize TerminateSequenceResponse using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMTerminateSequenceResponse o = (RMTerminateSequenceResponse)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:TerminateSequenceResponse element QName terminateSequenceResponseQName = wsrmConstants.getTerminateSequenceResponseQName(); SOAPElement terminateSequenceResponseElement = soapEnvelope.getBody().addChildElement(terminateSequenceResponseQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); terminateSequenceResponseElement.addChildElement(identifierQName).setValue(o.getIdentifier()); } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMSequenceAcknowledgementSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000002302310723766636031724 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.stringToLong; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getOptionalElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getOptionalElements; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; import java.util.List; /** * SequenceAcknowledgement object de/serializer * @author richard.opalka@jboss.com */ final class RMSequenceAcknowledgementSerializer implements RMSerializer { private static final RMSerializer INSTANCE = new RMSequenceAcknowledgementSerializer(); private RMSequenceAcknowledgementSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize SequenceAcknowledgement using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMSequenceAcknowledgement o = (RMSequenceAcknowledgement)object; try { SOAPHeader soapHeader = soapMessage.getSOAPPart().getEnvelope().getHeader(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:SequenceAcknowledgement element QName sequenceAckQName = wsrmConstants.getSequenceAcknowledgementQName(); SOAPElement sequenceAckElement = getRequiredElement(soapHeader, sequenceAckQName, "soap header"); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(sequenceAckElement, identifierQName, sequenceAckQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); o.setIdentifier(identifier); // read optional wsrm:Final element QName finalQName = wsrmConstants.getFinalQName(); SOAPElement finalElement = getOptionalElement(sequenceAckElement, finalQName, sequenceAckQName); if (finalElement != null) { o.setFinal(); } // read optional wsrm:None element QName noneQName = wsrmConstants.getNoneQName(); SOAPElement noneElement = getOptionalElement(sequenceAckElement, noneQName, sequenceAckQName); if (noneElement != null) { o.setNone(); } // read optional wsrm:Nack elements QName nackQName = wsrmConstants.getNackQName(); List nackElements = getOptionalElements(sequenceAckElement, nackQName, sequenceAckQName); for (SOAPElement nackElement : nackElements) { String messageId = getRequiredTextContent(nackElement, nackQName); o.addNack(stringToLong(messageId, "Unable to parse Nack element text content")); } // read optional wsrm:AcknowledgementRange elements QName ackRangeQName = wsrmConstants.getAcknowledgementRangeQName(); List ackRangeElements = getOptionalElements(sequenceAckElement, ackRangeQName, sequenceAckQName); if (ackRangeElements.size() != 0) { QName upperQName = wsrmConstants.getUpperQName(); QName lowerQName = wsrmConstants.getLowerQName(); for (SOAPElement ackRangeElement : ackRangeElements) { RMSequenceAcknowledgement.RMAcknowledgementRange ackRange = o.newAcknowledgementRange(); // read required wsrm:Upper attribute String upper = getRequiredTextContent(ackRangeElement, upperQName, ackRangeQName); ackRange.setUpper(stringToLong(upper, "Unable to parse Upper attribute text content")); // read required wsrm:Lower attribute String lower = getRequiredTextContent(ackRangeElement, lowerQName, ackRangeQName); ackRange.setLower(stringToLong(lower, "Unable to parse Lower attribute text content")); // set created acknowledgement range o.addAcknowledgementRange(ackRange); } } } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize SequenceAcknowledgement using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMSequenceAcknowledgement o = (RMSequenceAcknowledgement)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:SequenceAcknowledgement element QName sequenceAckQName = wsrmConstants.getSequenceAcknowledgementQName(); SOAPElement sequenceAckElement = soapEnvelope.getHeader().addChildElement(sequenceAckQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); sequenceAckElement.addChildElement(identifierQName).setValue(o.getIdentifier()); if (o.isFinal()) { // write optional wsrm:Final element QName finalQName = wsrmConstants.getFinalQName(); sequenceAckElement.addChildElement(finalQName); } if (o.isNone()) { // write optional wsrm:None element QName noneQName = wsrmConstants.getNoneQName(); sequenceAckElement.addChildElement(noneQName); } List nacks = o.getNacks(); if (nacks.size() != 0) { QName nackQName = wsrmConstants.getNackQName(); // write optional wsrm:Nack elements for (Long messageId : nacks) { sequenceAckElement.addChildElement(nackQName).setValue(String.valueOf(messageId)); } } List ackRanges = o.getAcknowledgementRanges(); if (ackRanges.size() != 0) { QName acknowledgementRangeQName = wsrmConstants.getAcknowledgementRangeQName(); QName upperQName = wsrmConstants.getUpperQName(); QName lowerQName = wsrmConstants.getLowerQName(); // write optional wsrm:AcknowledgementRange elements for (RMSequenceAcknowledgement.RMAcknowledgementRange ackRange : ackRanges) { SOAPElement acknowledgementRangeElement = sequenceAckElement.addChildElement(acknowledgementRangeQName); // write required wsrm:Lower attribute acknowledgementRangeElement.addAttribute(lowerQName, String.valueOf(ackRange.getLower())); // write required wsrm:Upper attribute acknowledgementRangeElement.addAttribute(upperQName, String.valueOf(ackRange.getUpper())); } } } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMTerminateSequenceSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000001433110723247145031713 0ustar godgod/* * 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.wsrm.common.serialization; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.stringToLong; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getOptionalElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredElement; import static org.jboss.ws.extensions.wsrm.common.serialization.RMSerializationHelper.getRequiredTextContent; import javax.xml.namespace.QName; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; /** * TerminateSequence object de/serializer * @author richard.opalka@jboss.com */ final class RMTerminateSequenceSerializer implements RMSerializer { private static final RMSerializer INSTANCE = new RMTerminateSequenceSerializer(); private RMTerminateSequenceSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize TerminateSequence using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMTerminateSequence o = (RMTerminateSequence)object; try { SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody(); RMConstants wsrmConstants = provider.getConstants(); // read required wsrm:TerminateSequence element QName terminateSequenceQName = wsrmConstants.getTerminateSequenceQName(); SOAPElement terminateSequenceElement = getRequiredElement(soapBody, terminateSequenceQName, "soap body"); // read required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); SOAPElement identifierElement = getRequiredElement(terminateSequenceElement, identifierQName, terminateSequenceQName); String identifier = getRequiredTextContent(identifierElement, identifierQName); o.setIdentifier(identifier); // read optional wsrm:LastMsgNumber element QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName(); SOAPElement lastMsgNumberElement = getOptionalElement(terminateSequenceElement, lastMsgNumberQName, terminateSequenceQName); if (lastMsgNumberElement != null) { String lastMsgNumberString = getRequiredTextContent(lastMsgNumberElement, lastMsgNumberQName); long lastMsgNumberValue = stringToLong(lastMsgNumberString, "Unable to parse LastMsgNumber element text content"); o.setLastMsgNumber(lastMsgNumberValue); } } catch (SOAPException se) { throw new RMException("Unable to deserialize RM message", se); } catch (RuntimeException re) { throw new RMException("Unable to deserialize RM message", re); } } /** * Serialize TerminateSequence using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { RMTerminateSequence o = (RMTerminateSequence)object; try { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); RMConstants wsrmConstants = provider.getConstants(); // Add xmlns:wsrm declaration soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI()); // write required wsrm:TerminateSequence element QName terminateSequenceQName = wsrmConstants.getTerminateSequenceQName(); SOAPElement terminateSequenceElement = soapEnvelope.getBody().addChildElement(terminateSequenceQName); // write required wsrm:Identifier element QName identifierQName = wsrmConstants.getIdentifierQName(); terminateSequenceElement.addChildElement(identifierQName).setValue(o.getIdentifier()); if (o.getLastMsgNumber() != 0) { // write optional wsrm:LastMsgNumber element QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName(); SOAPElement lastMsgNumberElement = terminateSequenceElement.addChildElement(lastMsgNumberQName); lastMsgNumberElement.setValue(String.valueOf(o.getLastMsgNumber())); } } catch (SOAPException se) { throw new RMException("Unable to serialize RM message", se); } } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMSerializationHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000001036210723247145031713 0ustar godgod/* * 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.wsrm.common.serialization; import java.util.List; import java.util.LinkedList; import java.util.Collections; import org.w3c.dom.Element; import org.jboss.wsf.common.DOMUtils; import org.jboss.ws.extensions.wsrm.api.RMException; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; /** * Serialization helper * @author richard.opalka@jboss.com */ final class RMSerializationHelper { private RMSerializationHelper() { // no instances } public static String getRequiredTextContent(SOAPElement element, QName elementQName) { if (!DOMUtils.hasTextChildNodesOnly(element)) throw new RMException( "Only text content is allowed for element " + elementQName); return DOMUtils.getTextContent(element).trim(); } public static SOAPElement getRequiredElement(SOAPElement element, QName requiredQName, QName contextQName) { return (SOAPElement)getRequiredElement(element, requiredQName, contextQName.toString()); } public static SOAPElement getRequiredElement(SOAPElement element, QName requiredQName, String context) { List childElements = DOMUtils.getChildElementsAsList(element, requiredQName); if (childElements.size() < 1) throw new RMException( "Required " + requiredQName + " element not found in " + context + " element"); if (childElements.size() > 1) throw new RMException( "Only one " + requiredQName + " element can be present in " + context + " element"); return (SOAPElement)childElements.get(0); } public static String getRequiredTextContent(SOAPElement element, QName attributeQName, QName elementQName) { String attributeValue = element.getAttributeValue(attributeQName); if (attributeValue == null) throw new RMException( "Required attribute " + attributeQName + " is missing in element " + elementQName); return attributeValue; } public static SOAPElement getOptionalElement(SOAPElement contextElement, QName optionalQName, QName contextQName) { List list = DOMUtils.getChildElementsAsList(contextElement, optionalQName); if (list.size() > 1) throw new RMException( "At most one " + optionalQName + " element can be present in " + contextQName + " element"); return (SOAPElement)((list.size() == 1) ? list.get(0) : null); } public static List getOptionalElements(SOAPElement contextElement, QName optionalQName, QName contextQName) { List temp = DOMUtils.getChildElementsAsList(contextElement, optionalQName); if (temp.size() == 0) { return Collections.emptyList(); } else { List retVal = new LinkedList(); for (Element e : temp) { retVal.add((SOAPElement)e); } return retVal; } } public static long stringToLong(String toEvaluate, String errorMessage) { try { return Long.valueOf(toEvaluate); } catch (NumberFormatException nfe) { throw new RMException(errorMessage, nfe); } } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMSerializationRepository.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000001141710723247145031715 0ustar godgod/* * 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.wsrm.common.serialization; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFault; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse; import javax.xml.soap.SOAPMessage; import java.util.Map; import java.util.HashMap; /** * Utility class used for de/serialization * @author richard.opalka@jboss.com */ final class RMSerializationRepository { private static final Map, RMSerializer> SERIALIZER_REGISTRY; static { SERIALIZER_REGISTRY = new HashMap, RMSerializer>(); SERIALIZER_REGISTRY.put(RMAckRequested.class, RMAckRequestedSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMCloseSequence.class, RMCloseSequenceSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMCloseSequenceResponse.class, RMCloseSequenceResponseSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMCreateSequence.class, RMCreateSequenceSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMCreateSequenceResponse.class, RMCreateSequenceResponseSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMSequenceAcknowledgement.class, RMSequenceAcknowledgementSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMSequenceFault.class, RMSequenceFaultSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMSequence.class, RMSequenceSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMTerminateSequence.class, RMTerminateSequenceSerializer.getInstance()); SERIALIZER_REGISTRY.put(RMTerminateSequenceResponse.class, RMTerminateSequenceResponseSerializer.getInstance()); } private RMSerializationRepository() { // no instances } /** * Serialize passed object data to the soapMessage * @param object to be serialized * @param soapMessage where to write data * @throws RMException if something went wrong */ public static void serialize(RMAbstractSerializable object, SOAPMessage soapMessage) throws RMException { getSerializer(object).serialize(object, object.getProvider(), soapMessage); } /** * Initialize passed object using data in soapMessage * @param object to be initialized * @param soapMessage from which to read the data * @throws RMException if something went wrong */ public static void deserialize(RMAbstractSerializable object, SOAPMessage soapMessage) throws RMException { getSerializer(object).deserialize(object, object.getProvider(), soapMessage); } /** * Lookups the serializer associated with the passed object * @param object to lookup serializer for * @return serializer to be used * @throws IllegalArgumentException if passed object has no defined serializer */ private static RMSerializer getSerializer(RMSerializable object) { for (Class serializable : SERIALIZER_REGISTRY.keySet()) { if (serializable.isAssignableFrom(object.getClass())) return SERIALIZER_REGISTRY.get(serializable); } throw new IllegalArgumentException(); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/serialization/RMSequenceFaultSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/seria0000644000175000017500000000513410723247145031714 0ustar godgod/* * 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.wsrm.common.serialization; import javax.xml.soap.SOAPMessage; import org.jboss.util.NotImplementedException; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * SequenceFault object de/serializer * @author richard.opalka@jboss.com */ final class RMSequenceFaultSerializer implements RMSerializer { private static final RMSerializer INSTANCE = new RMSequenceFaultSerializer(); private RMSequenceFaultSerializer() { // hide constructor } static RMSerializer getInstance() { return INSTANCE; } /** * Deserialize SequenceFault using provider from the soapMessage * @param object to be deserialized * @param provider wsrm provider to be used for deserialization process * @param soapMessage soap message from which object will be deserialized */ public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { throw new NotImplementedException(); } /** * Serialize SequenceFault using provider to the soapMessage * @param object to be serialized * @param provider wsrm provider to be used for serialization process * @param soapMessage soap message to which object will be serialized */ public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage) throws RMException { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/RMConstantsImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/RMCon0000644000175000017500000002512610723247145031572 0ustar godgod/* * 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.wsrm.common; import javax.xml.namespace.QName; import org.jboss.ws.extensions.wsrm.spi.RMConstants; /** * Utility class which should be used by all WS-RM protocol providers. * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.RMConstants */ public final class RMConstantsImpl implements RMConstants { private final String prefix; private final String namespaceURI; private final QName acceptQName; private final QName ackRequestedQName; private final QName acknowledgementRangeQName; private final QName acksToQName; private final QName closeSequenceQName; private final QName closeSequenceResponseQName; private final QName createSequenceQName; private final QName createSequenceResponseQName; private final QName detailQName; private final QName endpointQName; private final QName expiresQName; private final QName faultCodeQName; private final QName finalQName; private final QName identifierQName; private final QName incompleteSequenceBehaviorQName; private final QName lastMessageNumberQName; private final QName lastMessageQName; private final QName lastMsgNumberQName; private final QName lowerQName; private final QName messageNumberQName; private final QName nackQName; private final QName noneQName; private final QName offerQName; private final QName sequenceAcknowledgementQName; private final QName sequenceFaultQName; private final QName equenceQName; private final QName terminateSequenceQName; private final QName terminateSequenceResponseQName; private final QName upperQName; public RMConstantsImpl(String prefix, String namespaceURI) { this.prefix = prefix; this.namespaceURI = namespaceURI; this.acceptQName = new QName(namespaceURI, "Accept", prefix); this.ackRequestedQName = new QName(namespaceURI, "AckRequested", prefix); this.acknowledgementRangeQName = new QName(namespaceURI, "AcknowledgementRange", prefix); this.acksToQName = new QName(namespaceURI, "AcksTo", prefix); this.closeSequenceQName = new QName(namespaceURI, "CloseSequence", prefix); this.closeSequenceResponseQName = new QName(namespaceURI, "CloseSequenceResponse", prefix); this.createSequenceQName = new QName(namespaceURI, "CreateSequence", prefix); this.createSequenceResponseQName = new QName(namespaceURI, "CreateSequenceResponse", prefix); this.detailQName = new QName(namespaceURI, "Detail", prefix); this.endpointQName = new QName(namespaceURI, "Endpoint", prefix); this.expiresQName = new QName(namespaceURI, "Expires", prefix); this.faultCodeQName = new QName(namespaceURI, "FaultCode", prefix); this.finalQName = new QName(namespaceURI, "Final", prefix); this.identifierQName = new QName(namespaceURI, "Identifier", prefix); this.incompleteSequenceBehaviorQName = new QName(namespaceURI, "IncompleteSequenceBehavior", prefix); this.lastMessageNumberQName = new QName(namespaceURI, "LastMessageNumber", prefix); this.lastMessageQName = new QName(namespaceURI, "LastMessage", prefix); this.lastMsgNumberQName = new QName(namespaceURI, "LastMsgNumber", prefix); this.lowerQName = new QName(null, "Lower", ""); this.messageNumberQName = new QName(namespaceURI, "MessageNumber", prefix); this.nackQName = new QName(namespaceURI, "Nack", prefix); this.noneQName = new QName(namespaceURI, "None", prefix); this.offerQName = new QName(namespaceURI, "Offer", prefix); this.sequenceAcknowledgementQName = new QName(namespaceURI, "SequenceAcknowledgement", prefix); this.sequenceFaultQName = new QName(namespaceURI, "SequenceFault", prefix); this.equenceQName = new QName(namespaceURI, "Sequence", prefix); this.terminateSequenceQName = new QName(namespaceURI, "TerminateSequence", prefix); this.terminateSequenceResponseQName = new QName(namespaceURI, "TerminateSequenceResponse", prefix); this.upperQName = new QName(null, "Upper", ""); } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getPrefix() */ public final String getPrefix() { return this.prefix; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getNamespaceURI() */ public final String getNamespaceURI() { return this.namespaceURI; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getAcceptQName() */ public final QName getAcceptQName() { return this.acceptQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getAckRequestedQName() */ public final QName getAckRequestedQName() { return this.ackRequestedQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getAcknowledgementRangeQName() */ public final QName getAcknowledgementRangeQName() { return this.acknowledgementRangeQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getAcksToQName() */ public final QName getAcksToQName() { return this.acksToQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getCloseSequenceQName() */ public final QName getCloseSequenceQName() { return this.closeSequenceQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getCloseSequenceResponseQName() */ public final QName getCloseSequenceResponseQName() { return this.closeSequenceResponseQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getCreateSequenceQName() */ public final QName getCreateSequenceQName() { return this.createSequenceQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getCreateSequenceResponseQName() */ public final QName getCreateSequenceResponseQName() { return this.createSequenceResponseQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getDetailQName() */ public final QName getDetailQName() { return this.detailQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getEndpointQName() */ public final QName getEndpointQName() { return this.endpointQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getExpiresQName() */ public final QName getExpiresQName() { return this.expiresQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getFaultCodeQName() */ public final QName getFaultCodeQName() { return this.faultCodeQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getFinalQName() */ public final QName getFinalQName() { return this.finalQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getIdentifierQName() */ public final QName getIdentifierQName() { return this.identifierQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getIncompleteSequenceBehaviorQName() */ public final QName getIncompleteSequenceBehaviorQName() { return this.incompleteSequenceBehaviorQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getLastMessageNumberQName() */ public final QName getLastMessageNumberQName() { return this.lastMessageNumberQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getLastMessageQName() */ public final QName getLastMessageQName() { return this.lastMessageQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getLastMsgNumberQName() */ public final QName getLastMsgNumberQName() { return this.lastMsgNumberQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getLowerQName() */ public final QName getLowerQName() { return this.lowerQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getMessageNumberQName() */ public final QName getMessageNumberQName() { return this.messageNumberQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getNackQName() */ public final QName getNackQName() { return this.nackQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getNoneQName() */ public final QName getNoneQName() { return this.noneQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getOfferQName() */ public final QName getOfferQName() { return this.offerQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getSequenceAcknowledgementQName() */ public final QName getSequenceAcknowledgementQName() { return this.sequenceAcknowledgementQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getSequenceFaultQName() */ public final QName getSequenceFaultQName() { return this.sequenceFaultQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getSequenceQName() */ public final QName getSequenceQName() { return this.equenceQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getTerminateSequenceQName() */ public final QName getTerminateSequenceQName() { return this.terminateSequenceQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getTerminateSequenceResponseQName() */ public final QName getTerminateSequenceResponseQName() { return this.terminateSequenceResponseQName; } /** * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getUpperQName() */ public final QName getUpperQName() { return this.upperQName; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/RMHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/common/RMHel0000644000175000017500000002601310747701205031555 0ustar godgod/* * 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.wsrm.common; import java.util.Date; import java.util.List; import java.util.Map; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl; import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt; import org.jboss.ws.extensions.wsrm.RMAddressingConstants; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.RMClientSequence; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.server.RMServerSequence; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * RM utility library * * @author richard.opalka@jboss.com * * @since Nov 29, 2007 */ public final class RMHelper { private static final Logger logger = Logger.getLogger(RMHelper.class); private static final RMConstants rmConstants = RMProvider.get().getConstants(); private RMHelper() { // no instances allowed } private static final DatatypeFactory factory; static { try { factory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException dce) { throw new RMException(dce.getMessage(), dce); } } public static RMServerSequence getServerSequenceByInboundId(String seqId, List sequences) { for (RMServerSequence seq : sequences) { if (seq.getInboundId().equals(seqId)) { return seq; } } return null; } public static RMServerSequence getServerSequenceByOutboundId(String seqId, List sequences) { for (RMServerSequence seq : sequences) { if (seq.getOutboundId().equals(seqId)) { return seq; } } return null; } public static boolean isCreateSequence(Map rmMsgContext) { List protocolMessages = (List)rmMsgContext.get(RMConstant.PROTOCOL_MESSAGES); return protocolMessages.contains(rmConstants.getCreateSequenceQName()); } public static boolean isCloseSequence(Map rmMsgContext) { List protocolMessages = (List)rmMsgContext.get(RMConstant.PROTOCOL_MESSAGES); return protocolMessages.contains(rmConstants.getCloseSequenceQName()); } public static boolean isTerminateSequence(Map rmMsgContext) { List protocolMessages = (List)rmMsgContext.get(RMConstant.PROTOCOL_MESSAGES); return protocolMessages.contains(rmConstants.getTerminateSequenceQName()); } public static boolean isSequence(Map rmMsgContext) { List protocolMessages = (List)rmMsgContext.get(RMConstant.PROTOCOL_MESSAGES); return protocolMessages.contains(rmConstants.getSequenceQName()); } public static boolean isSequenceAcknowledgement(Map rmMsgContext) { List protocolMessages = (List)rmMsgContext.get(RMConstant.PROTOCOL_MESSAGES); return protocolMessages.contains(rmConstants.getSequenceAcknowledgementQName()); } public static Duration stringToDuration(String s) { return factory.newDuration(s); } public static Duration longToDuration(long l) { return factory.newDuration(l); } public static String durationToString(Duration d) { return d.toString(); } public static long durationToLong(Duration d) { if (d == null) return -1L; return d.getTimeInMillis(new Date()); } public static void handleSequenceAcknowledgementHeader(RMSequenceAcknowledgement seqAckHeader, RMClientSequence sequence) { String seqId = seqAckHeader.getIdentifier(); if (sequence.getOutboundId().equals(seqId)) { List ranges = seqAckHeader.getAcknowledgementRanges(); for (RMSequenceAcknowledgement.RMAcknowledgementRange range : ranges) { for (long i = range.getLower(); i <= range.getUpper(); i++) { sequence.addReceivedOutboundMessage(i); } } if (seqAckHeader.isFinal()) { sequence.setFinal(); } } else { logger.warn("Expected outbound sequenceId:" + sequence.getOutboundId() + " , but was: " + seqId); throw new RMException("Expected outbound sequenceId:" + sequence.getOutboundId() + " , but was: " + seqId); } } public static void handleAckRequestedHeader(RMAckRequested ackReqHeader, RMClientSequence sequence) { String inboundSeqId = ackReqHeader.getIdentifier(); if (false == sequence.getInboundId().equals(inboundSeqId)) { logger.warn("Expected inbound sequenceId:" + sequence.getInboundId() + " , but was: " + inboundSeqId); throw new RMException("Expected inbound sequenceId:" + sequence.getInboundId() + " , but was: " + inboundSeqId); } sequence.ackRequested(true); } public static void handleSequenceHeader(RMSequence seqHeader, RMClientSequence sequence) { String inboundSeqId = seqHeader.getIdentifier(); if (null == sequence.getInboundId()) { sequence.setInboundId(inboundSeqId); } else { if (false == sequence.getInboundId().equals(inboundSeqId)) { logger.warn("Expected inbound sequenceId:" + sequence.getInboundId() + " , but was: " + inboundSeqId); throw new RMException("Expected inbound sequenceId:" + sequence.getInboundId() + " , but was: " + inboundSeqId); } } sequence.addReceivedInboundMessage(seqHeader.getMessageNumber()); } public static void setupRMOperations(EndpointMetaData endpointMD) { RMProvider rmProvider = RMProvider.get(); // register createSequence method QName createSequenceQName = rmProvider.getConstants().getCreateSequenceQName(); OperationMetaData createSequenceMD = new OperationMetaData(endpointMD, createSequenceQName, "createSequence"); createSequenceMD.setOneWay(false); // setup addressing related data AddressingOpMetaExt createSequenceAddrExt = new AddressingOpMetaExt(new AddressingPropertiesImpl().getNamespaceURI()); createSequenceAddrExt.setInboundAction(RMAddressingConstants.CREATE_SEQUENCE_WSA_ACTION); createSequenceAddrExt.setOutboundAction(RMAddressingConstants.CREATE_SEQUENCE_RESPONSE_WSA_ACTION); createSequenceMD.addExtension(createSequenceAddrExt); // register operation metadata with endpoint metadata endpointMD.addOperation(createSequenceMD); // register sequenceAcknowledgement method QName sequenceAcknowledgementQName = rmProvider.getConstants().getSequenceAcknowledgementQName(); OperationMetaData sequenceAcknowledgementMD = new OperationMetaData(endpointMD, sequenceAcknowledgementQName, "sequenceAcknowledgement"); sequenceAcknowledgementMD.setOneWay(true); // setup addressing related data AddressingOpMetaExt sequenceAcknowledgementAddrExt = new AddressingOpMetaExt(new AddressingPropertiesImpl().getNamespaceURI()); sequenceAcknowledgementAddrExt.setInboundAction(RMAddressingConstants.SEQUENCE_ACKNOWLEDGEMENT_WSA_ACTION); sequenceAcknowledgementMD.addExtension(sequenceAcknowledgementAddrExt); // register operation metadata with endpoint metadata endpointMD.addOperation(sequenceAcknowledgementMD); if (rmProvider.getMessageFactory().newCloseSequence() != null) { // register closeSequence method QName closeSequenceQName = rmProvider.getConstants().getCloseSequenceQName(); OperationMetaData closeSequenceMD = new OperationMetaData(endpointMD, closeSequenceQName, "closeSequence"); closeSequenceMD.setOneWay(false); // setup addressing related data AddressingOpMetaExt closeSequenceAddrExt = new AddressingOpMetaExt(new AddressingPropertiesImpl().getNamespaceURI()); closeSequenceAddrExt.setInboundAction(RMAddressingConstants.CLOSE_SEQUENCE_WSA_ACTION); closeSequenceAddrExt.setOutboundAction(RMAddressingConstants.CLOSE_SEQUENCE_RESPONSE_WSA_ACTION); closeSequenceMD.addExtension(closeSequenceAddrExt); // register operation metadata with endpoint metadata endpointMD.addOperation(closeSequenceMD); } // register terminateSequence method QName terminateSequenceQName = rmProvider.getConstants().getTerminateSequenceQName(); OperationMetaData terminateSequenceMD = new OperationMetaData(endpointMD, terminateSequenceQName, "terminateSequence"); boolean isOneWay = rmProvider.getMessageFactory().newTerminateSequenceResponse() == null; terminateSequenceMD.setOneWay(isOneWay); // setup addressing related data AddressingOpMetaExt terminateSequenceAddrExt = new AddressingOpMetaExt(new AddressingPropertiesImpl().getNamespaceURI()); terminateSequenceAddrExt.setInboundAction(RMAddressingConstants.TERMINATE_SEQUENCE_WSA_ACTION); if (!isOneWay) { terminateSequenceAddrExt.setOutboundAction(RMAddressingConstants.TERMINATE_SEQUENCE_RESPONSE_WSA_ACTION); } terminateSequenceMD.addExtension(terminateSequenceAddrExt); // register operation metadata with endpoint metadata endpointMD.addOperation(terminateSequenceMD); } public static boolean isRMOperation(QName operationQName) { return RMConstant.PROTOCOL_OPERATION_QNAMES.contains(operationQName); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/0000755000175000017500000000000010755000257030162 5ustar godgod././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000755000175000017500000000000010755000257031744 5ustar godgod././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMCloseSequenceResponse.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000404310723247145031753 0ustar godgod/* * 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.wsrm.spi.protocol; /** *

      CloseSequenceResponse element is sent in the body of a message in response to receipt of a CloseSequence * request message. It indicates that the responder has closed the Sequence.

      * * The following infoset defines its syntax: *

       * <wsrm:CloseSequenceResponse ...>
       *     <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *     ... 
       * </wsrm:CloseSequenceResponse>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMCloseSequenceResponse extends RMSerializable { /** * The responder (RM Source or RM Destination) MUST include this element in any * CloseSequenceResponse message it sends. The responder MUST set the value of this * element to the absolute URI (conformant with RFC3986) of the closing Sequence. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return sequence identifier */ String getIdentifier(); } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMTerminateSequence.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000647510723247145031766 0ustar godgod/* * 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.wsrm.spi.protocol; /** *

      TerminateSequence MAY be sent by an RM Source to indicate it has completed its use of the Sequence. * It indicates that the RM Destination can safely reclaim any resources related to the identified * Sequence. The RM Source MUST NOT send this element as a header block. The RM Source * MAY retransmit this element. Once this element is sent, other than this element, the RM Source * MUST NOT send any additional message to the RM Destination referencing this Sequence.

      * *

      This element MAY also be sent by the RM Destination to indicate that it has unilaterally * terminated the Sequence. Upon sending this message the RM Destination MUST NOT accept * any additional messages (with the exception of the corresponding * TerminateSequenceResponse) for this Sequence. Upon receipt of a TerminateSequence * the RM Source MUST NOT send any additional messages (with the exception of the * corresponding TerminateSequenceResponse) for this Sequence.

      * * The following infoset defines its syntax: *

       * <wsrm:TerminateSequence ...>
       *     <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *     <wsrm:LastMsgNumber> wsrm:MessageNumberType </wsrm:LastMsgNumber> ?
       *     ... 
       * </wsrm:TerminateSequence>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMTerminateSequence extends RMSerializable { /** * The RM Source or RM Destination MUST include this element in any TerminateSequence * message it sends. The RM Source or RM Destination MUST set the value of this element to the * absolute URI (conformant with RFC3986) of the terminating Sequence. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return sequence identifier */ String getIdentifier(); /** * The RM Source SHOULD include this element in any TerminateSequence message it sends. The * LastMsgNumber element specifies the highest assigned message number of all the Sequence * Traffic Messages for the terminating Sequence. * @param lastMsgNumber */ void setLastMsgNumber(long lastMsgNumber); /** * Getter * @return last message number */ long getLastMsgNumber(); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMAckRequested.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000510610723247145031754 0ustar godgod/* * 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.wsrm.spi.protocol; /** *

      AckRequested element requests an Acknowledgement for the identified Sequence.

      * * The following infoset defines its syntax: *

       * <wsrm:AckRequested ...>
       *     <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *     <wsrm:MessageNumber> xs:unsignedLong </wsrm:MessageNumber> ?
       *     ... 
       * </wsrm:AckRequested>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMAckRequested extends RMSerializable { /** * An RM Source that includes an AckRequested header block in a SOAP envelope MUST include * this element in that header block. The RM Source MUST set the value of this element to the * absolute URI, (conformant with RFC3986), that uniquely identifies the Sequence to which the * request applies. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return sequence identifier */ String getIdentifier(); /** * This optional element, if present, MUST contain an xs:unsignedLong representing the highest * MessageNumber sent by the RM Source within a Sequence. If present, it MAY be treated * as a hint to the RM Destination as an optimization to the process of preparing to transmit a * SequenceAcknowledgement. * @param lastMessageNumber */ void setMessageNumber(long lastMessageNumber); /** * Getter * @return last message number in the sequence */ long getMessageNumber(); } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMTerminateSequenceResponse.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000417310723247145031757 0ustar godgod/* * 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.wsrm.spi.protocol; /** *

      TerminateSequenceResponse is sent in the body of a message in response to receipt of a TerminateSequence * request message. It indicates that the responder has terminated the Sequence. The responder * MUST NOT send this element as a header block.

      * * The following infoset defines its syntax: *

       * <wsrm:TerminateSequenceResponse ...>
       *     <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *     ... 
       * </wsrm:TerminateSequenceResponse>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMTerminateSequenceResponse extends RMSerializable { /** * The responder (RM Source or RM Destination) MUST include this element in any * TerminateSequenceResponse message it sends. The responder MUST set the value of this * element to the absolute URI (conformant with RFC3986) of the terminating Sequence. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return sequence identifier */ String getIdentifier(); } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMSequenceAcknowledgement.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000001507110723766636031771 0ustar godgod/* * 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.wsrm.spi.protocol; import java.util.List; /** * *

      wsrm:SequenceAcknowledgement element contains the sequence acknowledgement information

      * * The following infoset defines its syntax: *

       * <wsrm:SequenceAcknowledgement ...>
       *     <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *     [ [ [ <wsrm:AcknowledgementRange  ...
       *             Upper="wsrm:MessageNumberType"
       *             Lower="wsrm:MessageNumberType"/> + 
       *         | <wsrm:None/> ]
       *         <wsrm:Final/> ? ]
       *     | <wsrm:Nack> wsrm:MessageNumberType </wsrm:Nack> + ]
       *     
       *     ... 
       * </wsrm:SequenceAcknowledgement>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMSequenceAcknowledgement extends RMSerializable { /** * An RM Destination that includes a SequenceAcknowledgement header block in a SOAP * envelope MUST include this element in that header block. The RM Destination MUST set the * value of this element to the absolute URI (conformant with RFC3986) that uniquely identifies the * Sequence. The RM Destination MUST NOT include multiple SequenceAcknowledgement * header blocks that share the same value for Identifier within the same SOAP envelope. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return sequence identifier */ String getIdentifier(); /** * The RM Destination MAY include this element within a SequenceAcknowledgement header * block. This element indicates that the RM Destination is not receiving new messages for the * specified Sequence. The RM Source can be assured that the ranges of messages acknowledged * by this SequenceAcknowledgement header block will not change in the future. The RM * Destination MUST include this element when the Sequence is closed. The RM Destination MUST * NOT include this element when sending a Nack; it can only be used when sending * AcknowledgementRange elements or a None. */ void setFinal(); /** * Getter * @return true if SequenceAcknowledgement is Final, false otherwise */ boolean isFinal(); /** * The RM Destination MUST include this element within a SequenceAcknowledgement header * block if the RM Destination has not accepted any messages for the specified Sequence. The RM * Destination MUST NOT include this element if a sibling AcknowledgementRange or Nack * element is also present as a child of the SequenceAcknowledgement. */ void setNone(); /** * Getter * @return true if SequenceAcknowledgement is None, false otherwise */ boolean isNone(); /** * The RM Destination MAY include this element within a SequenceAcknowledgement header * block. If used, the RM Destination MUST set the value of this element to a MessageNumberType * representing the MessageNumber of an unreceived message in a Sequence. The RM Destination * MUST NOT include a Nack element if a sibling AcknowledgementRange or None element is * also present as a child of SequenceAcknowledgement. Upon the receipt of a Nack, an RM * Source SHOULD retransmit the message identified by the Nack. The RM Destination MUST NOT * issue a SequenceAcknowledgement containing a Nack for a message that it has previously * acknowledged within an AcknowledgementRange. The RM Source SHOULD ignore a * SequenceAcknowledgement containing a Nack for a message that has previously been * acknowledged within an AcknowledgementRange. * @param messageNumber */ void addNack(long messageNumber); /** * Getter * @return list of not ackonwledged message numbers */ List getNacks(); /** * Factory method * @return new instance of AcknowledgementRange */ RMAcknowledgementRange newAcknowledgementRange(); /** * Setter * @param acknowledgementRange */ void addAcknowledgementRange(RMAcknowledgementRange acknowledgementRange); /** * Getter * @return list of acknowledged ranges */ List getAcknowledgementRanges(); /** * The RM Destination MAY include one or more instances of this element within a * SequenceAcknowledgement header block. It contains a range of Sequence message numbers * successfully accepted by the RM Destination. The ranges MUST NOT overlap. The RM * Destination MUST NOT include this element if a sibling Nack or None element is also present as * a child of SequenceAcknowledgement. */ interface RMAcknowledgementRange { /** * The RM Destination MUST set the value of this attribute equal to the message number of the * highest contiguous message in a Sequence range accepted by the RM Destination. * @param upper */ void setUpper(long upper); /** * Getter * @return upper value */ long getUpper(); /** * The RM Destination MUST set the value of this attribute equal to the message number of the * lowest contiguous message in a Sequence range accepted by the RM Destination. * @param lower */ void setLower(long lower); /** * Getter * @return lower value */ long getLower(); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMSequenceFault.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000503010723247145031750 0ustar godgod/* * 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.wsrm.spi.protocol; /** *

      SequenceFault element purpose is to carry the specific details of a fault generated during the * reliable messaging specific processing of a message belonging to a Sequence. WS-ReliableMessaging * nodes MUST use the SequenceFault container only in conjunction with the SOAP 1.1 fault mechanism. * WS-ReliableMessaging nodes MUST NOT use the SequenceFault container in conjunction with the * SOAP 1.2 binding.

      * * The following infoset defines its syntax: *

       * <SequenceFault ...>
       *     <wsrm:FaultCode> wsrm:FaultCode </wsrm:FaultCode>
       *     <wsrm:Detail> ... </wsrm:Detail> ?
       *     ...
       * </SequenceFault>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMSequenceFault extends RMSerializable { /** * WS-ReliableMessaging nodes that generate a SequenceFault MUST set the value of this * element to a qualified name from the set of faults [Subcodes] defined below. * @param faultCode */ void setFaultCode(RMSequenceFaultCode faultCode); /** * Getter * @return sequence fault code */ RMSequenceFaultCode getFaultCode(); /** * This element, if present, carries application specific error information * related to the fault being described. * @param detail */ void setDetail(Exception detail); /** * Getter * @return application specific fault detail */ Exception getDetail(); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMSerializable.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000360010723247145031751 0ustar godgod/* * 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.wsrm.spi.protocol; import javax.xml.soap.SOAPMessage; import org.jboss.ws.extensions.wsrm.api.RMException; /** * This interface identifies classes that are de/serializable from/to SOAP messages * * @author richard.opalka@jboss.com */ public interface RMSerializable { /** * Serialize object instance to SOAP message * @param soapMessage * @throws RMException is something went wrong */ void serializeTo(SOAPMessage soapMessage) throws RMException; /** * Deserialize object instance from SOAP message * @param soapMessage ReliableMessagingException is something went wrong */ void deserializeFrom(SOAPMessage soapMessage) throws RMException; /** * Validate object state if everything is all right * @throws RMException if object is in incorrect state */ void validate() throws RMException; } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMSequence.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000641310723247145031756 0ustar godgod/* * 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.wsrm.spi.protocol; /** *

      Sequence protocol element associates the message in which it is contained with a previously * established RM Sequence. It contains the Sequence's unique identifier and the containing * message's ordinal position within that Sequence. The RM Destination MUST understand the * Sequence header block. The RM Source MUST assign a mustUnderstand attribute with a * value 1/true (from the namespace corresponding to the version of SOAP to which the Sequence * SOAP header block is bound) to the Sequence header block element.

      * * The following infoset defines its syntax: *

       * <wsrm:Sequence ...>
       *     <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *     <wsrm:MessageNumber> wsrm:MessageNumberType </wsrm:MessageNumber>
       *     <wsrm:LastMessage/> ?
       *     ...
       * </wsrm:Sequence>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMSequence extends RMSerializable { /** * An RM Source that includes a Sequence header block in a SOAP envelope MUST include this * element in that header block. The RM Source MUST set the value of this element to the absolute * URI (conformant with RFC3986) that uniquely identifies the Sequence. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return sequence identifier */ String getIdentifier(); /** * The RM Source MUST include this element within any Sequence headers it creates. This element * is of type MessageNumberType. It represents the ordinal position of the message within a * Sequence. Sequence message numbers start at 1 and monotonically increase by 1 throughout * the Sequence. * @param messageNumber */ void setMessageNumber(long messageNumber); /** * Getter * @return message number within specified sequence */ long getMessageNumber(); /** * This element MAY be included by the RM Source endpoint. The LastMessage element has no content. * @param lastMessage */ void setLastMessage(); /** * Getter * @return last message indicator */ boolean isLastMessage(); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMCreateSequence.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000001620510723766636031771 0ustar godgod/* * 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.wsrm.spi.protocol; import javax.xml.datatype.Duration; /** *

      CreateSequence element requests creation of a new Sequence between the RM Source that sends it, and the * RM Destination to which it is sent. The RM Source MUST NOT send this element as a header * block. The RM Destination MUST respond either with a CreateSequenceResponse response * message or a CreateSequenceRefused fault.

      * * The following infoset defines its syntax: *

       * <wsrm:CreateSequence ...>
       *     <wsrm:AcksTo> wsa:EndpointReferenceType </wsrm:AcksTo>
       *     <wsrm:Expires ...> xs:duration </wsrm:Expires> ?
       *     <wsrm:Offer ...>
       *         <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *         <wsrm:Endpoint> wsa:EndpointReferenceType </wsrm:Endpoint>
       *         <wsrm:Expires ...> xs:duration </wsrm:Expires> ?
       *         <wsrm:IncompleteSequenceBehavior>
       *             wsrm:IncompleteSequenceBehaviorType
       *         </wsrm:IncompleteSequenceBehavior> ?
       *          ... 
       *     </wsrm:Offer> ?
       *     ... 
       * </wsrm:CreateSequence>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMCreateSequence extends RMSerializable { /** *

      The RM Source MUST include this element in any CreateSequence message it sends. This * element is of type wsa:EndpointReferenceType (as specified by WS-Addressing). It specifies * the endpoint reference to which messages containing SequenceAcknowledgement header * blocks and faults related to the created Sequence are to be sent, unless otherwise noted in this * specification.

      *

      Implementations MUST NOT use an endpoint reference in the AcksTo element that would prevent * the sending of Sequence Acknowledgements back to the RM Source. For example, using the WS-Addressing * "http://www.w3.org/2005/08/addressing/none" URI would make it impossible for the RM * Destination to ever send Sequence Acknowledgements.

      * @param address */ void setAcksTo(String address); /** * Getter * @return address */ String getAcksTo(); /** * This element, if present, of type xs:duration specifies the RM Source's requested duration for * the Sequence. The RM Destination MAY either accept the requested duration or assign a lesser * value of its choosing. A value of "PT0S" indicates that the Sequence will never expire. Absence of * the element indicates an implied value of "PT0S". * @param duration */ void setExpires(Duration duration); /** * Getter * @return duration */ Duration getExpires(); /** * Factory method * @return new instance of Offer */ RMOffer newOffer(); /** * Setter * @param offer */ void setOffer(RMOffer offer); /** * Getter * @return offer */ RMOffer getOffer(); /** * This element, if present, enables an RM Source to offer a corresponding Sequence for the reliable * exchange of messages Transmitted from RM Destination to RM Source. */ interface RMOffer { /** * The RM Source MUST set the value of this element to an absolute URI (conformant with * RFC3986 [URI]) that uniquely identifies the offered Sequence. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return offered sequence identifier */ String getIdentifier(); /** *

      An RM Source MUST include this element, of type wsa:EndpointReferenceType (as * specified by WS-Addressing). This element specifies the endpoint reference to which Sequence * Lifecycle Messages, Acknowledgement Requests, and fault messages related to the offered * Sequence are to be sent.

      * *

      Implementations MUST NOT use an endpoint reference in the Endpoint element that would * prevent the sending of Sequence Lifecycle Message, etc. For example, using the WS-Addressing * "http://www.w3.org/2005/08/addressing/none" URI would make it impossible for the RM Destination * to ever send Sequence Lifecycle Messages (e.g. TerminateSequence) to the RM Source for * the Offered Sequence.

      * *

      The Offer of an Endpoint containing the "http://www.w3.org/2005/08/addressing/anonymous" URI * as its address is problematic due to the inability of a source to connect to this address and retry * unacknowledged messages. Note that this specification does not * define any mechanisms for providing this assurance. In the absence of an extension that * addresses this issue, an RM Destination MUST NOT accept (via the * /wsrm:CreateSequenceResponse/wsrm:Accept) an Offer that * contains the "http://www.w3.org/2005/08/addressing/anonymous" URI as its address.

      * @param address */ void setEndpoint(String address); /** * Getter * @return offered endpoint address */ String getEndpoint(); /** * This element, if present, of type xs:duration specifies the duration for the offered Sequence. A * value of "PT0S" indicates that the offered Sequence will never expire. Absence of the element * indicates an implied value of "PT0S". * @param duration */ void setExpires(String duration); /** * Getter * @return offered sequence duration */ String getExpires(); /** * This element, if present, specifies the behavior that the destination will exhibit upon the closure or * termination of an incomplete Sequence. * @param incompleteSequenceBehavior */ void setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior incompleteSequenceBehavior); /** * Getter * @return offered incomplete sequence behavior */ RMIncompleteSequenceBehavior getIncompleteSequenceBehavior(); } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMIncompleteSequenceBehavior.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000674010723247145031761 0ustar godgod/* * 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.wsrm.spi.protocol; /** *

      This element, if present, specifies the behavior that the destination will exhibit upon the closure or * termination of an incomplete Sequence. For the purposes of defining the values used, the term * "discard" refers to behavior equivalent to the Application Destination never processing a particular message.

      * * The following schema snippet defines allowed values: *

       * <xs:simpleType name="IncompleteSequenceBehaviorType">
       *     <xs:restriction base="xs:string">
       *         <xs:enumeration value="DiscardEntireSequence"/>
       *         <xs:enumeration value="DiscardFollowingFirstGap"/>
       *         <xs:enumeration value="NoDiscard"/>
       *     </xs:restriction>
       * </xs:simpleType>
       * 

      * * @author richard.opalka@jboss.com */ public enum RMIncompleteSequenceBehavior { /** * A value of "DiscardEntireSequence" indicates that the entire Sequence MUST be discarded if the * Sequence is closed, or terminated, when there are one or more gaps in the final SequenceAcknowledgement. */ DISCARD_ENTIRE_SEQUENCE("DiscardEntireSequence"), /** * A value of "DiscardFollowingFirstGap" indicates that messages in the Sequence beyond the first * gap MUST be discarded when there are one or more gaps in the final SequenceAcknowledgement. */ DISCARD_FOLLOWING_FIRST_GAP("DiscardFollowingFirstGap"), /** * The default value of "NoDiscard" indicates that no acknowledged messages in the Sequence will * be discarded. */ NO_DISCARD("NoDiscard"); private final String value; RMIncompleteSequenceBehavior(String value) { this.value = value; } public String toString() { return value; } /** * Returns this enum instance if value string matches, null otherwise * @param stringValue value in the form of string * @return enum or null if string not recognized */ public static RMIncompleteSequenceBehavior getValue(String stringValue) { if (DISCARD_ENTIRE_SEQUENCE.toString().equals(stringValue)) return DISCARD_ENTIRE_SEQUENCE; if (DISCARD_FOLLOWING_FIRST_GAP.toString().equals(stringValue)) return DISCARD_FOLLOWING_FIRST_GAP; if (NO_DISCARD.toString().equals(stringValue)) return NO_DISCARD; return null; } }././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMCloseSequence.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000514110723247145031753 0ustar godgod/* * 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.wsrm.spi.protocol; /** *

      CloseSequence element MAY be sent by an RM Source to indicate that the RM Destination MUST NOT * accept any new messages for this Sequence This element MAY also be sent by an RM * Destination to indicate that it will not accept any new messages for this Sequence.

      * * The following infoset defines its syntax: *

       * <wsrm:CloseSequence ...>
       *     <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *     <wsrm:LastMsgNumber> wsrm:MessageNumberType </wsrm:LastMsgNumber> ?
       *     ... 
       * </wsrm:CloseSequence>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMCloseSequence extends RMSerializable { /** * The RM Source or RM Destination MUST include this element in any CloseSequence messages it * sends. The RM Source or RM Destination MUST set the value of this element to the absolute URI * (conformant with RFC3986) of the closing Sequence. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return sequence identifier */ String getIdentifier(); /** * The RM Source SHOULD include this element in any CloseSequence message it sends. The * LastMsgNumber element specifies the highest assigned message number of all the Sequence * Traffic Messages for the closing Sequence. * @param lastMsgNumber */ void setLastMsgNumber(long lastMsgNumber); /** * Getter * @return last message number */ long getLastMsgNumber(); } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMCreateSequenceResponse.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000001334110723766636031767 0ustar godgod/* * 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.wsrm.spi.protocol; import javax.xml.datatype.Duration; /** *

      CreateSequenceResponse element is sent in the body of the response message in response to a CreateSequence * request message. It indicates that the RM Destination has created a new Sequence at the * request of the RM Source. The RM Destination MUST NOT send this element as a header block.

      * * The following infoset defines its syntax: *

       * <CreateSequenceResponse ...>
       *     <wsrm:Identifier ...> xs:anyURI </wsrm:Identifier>
       *     <wsrm:Expires ...> xs:duration </wsrm:Expires> ?
       *     <wsrm:IncompleteSequenceBehavior>
       *         wsrm:IncompleteSequenceBehaviorType
       *     </wsrm:IncompleteSequenceBehavior> ?
       *     <wsrm:Accept ...>
       *         <wsrm:AcksTo> wsa:EndpointReferenceType </wsrm:AcksTo>
       *         ...
       *     </wsrm:Accept> ?
       *     ... 
       * </CreateSequenceResponse>
       * 

      * * @author richard.opalka@jboss.com */ public interface RMCreateSequenceResponse extends RMSerializable { /** * The RM Destination MUST include this element within any CreateSequenceResponse message it * sends. The RM Destination MUST set the value of this element to the absolute URI (conformant * with RFC3986) that uniquely identifies the Sequence that has been created by the RM Destination. * @param identifier */ void setIdentifier(String identifier); /** * Getter * @return sequence identifier */ String getIdentifier(); /** * This element, if present, of type xs:duration accepts or refines the RM Source's requested * duration for the Sequence. It specifies the amount of time after which any resources associated * with the Sequence SHOULD be reclaimed thus causing the Sequence to be silently terminated. At * the RM Destination this duration is measured from a point proximate to Sequence creation and at * the RM Source this duration is measured from a point approximate to the successful processing of * the CreateSequenceResponse. A value of "PT0S" indicates that the Sequence will never * expire. Absence of the element indicates an implied value of "PT0S". The RM Destination MUST * set the value of this element to be equal to or less than the value requested by the RM Source in * the corresponding CreateSequence message. * @param duration */ void setExpires(Duration duration); /** * Getter * @return sequence duration */ Duration getExpires(); /** * This element, if present, specifies the behavior that the destination will exhibit upon the closure or * termination of an incomplete Sequence. * @param incompleteSequenceBehavior */ void setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior incompleteSequenceBehavior); /** * Getter * @return used incomplete sequence behavior type */ RMIncompleteSequenceBehavior getIncompleteSequenceBehavior(); /** * Factory method * @return new instance of accept */ RMAccept newAccept(); /** * Setter * @param accept */ void setAccept(RMAccept accept); /** * Getter * @return accept */ RMAccept getAccept(); /** *

      This element, if present, enables an RM Destination to accept the offer of a corresponding * Sequence for the reliable exchange of messages Transmitted from RM Destination to RM Source.

      * *

      Note: If a CreateSequenceResponse is returned without a child Accept in response to a * CreateSequence that did contain a child Offer, then the RM Source MAY immediately reclaim * any resources associated with the unused offered Sequence.

      */ interface RMAccept { /** *

      The RM Destination MUST include this element, of type wsa:EndpointReferenceType (as * specified by WS-Addressing). It specifies the endpoint reference to which messages containing * SequenceAcknowledgement header blocks and faults related to the created Sequence are to * be sent, unless otherwise noted in this specification.

      * *

      Implementations MUST NOT use an endpoint reference in the AcksTo element that would prevent * the sending of Sequence Acknowledgements back to the RM Source. For example, using the * WS-Addressing "http://www.w3.org/2005/08/addressing/none" URI would make it impossible for the RM * Destination to ever send Sequence Acknowledgements.

      * @param address */ void setAcksTo(String address); /** * Getter * @return address */ String getAcksTo(); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol/RMSequenceFaultCode.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/protocol0000644000175000017500000000353010723247145031753 0ustar godgod/* * 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.wsrm.spi.protocol; /** * WS-ReliableMessaging nodes that generate a SequenceFault MUST set the value of this * element to a qualified name from the set of faults [Subcodes] defined below. * * @author richard.opalka@jboss.com */ public enum RMSequenceFaultCode { /** * Sequence terminated */ SEQUENCE_TERMINATED, /** * Unknown sequence */ UNKNOWN_SEQUENCE, /** * Invalid acknowledgement */ INVALID_ACKNOWLEDGEMENT, /** * Message number rollover */ MESSAGE_NUMBER_ROLLOVER, /** * Create sequence refused */ CREATE_SEQUENCE_REFUSED, /** * Sequence closed */ SEQUENCE_CLOSED, /** * WSRM required */ WSRM_REQUIRED, /** * Last message number exceeded */ LAST_MESSAGE_NUMBER_EXCEEDED } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/RMProvider.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/RMProvid0000644000175000017500000000412710747701205031615 0ustar godgod/* * 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.wsrm.spi; import org.jboss.wsf.spi.util.ServiceLoader; /** * WS-RM Provider SPI facade. Each WS-RM provider must override this class. * * @author richard.opalka@jboss.com */ public abstract class RMProvider { private static final RMProvider rmProviderImpl = (RMProvider) ServiceLoader.loadService( RMProvider.class.getName(), org.jboss.ws.extensions.wsrm.spec200702.RMProviderImpl.class.getName()); /** * Must be overriden in subclasses * @param targetNamespace */ protected RMProvider() { } /** * Returns the namespace associated with current WS-RM provider implementation * @return */ public abstract String getNamespaceURI(); /** * Returns WS-RM provider specific message factory * @return message factory */ public abstract RMMessageFactory getMessageFactory(); /** * Returns WS-RM provider specific constants * @return constants */ public abstract RMConstants getConstants(); public static final RMProvider get() { return rmProviderImpl; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/RMConstants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/RMConsta0000644000175000017500000001042710723247145031603 0ustar godgod/* * 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.wsrm.spi; import javax.xml.namespace.QName; /** * WS-RM protocol elements SPI facade. Each WS-RM provider must implement this interface. * * @author richard.opalka@jboss.com */ public interface RMConstants { /** * getter * @return wsrm prefix */ String getPrefix(); /** * getter * @return wsrm namespace */ String getNamespaceURI(); /** * getter * @return LastMessage QName */ QName getLastMessageQName(); /** * getter * @return CreateSequence QName */ QName getCreateSequenceQName(); /** * getter * @return AcksTo QName */ QName getAcksToQName(); /** * getter * @return Expires QName */ QName getExpiresQName(); /** * getter * @return Offer QName */ QName getOfferQName(); /** * getter * @return Identifier QName */ QName getIdentifierQName(); /** * getter * @return Endpoint QName */ QName getEndpointQName(); /** * getter * @return IncompleteSequenceBehavior QName */ QName getIncompleteSequenceBehaviorQName(); /** * getter * @return CreateSequenceResponse QName */ QName getCreateSequenceResponseQName(); /** * getter * @return Accept QName */ QName getAcceptQName(); /** * getter * @return CloseSequence QName */ QName getCloseSequenceQName(); /** * getter * @return LastMessageNumber QName */ QName getLastMessageNumberQName(); /** * getter * @return CloseSequenceResponse QName */ QName getCloseSequenceResponseQName(); /** * getter * @return TerminateSequence QName */ QName getTerminateSequenceQName(); /** * getter * @return LastMsgNumber QName */ QName getLastMsgNumberQName(); /** * getter * @return TerminateSequenceResponse QName */ QName getTerminateSequenceResponseQName(); /** * getter * @return Sequence QName */ QName getSequenceQName(); /** * getter * @return MessageNumber QName */ QName getMessageNumberQName(); /** * getter * @return AckRequested QName */ QName getAckRequestedQName(); /** * getter * @return SequenceAcknowledgement QName */ QName getSequenceAcknowledgementQName(); /** * getter * @return AcknowledgementRange QName */ QName getAcknowledgementRangeQName(); /** * getter * @return Upper QName */ QName getUpperQName(); /** * getter * @return Lower QName */ QName getLowerQName(); /** * getter * @return None QName */ QName getNoneQName(); /** * getter * @return Final QName */ QName getFinalQName(); /** * getter * @return Nack QName */ QName getNackQName(); /** * getter * @return SequenceFault QName */ QName getSequenceFaultQName(); /** * getter * @return FaultCode QName */ QName getFaultCodeQName(); /** * getter * @return Detail QName */ QName getDetailQName(); } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/RMMessageFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spi/RMMessag0000644000175000017500000000653110723247145031574 0ustar godgod/* * 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.wsrm.spi; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFault; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse; /** * WS-RM protocol elements SPI facade. Each WS-RM provider must implement this interface. * * @author richard.opalka@jboss.com */ public interface RMMessageFactory { /** * Factory method * @return new CreateSequence instance */ RMCreateSequence newCreateSequence(); /** * Factory method * @return new CreateSequenceResponse instance */ RMCreateSequenceResponse newCreateSequenceResponse(); /** * Factory method * @return new CloseSequence instance or null if this message is not supported by underlying WS-RM provider */ RMCloseSequence newCloseSequence(); /** * Factory method * @return new CloseSequenceResponse instance or null if this message is not supported by underlying WS-RM provider */ RMCloseSequenceResponse newCloseSequenceResponse(); /** * Factory method * @return new TerminateSequence instance */ RMTerminateSequence newTerminateSequence(); /** * Factory method * @return new TerminateSequenceResponse instance or null if this message is not supported by underlying WS-RM provider */ RMTerminateSequenceResponse newTerminateSequenceResponse(); /** * Factory method * @return new Sequence instance */ RMSequence newSequence(); /** * Factory method * @return new AckRequested instance */ RMAckRequested newAckRequested(); /** * Factory method * @return new SequenceAcknowledgement instance */ RMSequenceAcknowledgement newSequenceAcknowledgement(); /** * Factory method * @return new SequenceFault instance */ RMSequenceFault newSequenceFault(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/0000755000175000017500000000000010755000257030523 5ustar godgod././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/RMServ0000644000175000017500000001415210732176562031637 0ustar godgod/* * 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.wsrm.jaxws; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.addressing.soap.SOAPAddressingProperties; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.MessageContext.Scope; import javax.xml.ws.handler.soap.SOAPMessageContext; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.RMSequence; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * Server WS-RM JAX-WS handler * * @author richard.opalka@jboss.com * * @since Dec 12, 2007 */ public final class RMServerHandler extends RMHandlerAbstractBase { private static final RMConstants rmConstants = RMProvider.get().getConstants(); protected final boolean handleOutbound(MessageContext msgContext) { log.debug("handling outbound message"); CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext; SOAPAddressingProperties addrProps = (SOAPAddressingProperties)commonMsgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND); Map rmOutboundContext = (Map)commonMsgContext.get(RMConstant.RESPONSE_CONTEXT); List outMsgs = (List)rmOutboundContext.get(RMConstant.PROTOCOL_MESSAGES); Map data = new HashMap(); String optionalMessageId = (addrProps.getMessageID() != null) ? addrProps.getMessageID().getURI().toString() : null; rmOutboundContext.put(RMConstant.WSA_MESSAGE_ID, optionalMessageId); rmOutboundContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data); SOAPMessage soapMessage = ((SOAPMessageContext)commonMsgContext).getMessage(); RMSequence sequenceImpl = (RMSequence)rmOutboundContext.get(RMConstant.SEQUENCE_REFERENCE); // try to serialize CreateSequenceResponse to message serialize(rmConstants.getCreateSequenceResponseQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize Sequence to message serialize(rmConstants.getSequenceQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize AckRequested to message serialize(rmConstants.getAckRequestedQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize CloseSequenceResponse to message serialize(rmConstants.getCloseSequenceResponseQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize TerminateSequenceResponse to message serialize(rmConstants.getTerminateSequenceResponseQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize SequenceAcknowledgement to message serialize(rmConstants.getSequenceAcknowledgementQName(), outMsgs, data, soapMessage, sequenceImpl); if ((outMsgs.size() != 0) && (data.size() == 0)) throw new RMException("RM handler have not serialized WS-RM message to the payload"); // TODO: implement SequenceFault serialization return true; } protected final boolean handleInbound(MessageContext msgContext) { log.debug("handling inbound message"); SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); // initialize RM response context Map rmResponseContext = new HashMap(); List messages = new LinkedList(); rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, messages); Map data = new HashMap(); rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data); // try to read CreateSequence from message deserialize(rmConstants.getCreateSequenceQName(), soapMessage, messages, data); // try to read AckRequested from message deserialize(rmConstants.getAckRequestedQName(), soapMessage, messages, data); // try to read Sequence from message deserialize(rmConstants.getSequenceQName(), soapMessage, messages, data); // try to read SequenceAcknowledgement from message deserialize(rmConstants.getSequenceAcknowledgementQName(), soapMessage, messages, data); // try to read CloseSequence from message deserialize(rmConstants.getCloseSequenceQName(), soapMessage, messages, data); // try to read TerminateSequence from message deserialize(rmConstants.getTerminateSequenceQName(), soapMessage, messages, data); if (data.size() == 0) throw new RMException("RM handler was not able to find WS-RM message in the payload"); // propagate RM response context to higher layers msgContext.put(RMConstant.REQUEST_CONTEXT, rmResponseContext); msgContext.setScope(RMConstant.REQUEST_CONTEXT, Scope.APPLICATION); return true; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/RMClientHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/RMClie0000644000175000017500000001414110732176562031572 0ustar godgod/* * 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.wsrm.jaxws; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.addressing.soap.SOAPAddressingProperties; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.MessageContext.Scope; import javax.xml.ws.handler.soap.SOAPMessageContext; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.RMSequence; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * Client WS-RM JAX-WS handler * * @author richard.opalka@jboss.com * * @since Dec 12, 2007 */ public final class RMClientHandler extends RMHandlerAbstractBase { private static final RMConstants rmConstants = RMProvider.get().getConstants(); protected boolean handleOutbound(MessageContext msgContext) { log.debug("handling outbound message"); CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext; SOAPAddressingProperties addrProps = (SOAPAddressingProperties)commonMsgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND); Map rmOutboundContext = (Map)commonMsgContext.get(RMConstant.REQUEST_CONTEXT); List outMsgs = (List)rmOutboundContext.get(RMConstant.PROTOCOL_MESSAGES); Map data = new HashMap(); String optionalMessageId = (addrProps.getMessageID() != null) ? addrProps.getMessageID().getURI().toString() : null; rmOutboundContext.put(RMConstant.WSA_MESSAGE_ID, optionalMessageId); rmOutboundContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data); SOAPMessage soapMessage = ((SOAPMessageContext)commonMsgContext).getMessage(); RMSequence sequenceImpl = (RMSequence)rmOutboundContext.get(RMConstant.SEQUENCE_REFERENCE); // try to serialize CreateSequence to message serialize(rmConstants.getCreateSequenceQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize Sequence to message serialize(rmConstants.getSequenceQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize AckRequested to message serialize(rmConstants.getAckRequestedQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize CloseSequence to message serialize(rmConstants.getCloseSequenceQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize TerminateSequence to message serialize(rmConstants.getTerminateSequenceQName(), outMsgs, data, soapMessage, sequenceImpl); // try to serialize SequenceAcknowledgement to message serialize(rmConstants.getSequenceAcknowledgementQName(), outMsgs, data, soapMessage, sequenceImpl); if ((outMsgs.size() != 0) && (data.size() == 0)) throw new RMException("RM handler did not serialize WS-RM message to the payload"); return true; } protected boolean handleInbound(MessageContext msgContext) { log.debug("handling inbound message"); SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage(); // initialize RM response context Map rmResponseContext = new HashMap(); List messages = new LinkedList(); rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, messages); Map data = new HashMap(); rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data); // try to read CreateSequenceResponse from message deserialize(rmConstants.getCreateSequenceResponseQName(), soapMessage, messages, data); // try to read AckRequested from message deserialize(rmConstants.getAckRequestedQName(), soapMessage, messages, data); // try to read Sequence from message deserialize(rmConstants.getSequenceQName(), soapMessage, messages, data); // try to read SequenceAcknowledgement from message deserialize(rmConstants.getSequenceAcknowledgementQName(), soapMessage, messages, data); // try to read CloseSequence from message deserialize(rmConstants.getCloseSequenceResponseQName(), soapMessage, messages, data); // try to read TerminateSequence from message deserialize(rmConstants.getTerminateSequenceResponseQName(), soapMessage, messages, data); // TODO: implement SequenceFault deserialization if (data.size() == 0) throw new RMException("RM handler was not able to find WS-RM message in the payload"); // propagate RM response context to higher layers msgContext.put(RMConstant.RESPONSE_CONTEXT, rmResponseContext); msgContext.setScope(RMConstant.RESPONSE_CONTEXT, Scope.APPLICATION); return true; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/RMHand0000644000175000017500000002124110732176562031567 0ustar godgod/* * 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.wsrm.jaxws; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import org.jboss.ws.extensions.wsrm.RMSequence; import org.jboss.ws.extensions.wsrm.common.RMHelper; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMMessageFactory; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse; /** * Handler helper * * @author richard.opalka@jboss.com * * @since Dec 13, 2007 */ public final class RMHandlerHelper { private static final RMMessageFactory rmFactory = RMProvider.get().getMessageFactory(); private static final RMConstants rmConstants = RMProvider.get().getConstants(); public static RMSerializable getMessage(QName msgQN) { if (rmConstants.getCreateSequenceQName().equals(msgQN)) { return rmFactory.newCreateSequence(); } if (rmConstants.getCreateSequenceResponseQName().equals(msgQN)) { return rmFactory.newCreateSequenceResponse(); } if (rmConstants.getCloseSequenceQName().equals(msgQN)) { return rmFactory.newCloseSequence(); } if (rmConstants.getCloseSequenceResponseQName().equals(msgQN)) { return rmFactory.newCloseSequenceResponse(); } if (rmConstants.getTerminateSequenceQName().equals(msgQN)) { return rmFactory.newTerminateSequence(); } if (rmConstants.getTerminateSequenceResponseQName().equals(msgQN)) { return rmFactory.newTerminateSequenceResponse(); } if (rmConstants.getSequenceAcknowledgementQName().equals(msgQN)) { return rmFactory.newSequenceAcknowledgement(); } if (rmConstants.getSequenceQName().equals(msgQN)) { return rmFactory.newSequence(); } if (rmConstants.getAckRequestedQName().equals(msgQN)) { return rmFactory.newAckRequested(); } throw new IllegalArgumentException(); } public static RMSerializable prepareData(QName msgQN, List outMsgs, RMSequence seq) { if (outMsgs.contains(msgQN)) { if (rmConstants.getSequenceQName().equals(msgQN)) { return newSequence(seq); } if (rmConstants.getSequenceAcknowledgementQName().equals(msgQN)) { return newSequenceAcknowledgement(seq); } if (rmConstants.getTerminateSequenceQName().equals(msgQN)) { return newTerminateSequence(seq); } if (rmConstants.getTerminateSequenceResponseQName().equals(msgQN)) { return newTerminateSequenceResponse(seq); } if (rmConstants.getCloseSequenceQName().equals(msgQN)) { return newCloseSequence(seq); } if (rmConstants.getCloseSequenceResponseQName().equals(msgQN)) { return newCloseSequenceResponse(seq); } if (rmConstants.getAckRequestedQName().equals(msgQN)) { return newAckRequested(seq); } if (rmConstants.getCreateSequenceQName().equals(msgQN)) { return newCreateSequence(seq); } if (rmConstants.getCreateSequenceResponseQName().equals(msgQN)) { return newCreateSequenceResponse(seq); } throw new IllegalArgumentException(msgQN.toString()); } return null; } private static RMSerializable newCreateSequence(RMSequence seq) { RMCreateSequence createSequence = rmFactory.newCreateSequence(); createSequence.setAcksTo(seq.getAcksTo()); return createSequence; } private static RMSerializable newCreateSequenceResponse(RMSequence seq) { RMCreateSequenceResponse createSequenceResponse = rmFactory.newCreateSequenceResponse(); createSequenceResponse.setIdentifier(seq.getInboundId()); createSequenceResponse.setExpires(RMHelper.longToDuration(seq.getDuration())); return createSequenceResponse; } private static RMSerializable newCloseSequenceResponse(RMSequence seq) { // construct CloseSequenceResponse object RMCloseSequenceResponse closeSequenceResponse = rmFactory.newCloseSequenceResponse(); closeSequenceResponse.setIdentifier(seq.getInboundId()); return closeSequenceResponse; } private static RMSerializable newCloseSequence(RMSequence seq) { // construct CloseSequenceResponse object RMCloseSequence closeSequence = rmFactory.newCloseSequence(); closeSequence.setIdentifier(seq.getOutboundId()); if (seq.getLastMessageNumber() > 0) { closeSequence.setLastMsgNumber(seq.getLastMessageNumber()); } return closeSequence; } private static RMSerializable newTerminateSequence(RMSequence seq) { // construct CloseSequenceResponse object RMTerminateSequence terminateSequence = rmFactory.newTerminateSequence(); terminateSequence.setIdentifier(seq.getOutboundId()); if (seq.getLastMessageNumber() > 0) { terminateSequence.setLastMsgNumber(seq.getLastMessageNumber()); } return terminateSequence; } private static RMSerializable newTerminateSequenceResponse(RMSequence seq) { // construct TerminateSequenceResponse object RMTerminateSequenceResponse terminateSequenceResponse = rmFactory.newTerminateSequenceResponse(); terminateSequenceResponse.setIdentifier(seq.getInboundId()); return terminateSequenceResponse; } private static RMSerializable newSequenceAcknowledgement(RMSequence seq) { // construct SequenceAcknowledgement object RMSequenceAcknowledgement sequenceAcknowledgement = rmFactory.newSequenceAcknowledgement(); sequenceAcknowledgement.setIdentifier(seq.getInboundId()); Iterator receivedMessages = seq.getReceivedInboundMessages().iterator(); if (false == receivedMessages.hasNext()) { sequenceAcknowledgement.setNone(); } else { while (receivedMessages.hasNext()) { long messageNo = receivedMessages.next(); RMSequenceAcknowledgement.RMAcknowledgementRange range = sequenceAcknowledgement.newAcknowledgementRange(); range.setLower(messageNo); range.setUpper(messageNo); sequenceAcknowledgement.addAcknowledgementRange(range); } } return sequenceAcknowledgement; } private static RMSerializable newAckRequested(RMSequence seq) { // construct AckRequested object RMAckRequested wsrmMsg = rmFactory.newAckRequested(); wsrmMsg.setIdentifier(seq.getOutboundId()); wsrmMsg.setMessageNumber(seq.getLastMessageNumber()); return wsrmMsg; } private static RMSerializable newSequence(RMSequence seq) { // construct Sequence object org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence sequence = rmFactory.newSequence(); sequence.setIdentifier(seq.getOutboundId()); sequence.setMessageNumber(seq.newMessageNumber()); return sequence; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/jaxws/RMHand0000644000175000017500000000540110747701205031561 0ustar godgod/* * 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.wsrm.jaxws; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.SOAPMessage; import org.jboss.logging.Logger; import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.RMSequence; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; /** * RM generic JAX-WS handler * * @author richard.opalka@jboss.com * * @since Oct 23, 2007 */ public abstract class RMHandlerAbstractBase extends GenericSOAPHandler { protected final Logger log = Logger.getLogger(getClass()); public final Set getHeaders() { return RMConstant.PROTOCOL_OPERATION_QNAMES; } protected final void serialize(QName msgQN, List outMsgs, Map data, SOAPMessage soapMessage, RMSequence seq) { RMSerializable msg = RMHandlerHelper.prepareData(msgQN, outMsgs, seq); if (msg != null) { msg.serializeTo(soapMessage); data.put(msgQN, msg); log.debug(msgQN.getLocalPart() + " WSRM message was serialized to payload"); } } protected final void deserialize(QName msgQN, SOAPMessage soapMessage, List messages, Map data) { try { RMSerializable wsrmMsg = RMHandlerHelper.getMessage(msgQN); if (wsrmMsg != null) { wsrmMsg.deserializeFrom(soapMessage); messages.add(msgQN); data.put(msgQN, wsrmMsg); log.debug(msgQN.getLocalPart() + " WSRM message was deserialized from payload"); } } catch (RMException ignore) {} } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/0000755000175000017500000000000010755000257031423 5ustar godgod././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMChannelResponse.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000444110726223250031665 0ustar godgod/* * 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.wsrm.transport; import org.jboss.ws.extensions.wsrm.transport.backchannel.RMCallbackHandler; /** * RM channel response represents response that goes from the RM channel * * @author richard.opalka@jboss.com */ final class RMChannelResponse { private final Throwable fault; private final RMMessage result; private final RMCallbackHandler callback; private final String messageId; // WS-Addressing: MessageID public RMChannelResponse(RMCallbackHandler callback, String messageId) { this(null, null, callback, messageId); } public RMChannelResponse(Throwable fault) { this(null, fault, null, null); } public RMChannelResponse(RMMessage result) { this(result, null, null, null); } private RMChannelResponse(RMMessage result, Throwable fault, RMCallbackHandler callback, String messageId) { super(); this.result = result; this.fault = fault; this.callback = callback; this.messageId = messageId; } public Throwable getFault() { return (this.callback != null) ? this.callback.getFault(this.messageId) : this.fault; } public RMMessage getResponse() { return (this.callback != null) ? this.callback.getMessage(this.messageId) : this.result; } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMMessageImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000106110726223250031660 0ustar godgodpackage org.jboss.ws.extensions.wsrm.transport; /** * RM source instance * * @author richard.opalka@jboss.com */ public class RMMessageImpl implements RMMessage { private final byte[] payload; private final RMMetadata rmMetadata; public RMMessageImpl(byte[] payload, RMMetadata rmMetadata) { super(); this.payload = payload; this.rmMetadata = rmMetadata; } public byte[] getPayload() { return this.payload; } public RMMetadata getMetadata() { return this.rmMetadata; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMMetadata.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000504210730511517031664 0ustar godgodpackage org.jboss.ws.extensions.wsrm.transport; import java.util.Map; import java.util.HashMap; import org.jboss.remoting.marshal.Marshaller; import org.jboss.remoting.marshal.UnMarshaller; /** * RM metadata heavily used by this RM transport * * @author richard.opalka@jboss.com */ public final class RMMetadata { private Map> contexts = new HashMap>(); public RMMetadata( String remotingVersion, String targetAddress, Marshaller marshaller, UnMarshaller unmarshaller, Map invocationContext, Map remotingInvocationContext, Map remotingConfigurationContext) { if (targetAddress == null) throw new IllegalArgumentException("Target address cannot be null"); invocationContext.put(RMChannelConstants.TARGET_ADDRESS, targetAddress); invocationContext.put(RMChannelConstants.REMOTING_VERSION, remotingVersion); setContext(RMChannelConstants.INVOCATION_CONTEXT, invocationContext); if (marshaller == null || unmarshaller == null) throw new IllegalArgumentException("Unable to create de/serialization context"); Map serializationContext = new HashMap(); serializationContext.put(RMChannelConstants.MARSHALLER, marshaller); serializationContext.put(RMChannelConstants.UNMARSHALLER, unmarshaller); setContext(RMChannelConstants.SERIALIZATION_CONTEXT, serializationContext); if (remotingInvocationContext == null) throw new IllegalArgumentException("Remoting invocation context cannot be null"); setContext(RMChannelConstants.REMOTING_INVOCATION_CONTEXT, remotingInvocationContext); if (remotingConfigurationContext == null) throw new IllegalArgumentException("Remoting configuraton context cannot be null"); setContext(RMChannelConstants.REMOTING_CONFIGURATION_CONTEXT, remotingConfigurationContext); } public RMMetadata(Map remotingInvocationContext) { if (remotingInvocationContext == null) throw new IllegalArgumentException("Remoting invocation context cannot be null"); setContext(RMChannelConstants.REMOTING_INVOCATION_CONTEXT, remotingInvocationContext); } void setContext(String key, Map ctx) { this.contexts.put(key, ctx); } Map getContext(String key) { return this.contexts.get(key); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMSender.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000001527310730511517031673 0ustar godgod/* * 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.wsrm.transport; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.http.HttpServletResponse; import org.jboss.logging.Logger; import org.jboss.remoting.transport.http.HTTPMetadataConstants; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.config.RMMessageRetransmissionConfig; /** * RM sender ensures reliable message delivery. The QoS is specified in the JAX-WS client Sconfiguration file. * * @author richard.opalka@jboss.com */ public final class RMSender { private static final Logger logger = Logger.getLogger(RMSender.class); private static RMSender instance = new RMSender(); private static final ThreadFactory rmThreadPool = new RMThreadPoolFactory(); private static final int maxCountOfThreads = 5; private static final ExecutorService rmTasksQueue = Executors.newFixedThreadPool(maxCountOfThreads, rmThreadPool); /** * Generates worker threads (daemons) */ private static final class RMThreadPoolFactory implements ThreadFactory { final ThreadGroup group; final AtomicInteger threadNumber = new AtomicInteger(1); final String namePrefix = "rm-pool-worker-thread-"; private RMThreadPoolFactory() { SecurityManager sm = System.getSecurityManager(); group = (sm != null) ? sm.getThreadGroup() : Thread.currentThread().getThreadGroup(); } public Thread newThread(Runnable r) { Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0); if (false == t.isDaemon()) t.setDaemon(true); if (Thread.NORM_PRIORITY != t.getPriority()) t.setPriority(Thread.NORM_PRIORITY); return t; } } private RMSender() { // forbidden inheritance } public static final RMSender getInstance() { return instance; } public final RMMessage send(RMMessage request) throws Throwable { RMMessageRetransmissionConfig qos = RMTransportHelper.getSequence(request).getRMConfig().getMessageRetransmission(); if (qos == null) throw new RMException("User must specify message retransmission configuration in JAX-WS WS-RM config"); int countOfAttempts = qos.getCountOfAttempts(); int inactivityTimeout = qos.getMessageTimeout(); int retransmissionInterval = qos.getRetransmissionInterval(); RMChannelResponse result = null; long startTime = 0L; long endTime = 0L; int attemptNumber = 1; for (int i = 0; i < countOfAttempts; i++) { logger.debug("Sending RM request - attempt no. " + attemptNumber++); Future futureResult = rmTasksQueue.submit(new RMChannelTask(request)); try { startTime = System.currentTimeMillis(); result = futureResult.get(inactivityTimeout, TimeUnit.SECONDS); if (result != null) { Throwable t = result.getFault(); if (t != null) { logger.warn(result.getFault().getClass().getName(), result.getFault()); } else { endTime = System.currentTimeMillis(); if (result.getResponse() != null) { Map remotingCtx = result.getResponse().getMetadata().getContext(RMChannelConstants.REMOTING_INVOCATION_CONTEXT); if (remotingCtx != null) { if (Integer.valueOf(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).equals(remotingCtx.get(HTTPMetadataConstants.RESPONSE_CODE))) { logger.debug("Response message received in " + (endTime - startTime) + " miliseconds, but contains internal server code, going to resend the request message"); continue; } } } logger.debug("Response message received in " + (endTime - startTime) + " miliseconds"); break; } try { Thread.sleep(retransmissionInterval * 1000); } catch (InterruptedException ie) { logger.warn(ie.getMessage(), ie); } } } catch (TimeoutException te) { endTime = System.currentTimeMillis(); logger.warn("Timeout - response message not received in " + (endTime - startTime) + " miliseconds"); try { Thread.sleep(retransmissionInterval * 1000); } catch (InterruptedException ie) { logger.warn(ie.getMessage(), ie); } } } if (result == null) throw new RMException("Unable to deliver message with addressing id: " + RMTransportHelper.getAddressingMessageId(request) + ". Count of attempts to deliver the message was: " + countOfAttempts); Throwable fault = result.getFault(); if (fault != null) { throw new RMException("Unable to deliver message with addressing id: " + RMTransportHelper.getAddressingMessageId(request) + ". Count of attempts to deliver the message was: " + countOfAttempts, fault); } else { return result.getResponse(); } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMMessage.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000031410726223250031660 0ustar godgodpackage org.jboss.ws.extensions.wsrm.transport; /** * Represents RM source * * @author richard.opalka@jboss.com */ public interface RMMessage { byte[] getPayload(); RMMetadata getMetadata(); } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMMessageAssembler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000701310730511517031664 0ustar godgod/* * 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.wsrm.transport; import static org.jboss.ws.extensions.wsrm.transport.RMChannelConstants.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.Map; import org.jboss.remoting.marshal.Marshaller; import org.jboss.remoting.marshal.UnMarshaller; import org.jboss.ws.core.MessageAbstraction; /** * Translates JBoss messages to RM sources and vice-versa. * It's necessary to translate JBoss messages to/from RM * sources before submiting them to the RMSender. * *

      * This is because of the following reasons: *

        *
      • contextClassloader not serializable issue
      • *
      • DOMUtil threadlocal issue (if message is de/serialized in separate thread)
      • *
      *

      * * @author richard.opalka@jboss.com */ public final class RMMessageAssembler { /** * Transforms JBoss request message to the RM request message * This transformation is done before submiting request to the RMSender. */ public static RMMessage convertMessageToRMSource(MessageAbstraction request, RMMetadata rmMetadata) throws Throwable { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Marshaller marshaller = (Marshaller)rmMetadata.getContext(SERIALIZATION_CONTEXT).get(MARSHALLER); marshaller.write(request, baos); RMMessage rmMessage = RMMessageFactory.newMessage(baos.toByteArray(), rmMetadata); return rmMessage; } /** * Transforms RM response message to the JBoss response message. * This transformation is done after RMSender have finished his job. */ public static MessageAbstraction convertRMSourceToMessage(RMMessage rmRequest, RMMessage rmResponse, RMMetadata rmMetadata) throws Throwable { boolean oneWay = RMTransportHelper.isOneWayOperation(rmRequest); MessageAbstraction response = null; if (false == oneWay) { byte[] payload = rmResponse.getPayload(); InputStream in = (payload == null) ? null : new ByteArrayInputStream(rmResponse.getPayload()); UnMarshaller unmarshaller = (UnMarshaller)rmMetadata.getContext(SERIALIZATION_CONTEXT).get(UNMARSHALLER); response = (MessageAbstraction)unmarshaller.read(in, rmResponse.getMetadata().getContext(REMOTING_INVOCATION_CONTEXT)); } Map invocationContext = rmMetadata.getContext(INVOCATION_CONTEXT); invocationContext.clear(); invocationContext.putAll(rmMetadata.getContext(REMOTING_INVOCATION_CONTEXT)); return response; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/backchannel/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/ba0000755000175000017500000000000010755000257031726 5ustar godgod././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsInvocationHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/ba0000644000175000017500000001015310723247145031734 0ustar godgod/* * 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.wsrm.transport.backchannel; import java.util.LinkedList; import java.util.List; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javax.management.MBeanServer; import org.jboss.logging.Logger; import org.jboss.remoting.InvocationRequest; import org.jboss.remoting.ServerInvocationHandler; import org.jboss.remoting.ServerInvoker; import org.jboss.remoting.callback.InvokerCallbackHandler; import org.jboss.remoting.transport.coyote.RequestMap; import org.jboss.remoting.transport.http.HTTPMetadataConstants; /** * TODO: Add comment * * @author richard.opalka@jboss.com * * @since Nov 20, 2007 */ public final class RMBackPortsInvocationHandler implements ServerInvocationHandler { private static final Logger LOG = Logger.getLogger(RMBackPortsInvocationHandler.class); private final List callbacks = new LinkedList(); private final Lock lock = new ReentrantLock(); public RMBackPortsInvocationHandler() { } public RMCallbackHandler getCallback(String requestPath) { this.lock.lock(); try { for (RMCallbackHandler handler : this.callbacks) { if (handler.getHandledPath().equals(requestPath)) return handler; } } finally { this.lock.unlock(); } return null; } public void registerCallback(RMCallbackHandler callbackHandler) { this.lock.lock(); try { this.callbacks.add(callbackHandler); } finally { this.lock.unlock(); } } public void unregisterCallback(RMCallbackHandler callbackHandler) { this.lock.lock(); try { this.callbacks.remove(callbackHandler); } finally { this.lock.unlock(); } } public Object invoke(InvocationRequest request) throws Throwable { this.lock.lock(); try { RequestMap rm = (RequestMap)request.getRequestPayload(); String requestPath = (String)rm.get(HTTPMetadataConstants.PATH); boolean handlerExists = false; for (RMCallbackHandler handler : this.callbacks) { if (handler.getHandledPath().equals(requestPath)) { handlerExists = true; LOG.debug("Handling request path: " + requestPath); handler.handle(request); break; } } if (handlerExists == false) LOG.warn("No callback handler registered for path: " + requestPath); return null; } finally { this.lock.unlock(); } } public void addListener(InvokerCallbackHandler callbackHandler) { // do nothing - we're using custom callback handlers } public void removeListener(InvokerCallbackHandler callbackHandler) { // do nothing - we're using custom callback handlers } public void setInvoker(ServerInvoker arg0) { // do nothing } public void setMBeanServer(MBeanServer arg0) { // do nothing } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/ba0000644000175000017500000000415010723247145031734 0ustar godgod/* * 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.wsrm.transport.backchannel; import java.net.URI; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** * Callback factory * * @author richard.opalka@jboss.com * * @since Nov 21, 2007 */ public final class RMCallbackHandlerFactory { private static RMBackPortsServer server; private static Lock lock = new ReentrantLock(); private RMCallbackHandlerFactory() { // no instances } public static RMCallbackHandler getCallbackHandler(URI backPort) { lock.lock(); try { if (server == null) { server = RMBackPortsServer.getInstance(backPort.getScheme(), backPort.getHost(), backPort.getPort()); } RMCallbackHandler callbackHandler = server.getCallback(backPort.getPath()); if (callbackHandler == null) { callbackHandler = new RMCallbackHandlerImpl(backPort.getPath()); server.registerCallback(callbackHandler); } return callbackHandler; } finally { lock.unlock(); } } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/ba0000644000175000017500000000312110723247145031731 0ustar godgod/* * 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.wsrm.transport.backchannel; import org.jboss.remoting.InvocationRequest; import org.jboss.ws.extensions.wsrm.transport.RMMessage; import org.jboss.ws.extensions.wsrm.transport.RMUnassignedMessageListener; /** * TODO: Add comment * * @author richard.opalka@jboss.com * * @since Nov 21, 2007 */ public interface RMCallbackHandler { String getHandledPath(); void handle(InvocationRequest payload); RMMessage getMessage(String messageId); Throwable getFault(String messageId); void addUnassignedMessageListener(RMUnassignedMessageListener listener); } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/ba0000644000175000017500000001065310731765412031742 0ustar godgod/* * 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.wsrm.transport.backchannel; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.jboss.logging.Logger; import org.jboss.remoting.InvocationRequest; import org.jboss.remoting.transport.coyote.RequestMap; import org.jboss.ws.core.MessageTrace; import org.jboss.ws.extensions.wsrm.transport.RMMessage; import org.jboss.ws.extensions.wsrm.transport.RMUnassignedMessageListener; /** * Reliable messaging callback handler listens for incomming requests on specified path * * @author richard.opalka@jboss.com * * @since Nov 21, 2007 */ public final class RMCallbackHandlerImpl implements RMCallbackHandler { private static final Logger logger = Logger.getLogger(RMCallbackHandlerImpl.class); private final String handledPath; private final Object instanceLock = new Object(); private Map arrivedMessages = new HashMap(); private List arrivedUnassignedMessages = new LinkedList(); private RMUnassignedMessageListener listener; /** * Request path to listen for incomming messages * @param handledPath */ public RMCallbackHandlerImpl(String handledPath) { super(); this.handledPath = handledPath; logger.debug("Registered callback handler listening on '" + handledPath + "' request path"); } public Throwable getFault(String messageId) { // TODO implement return null; } public final String getHandledPath() { return this.handledPath; } public final void handle(InvocationRequest request) { RMMessage message = (RMMessage)request.getParameter(); synchronized (instanceLock) { String requestMessage = new String(message.getPayload()); MessageTrace.traceMessage("Incoming RM Response Message (callback)", requestMessage); String startPattern = ""; // TODO: remove this with XML content inspection String endPattern = ""; int begin = requestMessage.indexOf(startPattern) + startPattern.length(); int end = requestMessage.indexOf(endPattern); if (begin != -1) { String messageId = requestMessage.substring(begin, end); logger.debug("Arrived message id: " + messageId); this.arrivedMessages.put(messageId, message); } else { logger.debug("Arrived message has no id"); this.arrivedUnassignedMessages.add(message); if (this.listener != null) { this.listener.unassignedMessageReceived(); } } } } public void addUnassignedMessageListener(RMUnassignedMessageListener listener) { synchronized (instanceLock) { if (this.listener == null) { this.listener = listener; } } } public RMMessage getMessage(String messageId) { synchronized (instanceLock) { while (this.arrivedMessages.get(messageId) == null) { try { logger.debug("waiting for response with message id: " + messageId); instanceLock.wait(100); } catch (InterruptedException ie) { logger.warn(ie.getMessage(), ie); } } return this.arrivedMessages.get(messageId); } } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/backchannel/RMBackPortsServer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/ba0000644000175000017500000001502110731765412031734 0ustar godgod/* * 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.wsrm.transport.backchannel; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import org.jboss.logging.Logger; import org.jboss.remoting.InvokerLocator; import org.jboss.remoting.transport.Connector; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.transport.RMMarshaller; import org.jboss.ws.extensions.wsrm.transport.RMUnMarshaller; /** * Back ports server used by addressable clients * * @author richard.opalka@jboss.com * * @since Nov 20, 2007 */ public final class RMBackPortsServer implements Runnable { private static final Logger LOG = Logger.getLogger(RMBackPortsServer.class); private static final Lock CLASS_LOCK = new ReentrantLock(); private static final long WAIT_PERIOD = 100; private static RMBackPortsServer INSTANCE; private final Object instanceLock = new Object(); private final Connector connector; private final String scheme; private final String host; private final int port; private RMBackPortsInvocationHandler handler; private boolean started; private boolean stopped; private boolean terminated; public final void registerCallback(RMCallbackHandler callbackHandler) { this.handler.registerCallback(callbackHandler); } public final void unregisterCallback(RMCallbackHandler callbackHandler) { this.handler.unregisterCallback(callbackHandler); } public final RMCallbackHandler getCallback(String requestPath) { return this.handler.getCallback(requestPath); } private RMBackPortsServer(String scheme, String host, int port) throws RMException { super(); this.scheme = scheme; this.host = host; this.port = port; try { // we have to use custom unmarshaller because default one removes CRNLs String customUnmarshaller = "/?unmarshaller=" + RMUnMarshaller.class.getName(); InvokerLocator il = new InvokerLocator(this.scheme + "://" + this.host + ":" + this.port + customUnmarshaller); this.connector = new Connector(); this.connector.setInvokerLocator(il.getLocatorURI()); this.connector.create(); this.handler = new RMBackPortsInvocationHandler(); this.connector.addInvocationHandler("wsrmBackPortsHandler", this.handler); this.connector.start(); LOG.debug("WS-RM Backports Server started on: " + il.getLocatorURI()); } catch (Exception e) { LOG.warn(e.getMessage(), e); throw new RMException(e.getMessage(), e); } } public final String getScheme() { return this.scheme; } public final String getHost() { return this.host; } public final int getPort() { return this.port; } public final void run() { synchronized (this.instanceLock) { if (this.started) return; this.started = true; while (this.stopped == false) { try { this.instanceLock.wait(WAIT_PERIOD); LOG.debug("serving requests"); } catch (InterruptedException ie) { LOG.warn(ie.getMessage(), ie); } } try { connector.stop(); } finally { LOG.debug("terminated"); this.terminated = true; } } } public final void terminate() { synchronized (this.instanceLock) { if (this.stopped == true) return; this.stopped = true; LOG.debug("termination forced"); while (this.terminated == false) { try { LOG.debug("waiting for termination"); this.instanceLock.wait(WAIT_PERIOD); } catch (InterruptedException ie) { LOG.warn(ie.getMessage(), ie); } } } } /** * Starts back ports server on the background if method is called for the first time * @param scheme protocol * @param host hostname * @param port port * @return WS-RM back ports server * @throws RMException */ public static RMBackPortsServer getInstance(String scheme, String host, int port) throws RMException { CLASS_LOCK.lock(); try { if (INSTANCE == null) { INSTANCE = new RMBackPortsServer(scheme, host, (port == -1) ? 80 : port); // forking back ports server Thread t = new Thread(INSTANCE, "RMBackPortsServer"); t.setDaemon(true); t.start(); // registering shutdown hook final RMBackPortsServer server = INSTANCE; Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { public void run() { server.terminate(); } }, "RMBackPortsServerShutdownHook")); } else { boolean schemeEquals = INSTANCE.getScheme().equals(scheme); boolean hostEquals = INSTANCE.getHost().equals(host); boolean portEquals = INSTANCE.getPort() == ((port == -1) ? 80 : port); if ((schemeEquals == false) || (hostEquals == false) || (portEquals == false)) throw new IllegalArgumentException(); } return INSTANCE; } finally { CLASS_LOCK.unlock(); } } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMChannelConstants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000350510730511517031666 0ustar godgod/* * 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.wsrm.transport; /** * RM transport constants * * @author richard.opalka@jboss.com * * @since Dec 14, 2007 */ public class RMChannelConstants { public static final String TARGET_ADDRESS = "targetAddress"; public static final String REMOTING_VERSION = "remotingVersion"; public static final String INVOCATION_CONTEXT = "invocationContext"; public static final String MARSHALLER = "marshaller"; public static final String UNMARSHALLER = "unmarshaller"; public static final String SERIALIZATION_CONTEXT = "serializationContext"; public static final String REMOTING_INVOCATION_CONTEXT = "remotingInvocationContext"; public static final String REMOTING_CONFIGURATION_CONTEXT = "remotingConfigurationContext"; private RMChannelConstants() { // instances not allowed } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMMarshaller.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000424610731765412031677 0ustar godgod/* * 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.wsrm.transport; import java.io.IOException; import java.io.OutputStream; import org.jboss.remoting.InvocationRequest; import org.jboss.remoting.invocation.OnewayInvocation; import org.jboss.remoting.marshal.Marshaller; /** * Marshalls byte array to the output stream * * @author richard.opalka@jboss.com */ public final class RMMarshaller implements Marshaller { private static final Marshaller instance = new RMMarshaller(); public Marshaller cloneMarshaller() throws CloneNotSupportedException { return getInstance(); } public static Marshaller getInstance() { return instance; } public void write(Object dataObject, OutputStream output) throws IOException { if (dataObject instanceof InvocationRequest) dataObject = ((InvocationRequest)dataObject).getParameter(); if (dataObject instanceof OnewayInvocation) dataObject = ((OnewayInvocation)dataObject).getParameters()[0]; if ((dataObject instanceof byte[]) == false) throw new IllegalArgumentException("Not a byte array: " + dataObject); output.write((byte[])dataObject); output.flush(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMChannel.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000342210726223250031663 0ustar godgod/* * 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.wsrm.transport; import org.jboss.ws.core.MessageAbstraction; /** * RM Channel implements reliable transport * * @author richard.opalka@jboss.com */ public class RMChannel { private static final RMChannel instance = new RMChannel(); private RMChannel() { // forbidden inheritance } public static RMChannel getInstance() { return instance; } public MessageAbstraction send(MessageAbstraction request, RMMetadata rmMetadata) throws Throwable { RMMessage rmRequest = RMMessageAssembler.convertMessageToRMSource(request, rmMetadata); RMMessage rmResponse = RMSender.getInstance().send(rmRequest); return RMMessageAssembler.convertRMSourceToMessage(rmRequest, rmResponse, rmMetadata); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMUnMarshaller.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000451110731765412031672 0ustar godgod/* * 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.wsrm.transport; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Map; import org.jboss.remoting.marshal.UnMarshaller; /** * Unmarshalls byte array from the input stream * * @author richard.opalka@jboss.com */ public final class RMUnMarshaller implements UnMarshaller { private static final UnMarshaller instance = new RMUnMarshaller(); public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException { return getInstance(); } public static UnMarshaller getInstance() { return instance; } public Object read(InputStream is, Map metadata) throws IOException, ClassNotFoundException { if (is == null) return RMMessageFactory.newMessage(null, new RMMetadata(metadata)); // TODO: investigate why is == null (WSAddressing reply-to test) ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int count = -1; count = is.read(buffer); while (count != -1) { baos.write(buffer, 0, count); count = is.read(buffer); } return RMMessageFactory.newMessage(baos.toByteArray(), new RMMetadata(metadata)); } public void setClassLoader(ClassLoader classloader) { // do nothing } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000001246110730511517031667 0ustar godgod/* * 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.wsrm.transport; import java.io.IOException; import java.net.URI; import java.util.Map; import java.util.concurrent.Callable; import org.jboss.logging.Logger; import org.jboss.remoting.Client; import org.jboss.remoting.InvokerLocator; import org.jboss.remoting.marshal.MarshalFactory; import org.jboss.ws.core.MessageTrace; import org.jboss.ws.extensions.wsrm.RMClientSequence; import org.jboss.ws.extensions.wsrm.transport.backchannel.RMCallbackHandler; import org.jboss.ws.extensions.wsrm.transport.backchannel.RMCallbackHandlerFactory; /** * RM channel task to be executed * * @author richard.opalka@jboss.com */ final class RMChannelTask implements Callable { private static final Logger logger = Logger.getLogger(RMChannelTask.class); private static final String JBOSSWS_SUBSYSTEM = "jbossws-wsrm"; private final RMMessage rmRequest; RMChannelTask(RMMessage rmRequest) { super(); this.rmRequest = rmRequest; } public RMChannelResponse call() { try { String targetAddress = (String)rmRequest.getMetadata().getContext(RMChannelConstants.INVOCATION_CONTEXT).get(RMChannelConstants.TARGET_ADDRESS); String version = (String)rmRequest.getMetadata().getContext(RMChannelConstants.INVOCATION_CONTEXT).get(RMChannelConstants.REMOTING_VERSION); if (version.startsWith("1.4")) { MarshalFactory.addMarshaller("JBossWSMessage", RMMarshaller.getInstance(), RMUnMarshaller.getInstance()); } InvokerLocator locator = new InvokerLocator(targetAddress); URI backPort = RMTransportHelper.getBackPortURI(rmRequest); String messageId = RMTransportHelper.getAddressingMessageId(rmRequest); logger.debug("[WS-RM] backport URI is: " + backPort); RMCallbackHandler callbackHandler = null; if (backPort != null) { callbackHandler = RMCallbackHandlerFactory.getCallbackHandler(backPort); RMClientSequence sequence = RMTransportHelper.getSequence(rmRequest); if (sequence != null) { callbackHandler.addUnassignedMessageListener(sequence); } } boolean oneWay = RMTransportHelper.isOneWayOperation(rmRequest); Client client = new Client(locator, JBOSSWS_SUBSYSTEM, rmRequest.getMetadata().getContext(RMChannelConstants.REMOTING_CONFIGURATION_CONTEXT)); client.connect(); client.setMarshaller(RMMarshaller.getInstance()); if ((false == oneWay) && (null == backPort)) client.setUnMarshaller(RMUnMarshaller.getInstance()); Map remotingInvocationContext = rmRequest.getMetadata().getContext(RMChannelConstants.REMOTING_INVOCATION_CONTEXT); // debug the outgoing request message MessageTrace.traceMessage("Outgoing RM Request Message", rmRequest.getPayload()); RMMessage rmResponse = null; if (oneWay && (null == backPort)) { client.invokeOneway(rmRequest.getPayload(), remotingInvocationContext, false); } else { Object retVal = client.invoke(rmRequest.getPayload(), remotingInvocationContext); if ((null != retVal) && (false == (retVal instanceof RMMessage))) { String msg = retVal.getClass().getName() + ": '" + retVal + "'"; logger.warn(msg); throw new IOException(msg); } rmResponse = (RMMessage)retVal; } // Disconnect the remoting client client.disconnect(); // trace the incomming response message if ((rmResponse != null) && (backPort == null)) MessageTrace.traceMessage("Incoming RM Response Message", rmResponse.getPayload()); if (backPort != null) // TODO: backport support { if ((null != messageId) && (false == RMTransportHelper.isOneWayOperation(rmRequest))) { // register callbacks only for outbound messages with messageId return new RMChannelResponse(callbackHandler, messageId); } } return new RMChannelResponse(rmResponse); } catch (Throwable t) { return new RMChannelResponse(t); } } }././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMUnassignedMessageListener.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000255310726223250031667 0ustar godgod/* * 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.wsrm.transport; /** * Implementations of this interface must be registered in callback handler * * @author richard.opalka@jboss.com */ public interface RMUnassignedMessageListener { /** * This event is fired when there's new unassigned message available in callback handler. */ void unassignedMessageReceived(); } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMMessageFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000060410726223250031662 0ustar godgodpackage org.jboss.ws.extensions.wsrm.transport; /** * Constructs RM message instances * * @author richard.opalka@jboss.com */ public class RMMessageFactory { private RMMessageFactory() { // forbidden inheritance } public static RMMessage newMessage(byte[] payload, RMMetadata rmMetadata) { return new RMMessageImpl(payload, rmMetadata); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RMTransportHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/transport/RM0000644000175000017500000000411210730511517031661 0ustar godgodpackage org.jboss.ws.extensions.wsrm.transport; import static org.jboss.ws.extensions.wsrm.RMConstant.*; import java.net.URI; import java.util.Map; import org.jboss.logging.Logger; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.RMClientSequence; /** * Utility class heavily used in this transport implementation * * @author richard.opalka@jboss.com */ public final class RMTransportHelper { private static Logger logger = Logger.getLogger(RMTransportHelper.class); private RMTransportHelper() { // no instances } public static boolean isRMMessage(Map ctx) { return (ctx != null) && (ctx.containsKey(RMConstant.REQUEST_CONTEXT)); } public static String getAddressingMessageId(RMMessage rmRequest) { return (String)getWsrmRequestContext(rmRequest).get(WSA_MESSAGE_ID); } public static URI getBackPortURI(RMMessage rmRequest) { return getSequence(rmRequest).getBackPort(); } private static Map getWsrmRequestContext(RMMessage rmRequest) { Map invocationCtx = (Map)rmRequest.getMetadata().getContext(RMChannelConstants.INVOCATION_CONTEXT); return (Map)invocationCtx.get(REQUEST_CONTEXT); } public static RMClientSequence getSequence(RMMessage rmRequest) { return (RMClientSequence)getWsrmRequestContext(rmRequest).get(SEQUENCE_REFERENCE); } public static boolean isOneWayOperation(RMMessage rmRequest) { RMMetadata meta = rmRequest.getMetadata(); if (meta == null) throw new RuntimeException("Unable to obtain wsrm metadata"); Map invCtx = meta.getContext(RMChannelConstants.INVOCATION_CONTEXT); if (invCtx == null) throw new RuntimeException("Unable to obtain invocation context"); Map wsrmReqCtx = (Map)invCtx.get(RMConstant.REQUEST_CONTEXT); Boolean isOneWay = (Boolean)wsrmReqCtx.get(ONE_WAY_OPERATION); return isOneWay == null ? false : isOneWay.booleanValue(); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMClientSequence.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMClientSequ0000644000175000017500000002727510750144631031642 0ustar godgod/* * 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.wsrm; import java.net.InetAddress; import java.net.URI; import java.net.URISyntaxException; import java.net.UnknownHostException; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.JAXWSAConstants; import org.jboss.logging.Logger; import org.jboss.ws.core.jaxws.client.ClientImpl; import org.jboss.ws.core.utils.UUIDGenerator; import org.jboss.ws.extensions.addressing.AddressingClientUtil; import org.jboss.ws.extensions.wsrm.config.RMConfig; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMIncompleteSequenceBehavior; import org.jboss.ws.extensions.wsrm.transport.RMUnassignedMessageListener; /** * Client side implementation of the RM sequence * * @author richard.opalka@jboss.com * * @since Oct 25, 2007 */ @SuppressWarnings("unchecked") public final class RMClientSequence implements RMSequence, RMUnassignedMessageListener { private static final Logger logger = Logger.getLogger(RMClientSequence.class); private static final String PATH_PREFIX = "/temporary_listen_address/"; private static final RMConstants wsrmConstants = RMProvider.get().getConstants(); private final RMConfig wsrmConfig; private final boolean addressableClient; private final Set acknowledgedOutboundMessages = new TreeSet(); private final Set receivedInboundMessages = new TreeSet(); private RMIncompleteSequenceBehavior behavior = RMIncompleteSequenceBehavior.NO_DISCARD; private String incomingSequenceId; private String outgoingSequenceId; private long duration = -1; private long creationTime; private URI backPort; private ClientImpl client; private boolean isFinal; private AtomicBoolean inboundMessageAckRequested = new AtomicBoolean(); private AtomicLong messageNumber = new AtomicLong(); private AtomicInteger countOfUnassignedMessagesAvailable = new AtomicInteger(); private static final String ANONYMOUS_URI = AddressingBuilder.getAddressingBuilder().newAddressingConstants().getAnonymousURI(); public RMClientSequence(RMConfig wsrmConfig) { super(); if (wsrmConfig == null) throw new RMException("WS-RM configuration missing"); this.wsrmConfig = wsrmConfig; this.addressableClient = wsrmConfig.getBackPortsServer() != null; if (this.addressableClient) { try { String host = wsrmConfig.getBackPortsServer().getHost(); if (host == null) { host = InetAddress.getLocalHost().getCanonicalHostName(); logger.debug("Backports server configuration omits host configuration - using autodetected " + host); } String port = wsrmConfig.getBackPortsServer().getPort(); String path = PATH_PREFIX + UUIDGenerator.generateRandomUUIDString(); this.backPort = new URI("http://" + host + ":" + port + path); } catch (URISyntaxException use) { logger.warn(use); throw new RMException(use.getMessage(), use); } catch (UnknownHostException uhe) { logger.warn(uhe); throw new RMException(uhe.getMessage(), uhe); } } } public void unassignedMessageReceived() { // we can't use objectLock in the method - possible deadlock this.countOfUnassignedMessagesAvailable.addAndGet(1); logger.debug("Expected sequence expiration in " + ((System.currentTimeMillis() - this.creationTime) / 1000) + "seconds"); logger.debug("Unassigned message available in callback handler"); } public final RMConfig getRMConfig() { return this.wsrmConfig; } public final Set getReceivedInboundMessages() { return this.receivedInboundMessages; } public final BindingProvider getBindingProvider() { return (BindingProvider)this.client; } public final void setFinal() { this.isFinal = true; logger.debug("Sequence " + this.outgoingSequenceId + " state changed to final"); } public final void ackRequested(boolean requested) { this.inboundMessageAckRequested.set(requested); logger.debug("Inbound Sequence: " + this.incomingSequenceId + ", ack requested. Messages in the queue: " + this.receivedInboundMessages); } public final boolean isAckRequested() { return this.inboundMessageAckRequested.get(); } public final void addReceivedInboundMessage(long messageId) { this.receivedInboundMessages.add(messageId); logger.debug("Inbound Sequence: " + this.incomingSequenceId + ", received message no. " + messageId); } public final void addReceivedOutboundMessage(long messageId) { this.acknowledgedOutboundMessages.add(messageId); logger.debug("Outbound Sequence: " + this.outgoingSequenceId + ", message no. " + messageId + " acknowledged by server"); } public final void setOutboundId(String outboundId) { this.outgoingSequenceId = outboundId; } public final void setInboundId(String inboundId) { this.incomingSequenceId = inboundId; } public final void setClient(ClientImpl client) { this.client = client; } public final void setDuration(long duration) { if (duration > 0) { this.creationTime = System.currentTimeMillis(); this.duration = duration; } } public final long getDuration() { return this.duration; } public final URI getBackPort() { // no need for synchronization return (this.addressableClient) ? this.backPort : null; } public final String getAcksTo() { return (this.addressableClient) ? this.backPort.toString() : ANONYMOUS_URI; } public final long newMessageNumber() { // no need for synchronization return this.messageNumber.incrementAndGet(); } public final long getLastMessageNumber() { // no need for synchronization return this.messageNumber.get(); } public final void close() throws RMException { sendCloseMessage(); sendTerminateMessage(); } private void sendMessage(String action, QName operationQName, List protocolMessages) throws RMException { try { // set up addressing properties String address = client.getEndpointMetaData().getEndpointAddress(); AddressingProperties props = null; if (this.client.getWSRMSequence().getBackPort() != null) { props = AddressingClientUtil.createDefaultProps(action, address); props.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(this.client.getWSRMSequence().getBackPort())); } else { props = AddressingClientUtil.createAnonymousProps(action, address); } // prepare WS-RM request context Map requestContext = client.getBindingProvider().getRequestContext(); Map rmRequestContext = (Map)requestContext.get(RMConstant.REQUEST_CONTEXT); if (rmRequestContext == null) { rmRequestContext = new HashMap(); } rmRequestContext.put(RMConstant.PROTOCOL_MESSAGES, protocolMessages); rmRequestContext.put(RMConstant.SEQUENCE_REFERENCE, this); // set up method invocation context requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, props); requestContext.put(RMConstant.REQUEST_CONTEXT, rmRequestContext); // call stub method this.client.invoke(operationQName, new Object[] {}, client.getBindingProvider().getResponseContext()); } catch (Exception e) { throw new RMException("Unable to terminate WSRM sequence", e); } } public final void sendCloseMessage() { if (RMProvider.get().getMessageFactory().newCloseSequence() != null) // e.g. WS-RM 1.0 doesn't support this protocol message { while (this.isAckRequested()) { logger.debug("Waiting till all inbound sequence acknowledgements will be sent"); sendSequenceAcknowledgementMessage(); } Map wsrmReqCtx = new HashMap(); wsrmReqCtx.put(RMConstant.ONE_WAY_OPERATION, false); this.getBindingProvider().getRequestContext().put(RMConstant.REQUEST_CONTEXT, wsrmReqCtx); List msgs = new LinkedList(); msgs.add(wsrmConstants.getCloseSequenceQName()); sendMessage(RMAddressingConstants.CLOSE_SEQUENCE_WSA_ACTION, wsrmConstants.getCloseSequenceQName(), msgs); } } public final void sendTerminateMessage() { List msgs = new LinkedList(); msgs.add(wsrmConstants.getTerminateSequenceQName()); if (this.getInboundId() != null) { msgs.add(wsrmConstants.getSequenceAcknowledgementQName()); } Map wsrmReqCtx = new HashMap(); boolean oneWayOperation = RMProvider.get().getMessageFactory().newTerminateSequenceResponse() == null; wsrmReqCtx.put(RMConstant.ONE_WAY_OPERATION, oneWayOperation); this.getBindingProvider().getRequestContext().put(RMConstant.REQUEST_CONTEXT, wsrmReqCtx); sendMessage(RMAddressingConstants.TERMINATE_SEQUENCE_WSA_ACTION, wsrmConstants.getTerminateSequenceQName(), msgs); } public final void sendSequenceAcknowledgementMessage() { Map wsrmReqCtx = new HashMap(); wsrmReqCtx.put(RMConstant.ONE_WAY_OPERATION, true); this.getBindingProvider().getRequestContext().put(RMConstant.REQUEST_CONTEXT, wsrmReqCtx); ackRequested(false); List msgs = new LinkedList(); msgs.add(wsrmConstants.getSequenceAcknowledgementQName()); sendMessage(RMAddressingConstants.SEQUENCE_ACKNOWLEDGEMENT_WSA_ACTION, wsrmConstants.getSequenceAcknowledgementQName(), msgs); } public final void setBehavior(RMIncompleteSequenceBehavior behavior) { if (behavior != null) { this.behavior = behavior; } } public final String getOutboundId() { return outgoingSequenceId; } public final String getInboundId() { return incomingSequenceId; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMSequence.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMSequence.j0000644000175000017500000000262310732176562031564 0ustar godgod/* * 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.wsrm; import java.util.Set; /** * An extension of the standard RM sequence * * @author richard.opalka@jboss.com * * @since Dec 12, 2007 */ public interface RMSequence { String getOutboundId(); String getInboundId(); long newMessageNumber(); long getLastMessageNumber(); long getDuration(); String getAcksTo(); Set getReceivedInboundMessages(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/policy/0000755000175000017500000000000010755000257030666 5ustar godgod././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/policy/RM10PolicyAssertionDeployer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/policy/RM10P0000644000175000017500000000761210750144631031416 0ustar godgod/* * 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.wsrm.policy; import org.apache.ws.policy.PrimitiveAssertion; import org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer; import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion; import org.jboss.ws.extensions.wsrm.config.RMConfig; import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig; import org.jboss.ws.extensions.wsrm.config.RMPortConfig; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ExtensibleMetaData; /** * Reliable messaging 1.1 policy deployer * * @author richard.opalka@jboss.com */ public final class RM10PolicyAssertionDeployer implements AssertionDeployer { private static final String WSRM_NS = "http://schemas.xmlsoap.org/ws/2005/02/rm"; /* * @see org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployClientSide(org.apache.ws.policy.PrimitiveAssertion, org.jboss.ws.metadata.umdm.ExtensibleMetaData) */ public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { deploy(assertion, extMetaData); } /* * @see org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployServerSide(org.apache.ws.policy.PrimitiveAssertion, org.jboss.ws.metadata.umdm.ExtensibleMetaData) */ public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { deploy(assertion, extMetaData); } private static void deploy(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { if (extMetaData instanceof EndpointMetaData) { EndpointMetaData endpointMD = (EndpointMetaData) extMetaData; // prepare wsrm metadata RMConfig rmMD = endpointMD.getConfig().getRMMetaData(); if (rmMD == null) { rmMD = new RMConfig(); endpointMD.getConfig().setRMMetaData(rmMD); } // construct new port metadata RMPortConfig portMD = new RMPortConfig(); portMD.setPortName(endpointMD.getPortName()); RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig(); deliveryMD.setInOrder("false"); deliveryMD.setQuality("AtMostOnce"); portMD.setDeliveryAssurance(deliveryMD); // ensure port does not exists yet for (RMPortConfig pMD : rmMD.getPorts()) { assert ! pMD.getPortName().equals(portMD.getPortName()); } // set up port WSRMP metadata rmMD.getPorts().add(portMD); if (!WSRM_NS.equals(RMProvider.get().getNamespaceURI())) { throw new IllegalArgumentException("RM provider namespace mismatch"); } } } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/policy/RM11PolicyAssertionDeployer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/policy/RM11P0000644000175000017500000001554710750144631031425 0ustar godgod/* * 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.wsrm.policy; import java.util.LinkedList; import java.util.List; import javax.xml.namespace.QName; import org.apache.ws.policy.AndCompositeAssertion; import org.apache.ws.policy.Policy; import org.apache.ws.policy.PrimitiveAssertion; import org.apache.ws.policy.XorCompositeAssertion; import org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer; import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion; import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig; import org.jboss.ws.extensions.wsrm.config.RMConfig; import org.jboss.ws.extensions.wsrm.config.RMPortConfig; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ExtensibleMetaData; /** * Reliable messaging 1.1 policy deployer * * @author richard.opalka@jboss.com */ public final class RM11PolicyAssertionDeployer implements AssertionDeployer { private static final String WSRMP_NS = "http://docs.oasis-open.org/ws-rx/wsrmp/200702"; private static final String WSRM_NS = "http://docs.oasis-open.org/ws-rx/wsrm/200702"; private static final QName EXACTLY_ONCE = new QName(WSRMP_NS, "ExactlyOnce"); private static final QName AT_LEAST_ONCE = new QName(WSRMP_NS, "AtLeastOnce"); private static final QName AT_MOST_ONCE = new QName(WSRMP_NS, "AtMostOnce"); private static final QName IN_ORDER = new QName(WSRMP_NS, "InOrder"); private static final String FALSE = "false"; private static final String TRUE = "true"; /* * @see org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployClientSide(org.apache.ws.policy.PrimitiveAssertion, org.jboss.ws.metadata.umdm.ExtensibleMetaData) */ public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { deploy(assertion, extMetaData); } /* * @see org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer#deployServerSide(org.apache.ws.policy.PrimitiveAssertion, org.jboss.ws.metadata.umdm.ExtensibleMetaData) */ public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { deploy(assertion, extMetaData); } private static void deploy(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion { if (extMetaData instanceof EndpointMetaData) { EndpointMetaData endpointMD = (EndpointMetaData) extMetaData; // prepare wsrm metadata RMConfig rmMD = endpointMD.getConfig().getRMMetaData(); if (rmMD == null) { rmMD = new RMConfig(); endpointMD.getConfig().setRMMetaData(rmMD); } // construct new port metadata RMPortConfig portMD = new RMPortConfig(); portMD.setPortName(endpointMD.getPortName()); List wsrmpAssertions = getWSRMPAssertions(assertion); portMD.setDeliveryAssurance(constructDeliveryAssurance(wsrmpAssertions)); // ensure port does not exists yet for (RMPortConfig pMD : rmMD.getPorts()) { assert ! pMD.getPortName().equals(portMD.getPortName()); } // set up port WSRMP metadata rmMD.getPorts().add(portMD); if (!WSRM_NS.equals(RMProvider.get().getNamespaceURI())) { throw new IllegalArgumentException("RM provider namespace mismatch"); } } } private static RMDeliveryAssuranceConfig constructDeliveryAssurance(List assertions) throws UnsupportedAssertion { if (assertions.size() == 1) { QName assertionQN = assertions.get(0).getName(); assertIsWSRMPAssertion(assertionQN); RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig(); deliveryMD.setInOrder(FALSE); deliveryMD.setQuality(assertionQN.getLocalPart()); return deliveryMD; } if (assertions.size() == 2) { QName firstAssertionQN = assertions.get(0).getName(); assertIsWSRMPAssertion(firstAssertionQN); QName secondAssertionQN = assertions.get(1).getName(); assertIsWSRMPAssertion(secondAssertionQN); boolean firstIsInOrder = firstAssertionQN.equals(IN_ORDER); RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig(); deliveryMD.setInOrder(TRUE); if (firstIsInOrder) { deliveryMD.setQuality(secondAssertionQN.getLocalPart()); } else { deliveryMD.setQuality(firstAssertionQN.getLocalPart()); } return deliveryMD; } throw new IllegalArgumentException(); } private static void assertIsWSRMPAssertion(QName assertionQN) throws UnsupportedAssertion { if (assertionQN.equals(EXACTLY_ONCE) || assertionQN.equals(AT_LEAST_ONCE) || assertionQN.equals(AT_MOST_ONCE) || assertionQN.equals(IN_ORDER)) { return; // recognized assertion - silently return } throw new UnsupportedAssertion(); } private static List getWSRMPAssertions(PrimitiveAssertion assertion) { Policy policy = (Policy)assertion.getTerms().get(0); XorCompositeAssertion xor = (XorCompositeAssertion)policy.getTerms().get(0); AndCompositeAssertion and = (AndCompositeAssertion)xor.getTerms().get(0); List primitiveAssertions = and.getTerms(); List retVal = new LinkedList(); for (int i = 0; i < primitiveAssertions.size(); i++) { retVal.add((PrimitiveAssertion)primitiveAssertions.get(i)); } return retVal; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/0000755000175000017500000000000010755000257030772 5ustar godgod././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMTerminateSequenceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000000755710723247145031140 0ustar godgod/* * 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.wsrm.spec200502; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence */ final class RMTerminateSequenceImpl extends RMAbstractSerializable implements RMTerminateSequence { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; RMTerminateSequenceImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence#getLastMsgNumber() */ public long getLastMsgNumber() { return 0; // always return zero for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence#setLastMsgNumber(long) */ public void setLastMsgNumber(long lastMsgNumber) { // do nothing for this version of the RM protocol } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMTerminateSequenceImpl)) return false; final RMTerminateSequenceImpl other = (RMTerminateSequenceImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMAckRequestedImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000001030110723247145031115 0ustar godgod/* * 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.wsrm.spec200502; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested */ final class RMAckRequestedImpl extends RMAbstractSerializable implements RMAckRequested { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; private long lastMessageNumber; RMAckRequestedImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested#getMessage() */ public long getMessageNumber() { return this.lastMessageNumber; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested#setMessage(long) */ public void setMessageNumber(long lastMessageNumber) { if (lastMessageNumber <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.lastMessageNumber > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.lastMessageNumber = lastMessageNumber; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + (int)(lastMessageNumber ^ (lastMessageNumber >>> 32)); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMAckRequestedImpl)) return false; final RMAckRequestedImpl other = (RMAckRequestedImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (lastMessageNumber != other.lastMessageNumber) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMSequenceAcknowledgementImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000002527210723766636031145 0ustar godgod/* * 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.wsrm.spec200502; import java.util.List; import java.util.LinkedList; import java.util.Collections; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement */ final class RMSequenceAcknowledgementImpl extends RMAbstractSerializable implements RMSequenceAcknowledgement { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private final List nacks = new LinkedList(); private final List acknowledgementRanges = new LinkedList(); private String identifier; RMSequenceAcknowledgementImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#addAcknowledgementRange(org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange) */ public void addAcknowledgementRange(RMAcknowledgementRange newAcknowledgementRange) { if ((newAcknowledgementRange == null) || (!(newAcknowledgementRange instanceof AcknowledgementRangeImpl))) throw new IllegalArgumentException(); if (this.nacks.size() != 0) throw new IllegalStateException("There are already some nacks specified"); if ((newAcknowledgementRange.getLower() == 0) || (newAcknowledgementRange.getUpper() == 0)) throw new IllegalArgumentException("Both, lower and upper values must be specified"); for (RMAcknowledgementRange alreadyAccepted : acknowledgementRanges) checkOverlap(alreadyAccepted, newAcknowledgementRange); this.acknowledgementRanges.add(newAcknowledgementRange); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#addNack(long) */ public void addNack(long messageNumber) { if (this.acknowledgementRanges.size() != 0) throw new IllegalStateException("There are already some acknowledgement ranges specified"); if (this.nacks.contains(messageNumber)) throw new IllegalArgumentException("There is already nack with value " + messageNumber + " specified"); this.nacks.add(messageNumber); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#getAcknowledgementRanges() */ public List getAcknowledgementRanges() { return Collections.unmodifiableList(acknowledgementRanges); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#getNacks() */ public List getNacks() { return Collections.unmodifiableList(nacks); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#isFinal() */ public boolean isFinal() { return false; // always return false for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#isNone() */ public boolean isNone() { return false; // always return false for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#newAcknowledgementRange() */ public RMAcknowledgementRange newAcknowledgementRange() { return new AcknowledgementRangeImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#setFinal(boolean) */ public void setFinal() { // do nothing for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#setNone(boolean) */ public void setNone() { // do nothing for this version of the RM protocol } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + ((nacks == null) ? 0 : nacks.hashCode()); result = prime * result + ((acknowledgementRanges == null) ? 0 : acknowledgementRanges.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMSequenceAcknowledgementImpl)) return false; final RMSequenceAcknowledgementImpl other = (RMSequenceAcknowledgementImpl)obj; if (acknowledgementRanges == null) { if (other.acknowledgementRanges != null) return false; } else if (!acknowledgementRanges.equals(other.acknowledgementRanges)) return false; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (nacks == null) { if (other.nacks != null) return false; } else if (!nacks.equals(other.nacks)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); if ((this.acknowledgementRanges.size() == 0) && (this.nacks.size() == 0)) throw new RMException("AcknowledgementRange or Nack must be set"); } private static void checkOverlap(RMAcknowledgementRange currentRange, RMAcknowledgementRange newRange) { if ((currentRange.getLower() <= newRange.getLower()) && (newRange.getLower() <= currentRange.getUpper())) throw new IllegalArgumentException( "Overlap detected: " + currentRange + " vs. " + newRange); if ((currentRange.getLower() <= newRange.getUpper()) && (newRange.getUpper() <= currentRange.getUpper())) throw new IllegalArgumentException( "Overlap detected: " + currentRange + " vs. " + newRange); } private static class AcknowledgementRangeImpl implements RMSequenceAcknowledgement.RMAcknowledgementRange { private long lower; private long upper; /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange#getLower() */ public long getLower() { return this.lower; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange#getUpper() */ public long getUpper() { return this.upper; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange#setLower(long) */ public void setLower(long lower) { if (lower <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.lower > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); if ((this.upper > 0) && (lower > this.upper)) throw new IllegalArgumentException("Value must be lower or equal to " + this.upper); this.lower = lower; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange#setUpper(long) */ public void setUpper(long upper) { if (upper <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.upper > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); if ((this.lower > 0) && (this.lower > upper)) throw new IllegalArgumentException("Value must be greater or equal to " + this.lower); this.upper = upper; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (int)(lower ^ (lower >>> 32)); result = prime * result + (int)(upper ^ (upper >>> 32)); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof AcknowledgementRangeImpl)) return false; final AcknowledgementRangeImpl other = (AcknowledgementRangeImpl)obj; if (lower != other.lower) return false; if (upper != other.upper) return false; return true; } public String toString() { return "<" + lower + "; " + upper + ">"; } } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMSequenceFaultImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000001051610723247145031125 0ustar godgod/* * 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.wsrm.spec200502; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFault; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFaultCode; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault */ final class RMSequenceFaultImpl extends RMAbstractSerializable implements RMSequenceFault { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private RMSequenceFaultCode faultCode; private Exception detail; RMSequenceFaultImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault#getDetail() */ public Exception getDetail() { return this.detail; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault#getFaultCode() */ public RMSequenceFaultCode getFaultCode() { return this.faultCode; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault#setDetail(java.lang.Exception) */ public void setDetail(Exception detail) { if (detail == null) throw new IllegalArgumentException("Detail cannot be null"); if (this.detail != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.detail = detail; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault#setFaultCode(org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFaultCode) */ public void setFaultCode(RMSequenceFaultCode faultCode) { if (faultCode == null) throw new IllegalArgumentException("Fault code cannot be null"); if (this.faultCode != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.faultCode = faultCode; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((detail == null) ? 0 : detail.getMessage().hashCode()); result = prime * result + ((faultCode == null) ? 0 : faultCode.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMSequenceFaultImpl)) return false; final RMSequenceFaultImpl other = (RMSequenceFaultImpl)obj; if (detail == null) { if (other.detail != null) return false; } else if (!detail.getMessage().equals(other.detail.getMessage())) return false; if (faultCode == null) { if (other.faultCode != null) return false; } else if (!faultCode.equals(other.faultCode)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.faultCode == null) throw new RMException("FaultCode must be set"); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMSequenceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000001132310723247145031122 0ustar godgod/* * 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.wsrm.spec200502; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence */ final class RMSequenceImpl extends RMAbstractSerializable implements RMSequence { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; private long messageNumber; private boolean isLastMessage; RMSequenceImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#getMessageNumber() */ public long getMessageNumber() { return messageNumber; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#isLastMessage() */ public boolean isLastMessage() { return this.isLastMessage; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#setLastMessage(boolean) */ public void setLastMessage() { this.isLastMessage = true; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#setMessageNumber(long) */ public void setMessageNumber(long messageNumber) { if (messageNumber <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.messageNumber > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.messageNumber = messageNumber; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + (isLastMessage ? 1231 : 1237); result = prime * result + (int)(messageNumber ^ (messageNumber >>> 32)); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMSequenceImpl)) return false; final RMSequenceImpl other = (RMSequenceImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (isLastMessage != other.isLastMessage) return false; if (messageNumber != other.messageNumber) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier must be set"); if (this.messageNumber == 0) throw new RMException("MessageNumber must be set"); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMProviderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000000456710747701205031134 0ustar godgod/* * 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.wsrm.spec200502; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMMessageFactory; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.common.RMConstantsImpl; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.Provider */ public final class RMProviderImpl extends RMProvider { public static final String IMPLEMENTATION_VERSION = "http://schemas.xmlsoap.org/ws/2005/02/rm"; private static final RMConstants CONSTANTS = new RMConstantsImpl("wsrm10", IMPLEMENTATION_VERSION); private static final RMProvider INSTANCE = new RMProviderImpl(); public RMProviderImpl() { // forbidden inheritance } public static RMProvider getInstance() { return INSTANCE; } /* * @see org.jboss.ws.extensions.wsrm.spi.Provider#getMessageFactory() */ @Override public RMMessageFactory getMessageFactory() { return RMMessageFactoryImpl.getInstance(); } /* * @see org.jboss.ws.extensions.wsrm.spi.Provider#getConstants() */ @Override public RMConstants getConstants() { return CONSTANTS; } /* * @see org.jboss.ws.extensions.wsrm.spi.Provider#getNamespaceURI() */ @Override public String getNamespaceURI() { return IMPLEMENTATION_VERSION; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMCreateSequenceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000002327210723766636031143 0ustar godgod/* * 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.wsrm.spec200502; import javax.xml.datatype.Duration; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMIncompleteSequenceBehavior; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence */ final class RMCreateSequenceImpl extends RMAbstractSerializable implements RMCreateSequence { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String acksTo; private Duration expires; private RMOffer offer; RMCreateSequenceImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#getAcksTo() */ public String getAcksTo() { return this.acksTo; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#getExpires() */ public Duration getExpires() { return this.expires; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#getOffer() */ public RMOffer getOffer() { return this.offer; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#newOffer() */ public RMOffer newOffer() { return new OfferImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#setAcksTo(java.lang.String) */ public void setAcksTo(String address) { if ((address == null) || (address.trim().equals(""))) throw new IllegalArgumentException("Address cannot be null nor empty string"); if (this.acksTo != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.acksTo = address; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#setExpires(java.lang.String) */ public void setExpires(Duration duration) { if ((duration == null) || (duration.toString().equals(""))) throw new IllegalArgumentException("Duration cannot be null nor empty string"); if (this.expires != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.expires = duration; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#setOffer(org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer) */ public void setOffer(RMOffer offer) { if (offer == null) throw new IllegalArgumentException("Offer cannot be null"); if (!(offer instanceof OfferImpl)) throw new IllegalArgumentException(); if (offer.getIdentifier() == null) throw new IllegalArgumentException("Offer identifier must be specified"); if (offer.getEndpoint() == null) throw new IllegalArgumentException("Offer endpoint address must be specified"); if (this.offer != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.offer = offer; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((acksTo == null) ? 0 : acksTo.hashCode()); result = prime * result + ((expires == null) ? 0 : expires.hashCode()); result = prime * result + ((offer == null) ? 0 : offer.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMCreateSequenceImpl)) return false; final RMCreateSequenceImpl other = (RMCreateSequenceImpl)obj; if (acksTo == null) { if (other.acksTo != null) return false; } else if (!acksTo.equals(other.acksTo)) return false; if (expires == null) { if (other.expires != null) return false; } else if (!expires.equals(other.expires)) return false; if (offer == null) { if (other.offer != null) return false; } else if (!offer.equals(other.offer)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.acksTo == null) throw new RMException("AcksTo must be set"); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer */ private static class OfferImpl implements RMCreateSequence.RMOffer { private String duration; private String identifier; private OfferImpl() { } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#getEndpoint() */ public String getEndpoint() { return null; // always return null for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#getExpires() */ public String getExpires() { return this.duration; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#getIncompleteSequenceBehavior() */ public RMIncompleteSequenceBehavior getIncompleteSequenceBehavior() { return null; // always return null for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#setEndpoint(java.lang.String) */ public void setEndpoint(String address) { // do nothing for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#setExpires(java.lang.String) */ public void setExpires(String duration) { if ((duration == null) || (duration.trim().equals(""))) throw new IllegalArgumentException("Duration cannot be null nor empty string"); if (this.duration != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.duration = duration; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#setIncompleteSequenceBehavior(org.jboss.ws.extensions.wsrm.spi.protocol.IncompleteSequenceBehavior) */ public void setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior incompleteSequenceBehavior) { // do nothing for this version of the RM protocol } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((duration == null) ? 0 : duration.hashCode()); result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof OfferImpl)) return false; final OfferImpl other = (OfferImpl)obj; if (duration == null) { if (other.duration != null) return false; } else if (!duration.equals(other.duration)) return false; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; return true; } } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMCreateSequenceResponseImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000002026110723766636031136 0ustar godgod/* * 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.wsrm.spec200502; import javax.xml.datatype.Duration; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMIncompleteSequenceBehavior; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse */ final class RMCreateSequenceResponseImpl extends RMAbstractSerializable implements RMCreateSequenceResponse { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; private Duration expires; private RMAccept accept; RMCreateSequenceResponseImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#getAccept() */ public RMAccept getAccept() { return this.accept; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#getDuration() */ public Duration getExpires() { return this.expires; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#getIncompleteSequenceBehavior() */ public RMIncompleteSequenceBehavior getIncompleteSequenceBehavior() { return null; // always return null for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#newAccept() */ public RMAccept newAccept() { return new AcceptImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#setAccept(org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse.Accept) */ public void setAccept(RMAccept accept) { if (accept == null) throw new IllegalArgumentException("Accept cannot be null"); if (!(accept instanceof AcceptImpl)) throw new IllegalArgumentException(); if (accept.getAcksTo() == null) throw new IllegalArgumentException("Accept acksTo must be specified"); if (this.accept != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.accept = accept; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#setExpires(java.lang.String) */ public void setExpires(Duration duration) { if ((duration == null) || (duration.toString().equals(""))) throw new IllegalArgumentException("Duration cannot be null nor empty string"); if (this.expires != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.expires = duration; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#setIncompleteSequenceBehavior(org.jboss.ws.extensions.wsrm.spi.protocol.IncompleteSequenceBehavior) */ public void setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior incompleteSequenceBehavior) { // do nothing for this version of the RM protocol } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((accept == null) ? 0 : accept.hashCode()); result = prime * result + ((expires == null) ? 0 : expires.hashCode()); result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMCreateSequenceResponseImpl)) return false; final RMCreateSequenceResponseImpl other = (RMCreateSequenceResponseImpl)obj; if (accept == null) { if (other.accept != null) return false; } else if (!accept.equals(other.accept)) return false; if (expires == null) { if (other.expires != null) return false; } else if (!expires.equals(other.expires)) return false; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier must be set"); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse.Accept */ private static class AcceptImpl implements RMCreateSequenceResponse.RMAccept { private String acksTo; /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse.Accept#getAcksTo() */ public String getAcksTo() { return this.acksTo; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse.Accept#setAcksTo(java.lang.String) */ public void setAcksTo(String address) { if ((address == null) || (address.trim().equals(""))) throw new IllegalArgumentException("Address cannot be null nor empty string"); if (this.acksTo != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.acksTo = address; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((acksTo == null) ? 0 : acksTo.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof AcceptImpl)) return false; final AcceptImpl other = (AcceptImpl)obj; if (acksTo == null) { if (other.acksTo != null) return false; } else if (!acksTo.equals(other.acksTo)) return false; return true; } } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/RMMessageFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200502/R0000644000175000017500000001035410723247145031125 0ustar godgod/* * 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.wsrm.spec200502; import org.jboss.ws.extensions.wsrm.spi.RMMessageFactory; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFault; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory */ final class RMMessageFactoryImpl implements RMMessageFactory { private static final RMMessageFactory INSTANCE = new RMMessageFactoryImpl(); private RMMessageFactoryImpl() { // forbidden inheritance } public static RMMessageFactory getInstance() { return INSTANCE; } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newAckRequested() */ public RMAckRequested newAckRequested() { return new RMAckRequestedImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newCloseSequence() */ public RMCloseSequence newCloseSequence() { return null; // not supported by this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newCloseSequenceResponse() */ public RMCloseSequenceResponse newCloseSequenceResponse() { return null; // not supported by this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newCreateSequence() */ public RMCreateSequence newCreateSequence() { return new RMCreateSequenceImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newCreateSequenceResponse() */ public RMCreateSequenceResponse newCreateSequenceResponse() { return new RMCreateSequenceResponseImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newSequence() */ public RMSequence newSequence() { return new RMSequenceImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newSequenceAcknowledgement() */ public RMSequenceAcknowledgement newSequenceAcknowledgement() { return new RMSequenceAcknowledgementImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newSequenceFault() */ public RMSequenceFault newSequenceFault() { return new RMSequenceFaultImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newTerminateSequence() */ public RMTerminateSequence newTerminateSequence() { return new RMTerminateSequenceImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newTerminateSequenceResponse() */ public RMTerminateSequenceResponse newTerminateSequenceResponse() { return null; // not supported by this version of the RM protocol } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/0000755000175000017500000000000010755000260030766 5ustar godgod././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMCloseSequenceResponseImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000000672710723247145031140 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.CloseSequenceResponse */ final class RMCloseSequenceResponseImpl extends RMAbstractSerializable implements RMCloseSequenceResponse { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; RMCloseSequenceResponseImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CloseSequenceResponse#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CloseSequenceResponse#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMCloseSequenceResponseImpl)) return false; final RMCloseSequenceResponseImpl other = (RMCloseSequenceResponseImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMTerminateSequenceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000001033510723247145031126 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence */ final class RMTerminateSequenceImpl extends RMAbstractSerializable implements RMTerminateSequence { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; private long lastMsgNumber; RMTerminateSequenceImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence#getLastMsgNumber() */ public long getLastMsgNumber() { return this.lastMsgNumber; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequence#setLastMsgNumber(long) */ public void setLastMsgNumber(long lastMsgNumber) { if (lastMsgNumber <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.lastMsgNumber > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.lastMsgNumber = lastMsgNumber; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + (int)(lastMsgNumber ^ (lastMsgNumber >>> 32)); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMTerminateSequenceImpl)) return false; final RMTerminateSequenceImpl other = (RMTerminateSequenceImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (lastMsgNumber != other.lastMsgNumber) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMCloseSequenceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000001026010723247145031123 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.CloseSequence */ final class RMCloseSequenceImpl extends RMAbstractSerializable implements RMCloseSequence { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; private long lastMsgNumber; RMCloseSequenceImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CloseSequence#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CloseSequence#getLastMsgNumber() */ public long getLastMsgNumber() { return this.lastMsgNumber; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CloseSequence#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CloseSequence#setLastMsgNumber(long) */ public void setLastMsgNumber(long lastMsgNumber) { if (lastMsgNumber <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.lastMsgNumber > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.lastMsgNumber = lastMsgNumber; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + (int)(lastMsgNumber ^ (lastMsgNumber >>> 32)); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMCloseSequenceImpl)) return false; final RMCloseSequenceImpl other = (RMCloseSequenceImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (lastMsgNumber != other.lastMsgNumber) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMAckRequestedImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000000745010723247145031132 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested */ final class RMAckRequestedImpl extends RMAbstractSerializable implements RMAckRequested { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; RMAckRequestedImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested#getMessage() */ public long getMessageNumber() { return 0; // always return zero for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.AckRequested#setMessage(long) */ public void setMessageNumber(long lastMessageNumber) { // do nothing for this version of the RM protocol } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMAckRequestedImpl)) return false; final RMAckRequestedImpl other = (RMAckRequestedImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMTerminateSequenceResponseImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000000677710723247145031145 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequenceResponse */ final class RMTerminateSequenceResponseImpl extends RMAbstractSerializable implements RMTerminateSequenceResponse { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; RMTerminateSequenceResponseImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequenceResponse#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.TerminateSequenceResponse#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMTerminateSequenceResponseImpl)) return false; final RMTerminateSequenceResponseImpl other = (RMTerminateSequenceResponseImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMSequenceAcknowledgementImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000002700510723766636031143 0ustar godgod/* * 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.wsrm.spec200702; import java.util.List; import java.util.LinkedList; import java.util.Collections; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement */ final class RMSequenceAcknowledgementImpl extends RMAbstractSerializable implements RMSequenceAcknowledgement { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private final List nacks = new LinkedList(); private final List acknowledgementRanges = new LinkedList(); private String identifier; private boolean isFinal; private boolean isNone; RMSequenceAcknowledgementImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#addAcknowledgementRange(org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange) */ public void addAcknowledgementRange(RMAcknowledgementRange newAcknowledgementRange) { if ((newAcknowledgementRange == null) || (!(newAcknowledgementRange instanceof AcknowledgementRangeImpl))) throw new IllegalArgumentException(); if (this.nacks.size() != 0) throw new IllegalStateException("There are already some nacks specified"); if (this.isNone) throw new IllegalStateException("There is already none specified"); if ((newAcknowledgementRange.getLower() == 0) || (newAcknowledgementRange.getUpper() == 0)) throw new IllegalArgumentException("Both, lower and upper values must be specified"); for (RMAcknowledgementRange alreadyAccepted : acknowledgementRanges) checkOverlap(alreadyAccepted, newAcknowledgementRange); this.acknowledgementRanges.add(newAcknowledgementRange); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#addNack(long) */ public void addNack(long messageNumber) { if (this.isFinal) throw new IllegalStateException("There is already final specified"); if (this.isNone) throw new IllegalStateException("There is already none specified"); if (this.acknowledgementRanges.size() != 0) throw new IllegalStateException("There are already some acknowledgement ranges specified"); if (this.nacks.contains(messageNumber)) throw new IllegalArgumentException("There is already nack with value " + messageNumber + " specified"); this.nacks.add(messageNumber); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#getAcknowledgementRanges() */ public List getAcknowledgementRanges() { return Collections.unmodifiableList(acknowledgementRanges); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#getNacks() */ public List getNacks() { return Collections.unmodifiableList(nacks); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#isFinal() */ public boolean isFinal() { return this.isFinal; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#isNone() */ public boolean isNone() { return this.isNone; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#newAcknowledgementRange() */ public RMAcknowledgementRange newAcknowledgementRange() { return new AcknowledgementRangeImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#setFinal(boolean) */ public void setFinal() { if (this.nacks.size() != 0) throw new IllegalStateException("There are already some nacks specified"); this.isFinal = true; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement#setNone(boolean) */ public void setNone() { if (this.acknowledgementRanges.size() != 0) throw new IllegalStateException("There are already some acknowledgement ranges specified"); if (this.nacks.size() != 0) throw new IllegalStateException("There are already some nacks specified"); this.isNone = true; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + (isFinal ? 1231 : 1237); result = prime * result + (isNone ? 1231 : 1237); result = prime * result + ((nacks == null) ? 0 : nacks.hashCode()); result = prime * result + ((acknowledgementRanges == null) ? 0 : acknowledgementRanges.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMSequenceAcknowledgementImpl)) return false; final RMSequenceAcknowledgementImpl other = (RMSequenceAcknowledgementImpl)obj; if (acknowledgementRanges == null) { if (other.acknowledgementRanges != null) return false; } else if (!acknowledgementRanges.equals(other.acknowledgementRanges)) return false; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (isFinal != other.isFinal) return false; if (isNone != other.isNone) return false; if (nacks == null) { if (other.nacks != null) return false; } else if (!nacks.equals(other.nacks)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier not set"); if ((this.acknowledgementRanges.size() == 0) && (this.nacks.size() == 0) && (!this.isNone)) throw new RMException("AcknowledgementRange or Nack or None must be set"); } private static void checkOverlap(RMAcknowledgementRange currentRange, RMAcknowledgementRange newRange) { if ((currentRange.getLower() <= newRange.getLower()) && (newRange.getLower() <= currentRange.getUpper())) throw new IllegalArgumentException( "Overlap detected: " + currentRange + " vs. " + newRange); if ((currentRange.getLower() <= newRange.getUpper()) && (newRange.getUpper() <= currentRange.getUpper())) throw new IllegalArgumentException( "Overlap detected: " + currentRange + " vs. " + newRange); } private static class AcknowledgementRangeImpl implements RMSequenceAcknowledgement.RMAcknowledgementRange { private long lower; private long upper; /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange#getLower() */ public long getLower() { return this.lower; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange#getUpper() */ public long getUpper() { return this.upper; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange#setLower(long) */ public void setLower(long lower) { if (lower <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.lower > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); if ((this.upper > 0) && (lower > this.upper)) throw new IllegalArgumentException("Value must be lower or equal to " + this.upper); this.lower = lower; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceAcknowledgement.AcknowledgementRange#setUpper(long) */ public void setUpper(long upper) { if (upper <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.upper > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); if ((this.lower > 0) && (this.lower > upper)) throw new IllegalArgumentException("Value must be greater or equal to " + this.lower); this.upper = upper; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (int)(lower ^ (lower >>> 32)); result = prime * result + (int)(upper ^ (upper >>> 32)); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof AcknowledgementRangeImpl)) return false; final AcknowledgementRangeImpl other = (AcknowledgementRangeImpl)obj; if (lower != other.lower) return false; if (upper != other.upper) return false; return true; } public String toString() { return "<" + lower + "; " + upper + ">"; } } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMSequenceFaultImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000001051310723247145031124 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFault; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFaultCode; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault */ final class RMSequenceFaultImpl extends RMAbstractSerializable implements RMSequenceFault { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private RMSequenceFaultCode faultCode; private Exception detail; RMSequenceFaultImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault#getDetail() */ public Exception getDetail() { return this.detail; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault#getFaultCode() */ public RMSequenceFaultCode getFaultCode() { return this.faultCode; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault#setDetail(java.lang.Exception) */ public void setDetail(Exception detail) { if (detail == null) throw new IllegalArgumentException("Detail cannot be null"); if (this.detail != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.detail = detail; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFault#setFaultCode(org.jboss.ws.extensions.wsrm.spi.protocol.SequenceFaultCode) */ public void setFaultCode(RMSequenceFaultCode faultCode) { if (faultCode == null) throw new IllegalArgumentException("Fault code cannot be null"); if (this.faultCode != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.faultCode = faultCode; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((detail == null) ? 0 : detail.getMessage().hashCode()); result = prime * result + ((faultCode == null) ? 0 : faultCode.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMSequenceFaultImpl)) return false; final RMSequenceFaultImpl other = (RMSequenceFaultImpl)obj; if (detail == null) { if (other.detail != null) return false; } else if (!detail.getMessage().equals(other.detail.getMessage())) return false; if (faultCode == null) { if (other.faultCode != null) return false; } else if (!faultCode.equals(other.faultCode)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.faultCode == null) throw new RMException("FaultCode must be set"); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMSequenceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000001116010723247145031123 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence */ final class RMSequenceImpl extends RMAbstractSerializable implements RMSequence { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; private long messageNumber; RMSequenceImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#getMessageNumber() */ public long getMessageNumber() { return messageNumber; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#isLastMessage() */ public boolean isLastMessage() { return false; // always return false for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#setLastMessage(boolean) */ public void setLastMessage() { // do nothing for this version of the RM protocol } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.Sequence#setMessageNumber(long) */ public void setMessageNumber(long messageNumber) { if (messageNumber <= 0) throw new IllegalArgumentException("Value must be greater than 0"); if (this.messageNumber > 0) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.messageNumber = messageNumber; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + (int)(messageNumber ^ (messageNumber >>> 32)); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMSequenceImpl)) return false; final RMSequenceImpl other = (RMSequenceImpl)obj; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (messageNumber != other.messageNumber) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier must be set"); if (this.messageNumber == 0) throw new RMException("MessageNumber must be set"); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMProviderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000000457510747701205031135 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.common.RMConstantsImpl; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMMessageFactory; import org.jboss.ws.extensions.wsrm.spi.RMProvider; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.Provider */ public final class RMProviderImpl extends RMProvider { public static final String IMPLEMENTATION_VERSION = "http://docs.oasis-open.org/ws-rx/wsrm/200702"; private static final RMConstants CONSTANTS = new RMConstantsImpl("wsrm11",IMPLEMENTATION_VERSION); private static final RMProvider INSTANCE = new RMProviderImpl(); public RMProviderImpl() { // forbidden inheritance } public static RMProvider getInstance() { return INSTANCE; } /* * @see org.jboss.ws.extensions.wsrm.spi.Provider#getMessageFactory() */ @Override public RMMessageFactory getMessageFactory() { return RMMessageFactoryImpl.getInstance(); } /* * @see org.jboss.ws.extensions.wsrm.spi.Provider#getConstants() */ @Override public RMConstants getConstants() { return CONSTANTS; } /* * @see org.jboss.ws.extensions.wsrm.spi.Provider#getNamespaceURI() */ @Override public String getNamespaceURI() { return IMPLEMENTATION_VERSION; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMCreateSequenceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000002566510723766636031155 0ustar godgod/* * 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.wsrm.spec200702; import javax.xml.datatype.Duration; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMIncompleteSequenceBehavior; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence */ final class RMCreateSequenceImpl extends RMAbstractSerializable implements RMCreateSequence { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String acksTo; private Duration expires; private RMOffer offer; RMCreateSequenceImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#getAcksTo() */ public String getAcksTo() { return this.acksTo; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#getExpires() */ public Duration getExpires() { return this.expires; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#getOffer() */ public RMOffer getOffer() { return this.offer; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#newOffer() */ public RMOffer newOffer() { return new OfferImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#setAcksTo(java.lang.String) */ public void setAcksTo(String address) { if ((address == null) || (address.trim().equals(""))) throw new IllegalArgumentException("Address cannot be null nor empty string"); if (this.acksTo != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.acksTo = address; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#setExpires(java.lang.String) */ public void setExpires(Duration duration) { if ((duration == null) || (duration.toString().equals(""))) throw new IllegalArgumentException("Duration cannot be null nor empty string"); if (this.expires != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.expires = duration; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence#setOffer(org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer) */ public void setOffer(RMOffer offer) { if (offer == null) throw new IllegalArgumentException("Offer cannot be null"); if (!(offer instanceof OfferImpl)) throw new IllegalArgumentException(); if (offer.getIdentifier() == null) throw new IllegalArgumentException("Offer identifier must be specified"); if (offer.getEndpoint() == null) throw new IllegalArgumentException("Offer endpoint address must be specified"); if (this.offer != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.offer = offer; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((acksTo == null) ? 0 : acksTo.hashCode()); result = prime * result + ((expires == null) ? 0 : expires.hashCode()); result = prime * result + ((offer == null) ? 0 : offer.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMCreateSequenceImpl)) return false; final RMCreateSequenceImpl other = (RMCreateSequenceImpl)obj; if (acksTo == null) { if (other.acksTo != null) return false; } else if (!acksTo.equals(other.acksTo)) return false; if (expires == null) { if (other.expires != null) return false; } else if (!expires.equals(other.expires)) return false; if (offer == null) { if (other.offer != null) return false; } else if (!offer.equals(other.offer)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.acksTo == null) throw new RMException("AcksTo must be set"); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer */ private static class OfferImpl implements RMCreateSequence.RMOffer { private String endpoint; private String duration; private String identifier; private RMIncompleteSequenceBehavior incompleteSequenceBehavior; private OfferImpl() { } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#getEndpoint() */ public String getEndpoint() { return this.endpoint; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#getExpires() */ public String getExpires() { return this.duration; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#getIncompleteSequenceBehavior() */ public RMIncompleteSequenceBehavior getIncompleteSequenceBehavior() { return this.incompleteSequenceBehavior; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#setEndpoint(java.lang.String) */ public void setEndpoint(String address) { if ((address == null) || (address.trim().equals(""))) throw new IllegalArgumentException("Address cannot be null nor empty string"); if (this.endpoint != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.endpoint = address; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#setExpires(java.lang.String) */ public void setExpires(String duration) { if ((duration == null) || (duration.trim().equals(""))) throw new IllegalArgumentException("Duration cannot be null nor empty string"); if (this.duration != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.duration = duration; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequence.Offer#setIncompleteSequenceBehavior(org.jboss.ws.extensions.wsrm.spi.protocol.IncompleteSequenceBehavior) */ public void setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior incompleteSequenceBehavior) { if (incompleteSequenceBehavior == null) throw new IllegalArgumentException("Sequence behavior type cannot be null"); if (this.incompleteSequenceBehavior != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.incompleteSequenceBehavior = incompleteSequenceBehavior; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((duration == null) ? 0 : duration.hashCode()); result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode()); result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + ((incompleteSequenceBehavior == null) ? 0 : incompleteSequenceBehavior.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof OfferImpl)) return false; final OfferImpl other = (OfferImpl)obj; if (duration == null) { if (other.duration != null) return false; } else if (!duration.equals(other.duration)) return false; if (endpoint == null) { if (other.endpoint != null) return false; } else if (!endpoint.equals(other.endpoint)) return false; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (incompleteSequenceBehavior == null) { if (other.incompleteSequenceBehavior != null) return false; } else if (!incompleteSequenceBehavior.equals(other.incompleteSequenceBehavior)) return false; return true; } } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMMessageFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000001024310723247145031124 0ustar godgod/* * 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.wsrm.spec200702; import org.jboss.ws.extensions.wsrm.spi.RMMessageFactory; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFault; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory */ final class RMMessageFactoryImpl implements RMMessageFactory { private static final RMMessageFactory INSTANCE = new RMMessageFactoryImpl(); private RMMessageFactoryImpl() { // forbidden inheritance } public static RMMessageFactory getInstance() { return INSTANCE; } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newAckRequested() */ public RMAckRequested newAckRequested() { return new RMAckRequestedImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newCloseSequence() */ public RMCloseSequence newCloseSequence() { return new RMCloseSequenceImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newCloseSequenceResponse() */ public RMCloseSequenceResponse newCloseSequenceResponse() { return new RMCloseSequenceResponseImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newCreateSequence() */ public RMCreateSequence newCreateSequence() { return new RMCreateSequenceImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newCreateSequenceResponse() */ public RMCreateSequenceResponse newCreateSequenceResponse() { return new RMCreateSequenceResponseImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newSequence() */ public RMSequence newSequence() { return new RMSequenceImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newSequenceAcknowledgement() */ public RMSequenceAcknowledgement newSequenceAcknowledgement() { return new RMSequenceAcknowledgementImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newSequenceFault() */ public RMSequenceFault newSequenceFault() { return new RMSequenceFaultImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newTerminateSequence() */ public RMTerminateSequence newTerminateSequence() { return new RMTerminateSequenceImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.MessageFactory#newTerminateSequenceResponse() */ public RMTerminateSequenceResponse newTerminateSequenceResponse() { return new RMTerminateSequenceResponseImpl(); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/RMCreateSequenceResponseImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/spec200702/R0000644000175000017500000002155310723766636031145 0ustar godgod/* * 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.wsrm.spec200702; import javax.xml.datatype.Duration; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.serialization.RMAbstractSerializable; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMIncompleteSequenceBehavior; /* * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse */ final class RMCreateSequenceResponseImpl extends RMAbstractSerializable implements RMCreateSequenceResponse { // provider used by de/serialization framework private static final RMProvider PROVIDER = RMProviderImpl.getInstance(); // internal fields private String identifier; private Duration expires; private RMAccept accept; private RMIncompleteSequenceBehavior incompleteSequenceBehavior; RMCreateSequenceResponseImpl() { // allow inside package use only } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#getAccept() */ public RMAccept getAccept() { return this.accept; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#getDuration() */ public Duration getExpires() { return this.expires; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#getIdentifier() */ public String getIdentifier() { return this.identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#getIncompleteSequenceBehavior() */ public RMIncompleteSequenceBehavior getIncompleteSequenceBehavior() { return this.incompleteSequenceBehavior; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#newAccept() */ public RMAccept newAccept() { return new AcceptImpl(); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#setAccept(org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse.Accept) */ public void setAccept(RMAccept accept) { if (accept == null) throw new IllegalArgumentException("Accept cannot be null"); if (!(accept instanceof AcceptImpl)) throw new IllegalArgumentException(); if (accept.getAcksTo() == null) throw new IllegalArgumentException("Accept acksTo must be specified"); if (this.accept != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.accept = accept; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#setExpires(java.lang.String) */ public void setExpires(Duration duration) { if ((duration == null) || (duration.toString().equals(""))) throw new IllegalArgumentException("Duration cannot be null nor empty string"); if (this.expires != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.expires = duration; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#setIdentifier(java.lang.String) */ public void setIdentifier(String identifier) { if ((identifier == null) || (identifier.trim().equals(""))) throw new IllegalArgumentException("Identifier cannot be null nor empty string"); if (this.identifier != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.identifier = identifier; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse#setIncompleteSequenceBehavior(org.jboss.ws.extensions.wsrm.spi.protocol.IncompleteSequenceBehavior) */ public void setIncompleteSequenceBehavior(RMIncompleteSequenceBehavior incompleteSequenceBehavior) { if (incompleteSequenceBehavior == null) throw new IllegalArgumentException("Sequence behavior type cannot be null"); if (this.incompleteSequenceBehavior != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.incompleteSequenceBehavior = incompleteSequenceBehavior; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((accept == null) ? 0 : accept.hashCode()); result = prime * result + ((expires == null) ? 0 : expires.hashCode()); result = prime * result + ((identifier == null) ? 0 : identifier.hashCode()); result = prime * result + ((incompleteSequenceBehavior == null) ? 0 : incompleteSequenceBehavior.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof RMCreateSequenceResponseImpl)) return false; final RMCreateSequenceResponseImpl other = (RMCreateSequenceResponseImpl)obj; if (accept == null) { if (other.accept != null) return false; } else if (!accept.equals(other.accept)) return false; if (expires == null) { if (other.expires != null) return false; } else if (!expires.equals(other.expires)) return false; if (identifier == null) { if (other.identifier != null) return false; } else if (!identifier.equals(other.identifier)) return false; if (incompleteSequenceBehavior == null) { if (other.incompleteSequenceBehavior != null) return false; } else if (!incompleteSequenceBehavior.equals(other.incompleteSequenceBehavior)) return false; return true; } public RMProvider getProvider() { return PROVIDER; } public void validate() { if (this.identifier == null) throw new RMException("Identifier must be set"); } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse.Accept */ private static class AcceptImpl implements RMCreateSequenceResponse.RMAccept { private String acksTo; /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse.Accept#getAcksTo() */ public String getAcksTo() { return this.acksTo; } /* * @see org.jboss.ws.extensions.wsrm.spi.protocol.CreateSequenceResponse.Accept#setAcksTo(java.lang.String) */ public void setAcksTo(String address) { if ((address == null) || (address.trim().equals(""))) throw new IllegalArgumentException("Address cannot be null nor empty string"); if (this.acksTo != null) throw new UnsupportedOperationException("Value already set, cannot be overriden"); this.acksTo = address; } /* * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((acksTo == null) ? 0 : acksTo.hashCode()); return result; } /* * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof AcceptImpl)) return false; final AcceptImpl other = (AcceptImpl)obj; if (acksTo == null) { if (other.acksTo != null) return false; } else if (!acksTo.equals(other.acksTo)) return false; return true; } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/0000755000175000017500000000000010755000260030626 5ustar godgod././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMCon0000644000175000017500000000452610750144631031544 0ustar godgod/* * 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.wsrm.config; import java.util.List; import java.util.LinkedList; /** * Reliable messaging configuration metadata * * @author richard.opalka@jboss.com */ public final class RMConfig { private RMDeliveryAssuranceConfig deliveryAssurance; private RMBackPortsServerConfig backportsServer; private RMMessageRetransmissionConfig messageRetransmission; private List ports = new LinkedList(); public final void setMessageRetransmission(RMMessageRetransmissionConfig messageRetransmission) { this.messageRetransmission = messageRetransmission; } public final RMMessageRetransmissionConfig getMessageRetransmission() { return this.messageRetransmission; } public final void setDeliveryAssurance(RMDeliveryAssuranceConfig deliveryAssurance) { this.deliveryAssurance = deliveryAssurance; } public final RMDeliveryAssuranceConfig getDeliveryAssurance() { return this.deliveryAssurance; } public final void setBackPortsServer(RMBackPortsServerConfig backportsServer) { this.backportsServer = backportsServer; } public final RMBackPortsServerConfig getBackPortsServer() { return this.backportsServer; } public final List getPorts() { return this.ports; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMBackPortsServerConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMBac0000644000175000017500000000306510725517644031521 0ustar godgod/* * 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.wsrm.config; /** * Reliable messaging backports server provider metadata * * @author richard.opalka@jboss.com * * @since Dec 5, 2007 */ public final class RMBackPortsServerConfig { private String host; private String port; public final String getHost() { return host; } public final void setHost(String hostname) { this.host = hostname; } public final String getPort() { return port; } public final void setPort(String port) { this.port = port; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMPortConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMPor0000644000175000017500000000401110723247145031556 0ustar godgod/* * 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.wsrm.config; import javax.xml.namespace.QName; /** * Port customization metadata * * @author richard.opalka@jboss.com */ public final class RMPortConfig { private QName portName; private RMDeliveryAssuranceConfig deliveryAssurance; public final void setPortName(QName portName) { if (portName == null) throw new IllegalArgumentException(); this.portName = portName; } public final QName getPortName() { return this.portName; } public final void setDeliveryAssurance(RMDeliveryAssuranceConfig deliveryAssurance) { if (deliveryAssurance == null) throw new IllegalArgumentException(); this.deliveryAssurance = deliveryAssurance; } public final RMDeliveryAssuranceConfig getDeliveryAssurance() { return this.deliveryAssurance; } public final String toString() { return "portName=\"" + this.portName + "\", deliveryAssurance={" + this.deliveryAssurance + "}"; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMMessageRetransmissionConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMMes0000644000175000017500000000367410725760103031554 0ustar godgod/* * 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.wsrm.config; /** * Message retransmission configuration * * @author richard.opalka@jboss.com * * @since Dec 6, 2007 */ public final class RMMessageRetransmissionConfig { private int countOfAttempts; private int retransmissionInterval; private int messageTimeout; public final int getCountOfAttempts() { return countOfAttempts; } public final void setCountOfAttempts(int countOfAttempts) { this.countOfAttempts = countOfAttempts; } public final int getRetransmissionInterval() { return retransmissionInterval; } public final void setRetransmissionInterval(int retransmissionInterval) { this.retransmissionInterval = retransmissionInterval; } public final int getMessageTimeout() { return messageTimeout; } public final void setMessageTimeout(int messageTimeout) { this.messageTimeout = messageTimeout; } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMDeliveryAssuranceConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/config/RMDel0000644000175000017500000000352310723247145031531 0ustar godgod/* * 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.wsrm.config; /** * Delivery assurance metadata * * @author richard.opalka@jboss.com */ public final class RMDeliveryAssuranceConfig { private String quality; private String inOrder; public final void setQuality(String quality) { if (quality == null) throw new IllegalArgumentException(); this.quality = quality; } public final String getQuality() { return this.quality; } public final void setInOrder(String inOrder) { if (inOrder == null) throw new IllegalArgumentException(); this.inOrder = inOrder; } public final String getInOrder() { return this.inOrder; } public final String toString() { return "inOrder=\"" + this.inOrder + "\", quality=\"" + this.quality + "\""; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/server/0000755000175000017500000000000010755000260030667 5ustar godgod././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/server/RMDeploymentAspect.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/server/RMDep0000644000175000017500000000601110732432657031575 0ustar godgod/* * 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.wsrm.server; import java.util.LinkedList; import org.jboss.ws.extensions.wsrm.common.RMHelper; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.DeploymentAspect; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.invocation.InvocationHandler; /** * Registers RMInvocationHandler if WS-RM is detected * * @author richard.opalka@jboss.com * * @since Dec 11, 2007 */ public final class RMDeploymentAspect extends DeploymentAspect { @Override public final void create(Deployment dep) { for (Endpoint ep : dep.getService().getEndpoints()) { ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data"); if (sepMetaData.getConfig().getRMMetaData() != null) { InvocationHandler origInvHandler = ep.getInvocationHandler(); InvocationHandler wsrmInvHandler = new RMInvocationHandler(origInvHandler); ep.setInvocationHandler(wsrmInvHandler); ep.addAttachment(RMServerSequence.class, new LinkedList()); RMHelper.setupRMOperations(sepMetaData); log.info("WS-RM invocation handler associated with endpoint " + ep.getAddress()); } } } @Override public final void destroy(Deployment dep) { for (Endpoint ep : dep.getService().getEndpoints()) { InvocationHandler invHandler = ep.getInvocationHandler(); if (invHandler instanceof RMInvocationHandler) { RMInvocationHandler rmInvHandler = (RMInvocationHandler)invHandler; ep.setInvocationHandler(rmInvHandler.getDelegate()); ep.removeAttachment(RMServerSequence.class); log.info("WS-RM invocation handler removed from endpoint " + ep.getAddress()); } } } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/server/RMInv0000644000175000017500000002547410747701205031631 0ustar godgod/* * 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.wsrm.server; import java.net.URISyntaxException; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.addressing.Relationship; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.extensions.wsrm.RMAddressingConstants; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.common.RMHelper; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.invocation.Invocation; import org.jboss.wsf.spi.invocation.InvocationHandler; /** * RM Invocation Handler * * @author richard.opalka@jboss.com * * @since Dec 11, 2007 */ public final class RMInvocationHandler extends InvocationHandler { private static final Logger logger = Logger.getLogger(RMInvocationHandler.class); private static final RMConstants rmConstants = RMProvider.get().getConstants(); private final InvocationHandler delegate; RMInvocationHandler(InvocationHandler delegate) { this.delegate = delegate; } @Override public final Invocation createInvocation() { return this.delegate.createInvocation(); } @Override public final void handleInvocationException(Throwable th) throws Exception { // TODO is it necessary to handle it specially in the case of WS-RM ? super.handleInvocationException(th); } @Override public final void init(Endpoint ep) { this.delegate.init(ep); } /** * Do RM staff before endpoint invocation * @param ep endpoint * @param inv invocation * @return RM response context to be set after target endpoint invocation */ private Map prepareResponseContext(Endpoint ep, Invocation inv) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); AddressingProperties addrProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND); if (addrProps == null) throw new IllegalStateException("WS-Addressing properties not found in server request"); Map rmReqProps = (Map)msgContext.get(RMConstant.REQUEST_CONTEXT); msgContext.remove(RMConstant.REQUEST_CONTEXT); if (rmReqProps == null) throw new IllegalStateException("WS-RM specific data not found in server request"); List protocolMessages = new LinkedList(); Map rmResponseContext = new HashMap(); List sequences = (List)ep.getAttachment(RMServerSequence.class); rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, protocolMessages); msgContext.remove(RMConstant.RESPONSE_CONTEXT); RMServerSequence sequence = null; boolean isOneWayOperation = true; if (RMHelper.isCreateSequence(rmReqProps)) { sequence = new RMServerSequence(); sequences.add(sequence); protocolMessages.add(rmConstants.getCreateSequenceResponseQName()); rmResponseContext.put(RMConstant.SEQUENCE_REFERENCE, sequence); isOneWayOperation = false; } if (RMHelper.isCloseSequence(rmReqProps)) { Map data = (Map)rmReqProps.get(RMConstant.PROTOCOL_MESSAGES_MAPPING); RMCloseSequence payload = (RMCloseSequence)data.get(rmConstants.getCloseSequenceQName()); String seqIdentifier = payload.getIdentifier(); sequence = RMHelper.getServerSequenceByInboundId(seqIdentifier, sequences); if (sequence == null) { throw new NotImplementedException("TODO: implement unknown sequence fault" + seqIdentifier); } sequence.close(); protocolMessages.add(rmConstants.getCloseSequenceResponseQName()); protocolMessages.add(rmConstants.getSequenceAcknowledgementQName()); rmResponseContext.put(RMConstant.SEQUENCE_REFERENCE, sequence); isOneWayOperation = false; } if (RMHelper.isSequenceAcknowledgement(rmReqProps)) { Map data = (Map)rmReqProps.get(RMConstant.PROTOCOL_MESSAGES_MAPPING); RMSequenceAcknowledgement payload = (RMSequenceAcknowledgement)data.get(rmConstants.getSequenceAcknowledgementQName()); String seqIdentifier = payload.getIdentifier(); sequence = RMHelper.getServerSequenceByOutboundId(seqIdentifier, sequences); if (sequence == null) { throw new NotImplementedException("TODO: implement unknown sequence fault" + seqIdentifier); } for (RMSequenceAcknowledgement.RMAcknowledgementRange range : payload.getAcknowledgementRanges()) { for (long i = range.getLower(); i <= range.getUpper(); i++) { sequence.addReceivedOutboundMessage(i); } } } if (RMHelper.isTerminateSequence(rmReqProps)) { Map data = (Map)rmReqProps.get(RMConstant.PROTOCOL_MESSAGES_MAPPING); RMTerminateSequence payload = (RMTerminateSequence)data.get(rmConstants.getTerminateSequenceQName()); String seqIdentifier = payload.getIdentifier(); sequence = RMHelper.getServerSequenceByInboundId(seqIdentifier, sequences); if (sequence == null) { throw new NotImplementedException("TODO: implement unknown sequence fault" + seqIdentifier); } sequences.remove(sequence); if (RMProvider.get().getMessageFactory().newTerminateSequenceResponse() != null) { protocolMessages.add(rmConstants.getTerminateSequenceResponseQName()); protocolMessages.add(rmConstants.getSequenceAcknowledgementQName()); rmResponseContext.put(RMConstant.SEQUENCE_REFERENCE, sequence); isOneWayOperation = false; } else { return null; // no WS-RM context propagated } } if (RMHelper.isSequence(rmReqProps)) { Map data = (Map)rmReqProps.get(RMConstant.PROTOCOL_MESSAGES_MAPPING); RMSequence payload = (RMSequence)data.get(rmConstants.getSequenceQName()); String seqIdentifier = payload.getIdentifier(); sequence = RMHelper.getServerSequenceByInboundId(seqIdentifier, sequences); if (sequence == null) { throw new NotImplementedException("TODO: implement unknown sequence fault" + seqIdentifier); } sequence.addReceivedInboundMessage(payload.getMessageNumber()); protocolMessages.add(rmConstants.getSequenceAcknowledgementQName()); rmResponseContext.put(RMConstant.SEQUENCE_REFERENCE, sequence); boolean retTypeIsVoid = inv.getJavaMethod().getReturnType().equals(Void.class) || inv.getJavaMethod().getReturnType().equals(Void.TYPE); if (false == retTypeIsVoid) { protocolMessages.add(rmConstants.getSequenceQName()); protocolMessages.add(rmConstants.getAckRequestedQName()); } else { AddressingBuilder builder = AddressingBuilder.getAddressingBuilder(); AddressingProperties addressingProps = builder.newAddressingProperties(); addressingProps.setTo(builder.newURI(addrProps.getReplyTo().getAddress().getURI())); addressingProps.setRelatesTo(new Relationship[] {builder.newRelationship(addrProps.getMessageID().getURI())}); try { addressingProps.setAction(builder.newURI(RMAddressingConstants.SEQUENCE_ACKNOWLEDGEMENT_WSA_ACTION)); } catch (URISyntaxException ignore) { } rmResponseContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, addressingProps); } isOneWayOperation = false; } rmResponseContext.put(RMConstant.ONE_WAY_OPERATION, isOneWayOperation); return rmResponseContext; } @Override public final void invoke(Endpoint ep, Invocation inv) throws Exception { Map rmResponseContext = prepareResponseContext(ep, inv); if (inv.getJavaMethod() != null) { logger.debug("Invoking method: " + inv.getJavaMethod().getName()); this.delegate.invoke(ep, inv); } else { logger.debug("RM lifecycle protocol method detected"); } setupResponseContext(rmResponseContext); } private void setupResponseContext(Map rmResponseContext) { if (rmResponseContext != null) { CommonMessageContext msgCtx = MessageContextAssociation.peekMessageContext(); msgCtx.put(RMConstant.RESPONSE_CONTEXT, rmResponseContext); msgCtx.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, rmResponseContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND)); } } public final InvocationHandler getDelegate() { return this.delegate; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/server/RMServerSequence.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/server/RMSer0000644000175000017500000000736310747701205031623 0ustar godgod/* * 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.wsrm.server; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import org.jboss.logging.Logger; import org.jboss.ws.extensions.addressing.AddressingClientUtil; import org.jboss.ws.extensions.wsrm.RMSequence; /** * Server side implementation of the RM sequence * * @author richard.opalka@jboss.com * * @since Dec 12, 2007 */ public class RMServerSequence implements RMSequence { private static final Logger logger = Logger.getLogger(RMServerSequence.class); private final String inboundId = AddressingClientUtil.generateMessageID().toString(); private final String outboundId = AddressingClientUtil.generateMessageID().toString(); private final long duration = 10 * 60 * 1000L; // 10 minutes duration private final Set acknowledgedOutboundMessages = new TreeSet(); private final Set receivedInboundMessages = new TreeSet(); private boolean closed; private AtomicBoolean inboundMessageAckRequested = new AtomicBoolean(); private AtomicLong messageNumber = new AtomicLong(); public String getInboundId() { return this.inboundId; } public long getDuration() { return this.duration; } public String getAcksTo() { return null; } public String getOutboundId() { return this.outboundId; } public final void addReceivedInboundMessage(long messageId) { this.receivedInboundMessages.add(messageId); logger.debug("Inbound Sequence: " + this.inboundId + ", received message no. " + messageId); } public final void addReceivedOutboundMessage(long messageId) { this.acknowledgedOutboundMessages.add(messageId); logger.debug("Outbound Sequence: " + this.outboundId + ", message no. " + messageId + " acknowledged by server"); } public final void ackRequested(boolean requested) { this.inboundMessageAckRequested.set(requested); logger.debug("Inbound Sequence: " + this.inboundId + ", ack requested. Messages in the queue: " + this.receivedInboundMessages); } public final long newMessageNumber() { // no need for synchronization return this.messageNumber.incrementAndGet(); } public final long getLastMessageNumber() { // no need for synchronization return this.messageNumber.get(); } public final boolean isAckRequested() { return this.inboundMessageAckRequested.get(); } public Set getReceivedInboundMessages() { return this.receivedInboundMessages; } public void close() { this.closed = true; } public String toString() { return this.inboundId + " - " + this.outboundId; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/api/0000755000175000017500000000000010755000260030132 5ustar godgod././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/api/RMProvider.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/api/RMProvid0000644000175000017500000000354210750144631031571 0ustar godgod/* * 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.wsrm.api; /** * WS-RM provider used for sequence creation. Typical usecase is: * *

       * boolean addressableClient = true;
       * SEI sei = (SEI)service.getPort(SEI.class)
       * sei.callMethod1();
       * sei.callMethod2();
       * ...
       * ((RMProvider)sei).closeSequence();
       * ((RMProvider)sei).createSequence();
       * sei.callMethod1();
       * sei.callMethod2();
       * ...
       * ((RMProvider)sei).closeSequence();
       * 

      * * @author richard.opalka@jboss.com * * @since Oct 22, 2007 */ public interface RMProvider { /** * Creates new WS-RM sequence and associates it with service proxy * @throws RMException if something went wrong */ void createSequence(); /** * Close the sequence associated with service proxy * @throws RMException if something went wrong */ void closeSequence(); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/api/RMException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/api/RMExcept0000644000175000017500000000306510732176562031566 0ustar godgod/* * 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.wsrm.api; import javax.xml.ws.WebServiceException; /** * WS-RM exception * * @author richard.opalka@jboss.com * * @since Oct 22, 2007 * @see org.jboss.ws.extensions.wsrm.api.RMProvider */ public class RMException extends WebServiceException { public RMException() { super(); } public RMException(String message, Throwable cause) { super(message, cause); } public RMException(String message) { super(message); } public RMException(Throwable cause) { super(cause); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMDeliveryAssuranceFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMDeliveryAs0000644000175000017500000001325010723247145031625 0ustar godgod/* * 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.wsrm; /** * Encapsulates generation of reliable messaging quality assurance configurations * * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.RMDeliveryQuality */ public final class RMDeliveryAssuranceFactory { private static final RMDeliveryAssuranceFactory INSTANCE = new RMDeliveryAssuranceFactory(); private static final String[] ACCEPTABLE_IN_ORDER_VALUES = { "0", "1", "false", "true" }; private static final RMDeliveryAssurance EXACTLY_ONCE_WITH_ORDER; private static final RMDeliveryAssurance EXACTLY_ONCE_WITHOUT_ORDER; private static final RMDeliveryAssurance AT_MOST_ONCE_WITH_ORDER; private static final RMDeliveryAssurance AT_MOST_ONCE_WITHOUT_ORDER; private static final RMDeliveryAssurance AT_LEAST_ONCE_WITH_ORDER; private static final RMDeliveryAssurance AT_LEAST_ONCE_WITHOUT_ORDER; static { EXACTLY_ONCE_WITH_ORDER = new DeliveryAssuranceImpl(RMDeliveryQuality.EXACTLY_ONCE, true); EXACTLY_ONCE_WITHOUT_ORDER = new DeliveryAssuranceImpl(RMDeliveryQuality.EXACTLY_ONCE, false); AT_MOST_ONCE_WITH_ORDER = new DeliveryAssuranceImpl(RMDeliveryQuality.AT_MOST_ONCE, true); AT_MOST_ONCE_WITHOUT_ORDER = new DeliveryAssuranceImpl(RMDeliveryQuality.AT_MOST_ONCE, false); AT_LEAST_ONCE_WITH_ORDER = new DeliveryAssuranceImpl(RMDeliveryQuality.AT_LEAST_ONCE, true); AT_LEAST_ONCE_WITHOUT_ORDER = new DeliveryAssuranceImpl(RMDeliveryQuality.AT_LEAST_ONCE, false); } // immutable object instance private static final class DeliveryAssuranceImpl implements RMDeliveryAssurance { private final RMDeliveryQuality quality; private final boolean inOrder; private DeliveryAssuranceImpl(RMDeliveryQuality quality, boolean inOrder) { this.quality = quality; this.inOrder = inOrder; } /* * @see org.jboss.ws.extensions.wsrm.DeliveryAssurance#getDeliveryQuality() */ public RMDeliveryQuality getDeliveryQuality() { return quality; } /* * @see org.jboss.ws.extensions.wsrm.DeliveryAssurance#inOrder() */ public boolean inOrder() { return inOrder; } } private RMDeliveryAssuranceFactory() { // no instances } /** * Factory getter * @return factory instance */ public static RMDeliveryAssuranceFactory getInstance() { return INSTANCE; } /** * Returns constructed DeliveryAssurance object * @param quality string representing quality value * @param inOrder string representing inOrder value * @return DeliveryAssurance object * @throws IllegalArgumentException if quality or inOrder are null or contain incorrect values */ public static RMDeliveryAssurance getDeliveryAssurance(String quality, String inOrder) { if ((quality == null) || (inOrder == null)) throw new IllegalArgumentException("Neither quality nor inOrder parameter cannot be null"); Boolean inOrderBoolean = null; for (int i = 0; i < ACCEPTABLE_IN_ORDER_VALUES.length; i++) { if (ACCEPTABLE_IN_ORDER_VALUES[i].equals(inOrder)) { inOrderBoolean = (i % 2 == 0) ? Boolean.FALSE : Boolean.TRUE; break; } } if (inOrderBoolean == null) throw new IllegalArgumentException("Incorrect inOrder value: " + inOrder); return getDeliveryAssurance(RMDeliveryQuality.parseDeliveryQuality(quality), inOrderBoolean); } /** * Returns constructed DeliveryAssurance object * @param quality object representing required quality * @param inOrder string representing required inOrder value * @return DeliveryAssurance object * @throws IllegalArgumentException if quality is null */ public static RMDeliveryAssurance getDeliveryAssurance(RMDeliveryQuality quality, boolean inOrder) { if (quality == null) throw new IllegalArgumentException("Quality cannot be null"); if (inOrder) { if (quality == RMDeliveryQuality.EXACTLY_ONCE) return EXACTLY_ONCE_WITH_ORDER; if (quality == RMDeliveryQuality.AT_LEAST_ONCE) return AT_LEAST_ONCE_WITH_ORDER; if (quality == RMDeliveryQuality.AT_MOST_ONCE) return AT_MOST_ONCE_WITH_ORDER; } else { if (quality == RMDeliveryQuality.EXACTLY_ONCE) return EXACTLY_ONCE_WITHOUT_ORDER; if (quality == RMDeliveryQuality.AT_LEAST_ONCE) return AT_LEAST_ONCE_WITHOUT_ORDER; if (quality == RMDeliveryQuality.AT_MOST_ONCE) return AT_MOST_ONCE_WITHOUT_ORDER; } return null; // never happens } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMAddressingConstants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMAddressing0000644000175000017500000000513310730500064031630 0ustar godgod/* * 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.wsrm; import javax.xml.ws.addressing.AddressingBuilder; import org.jboss.ws.extensions.wsrm.spi.RMProvider; /** * Addressing constants related to WS-RM protocol * * @author richard.opalka@jboss.com * * @since Dec 14, 2007 */ public final class RMAddressingConstants { private RMAddressingConstants() { // instances not allowed } public static final String CREATE_SEQUENCE_WSA_ACTION; public static final String CREATE_SEQUENCE_RESPONSE_WSA_ACTION; public static final String CLOSE_SEQUENCE_WSA_ACTION; public static final String CLOSE_SEQUENCE_RESPONSE_WSA_ACTION; public static final String SEQUENCE_ACKNOWLEDGEMENT_WSA_ACTION; public static final String TERMINATE_SEQUENCE_WSA_ACTION; public static final String TERMINATE_SEQUENCE_RESPONSE_WSA_ACTION; public static final String WSA_ANONYMOUS_URI = AddressingBuilder.getAddressingBuilder().newAddressingConstants().getAnonymousURI(); static { String namespaceURI = RMProvider.get().getConstants().getNamespaceURI(); CREATE_SEQUENCE_WSA_ACTION = namespaceURI + "/CreateSequence"; CREATE_SEQUENCE_RESPONSE_WSA_ACTION = namespaceURI + "/CreateSequenceResponse"; CLOSE_SEQUENCE_WSA_ACTION = namespaceURI + "/CloseSequence"; CLOSE_SEQUENCE_RESPONSE_WSA_ACTION = namespaceURI + "/CloseSequenceResponse"; SEQUENCE_ACKNOWLEDGEMENT_WSA_ACTION = namespaceURI + "/SequenceAcknowledgement"; TERMINATE_SEQUENCE_WSA_ACTION = namespaceURI + "/TerminateSequence"; TERMINATE_SEQUENCE_RESPONSE_WSA_ACTION = namespaceURI + "/TerminateSequenceResponse"; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMDeliveryAssurance.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMDeliveryAs0000644000175000017500000000314310723247145031625 0ustar godgod/* * 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.wsrm; /** * Represents message delivery assurance * * @author richard.opalka@jboss.com * @see org.jboss.ws.extensions.wsrm.RMDeliveryAssuranceFactory */ public interface RMDeliveryAssurance { /** * Returns associated message delivery assurance * @return non null delivery assurance object */ RMDeliveryQuality getDeliveryQuality(); /** * Specifies whether messages are to be delivered in order to the service instance or client proxy * @return true if in order delivery is required, false otherwise */ boolean inOrder(); } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMConstant.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMConstant.j0000644000175000017500000000337610730511517031602 0ustar godgodpackage org.jboss.ws.extensions.wsrm; import java.util.Collections; import java.util.HashSet; import java.util.Set; import javax.xml.namespace.QName; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; public final class RMConstant { private RMConstant() { // instances not allowed } private static final String PREFIX = "wsrm"; public static final String ONE_WAY_OPERATION = PREFIX + ".oneWayOperation"; public static final String REQUEST_CONTEXT = PREFIX + ".requestContext"; public static final String RESPONSE_CONTEXT = PREFIX + ".responseContext"; public static final String SEQUENCE_REFERENCE = PREFIX + ".sequenceReference"; public static final String PROTOCOL_MESSAGES = PREFIX + ".protocolMessages"; public static final String PROTOCOL_MESSAGES_MAPPING = PREFIX + ".protocolMessagesMapping"; public static final String WSA_MESSAGE_ID = PREFIX + ".wsaMessageId"; public static final Set PROTOCOL_OPERATION_QNAMES; static { Set temp = new HashSet(); RMConstants constants = RMProvider.get().getConstants(); temp.add(constants.getSequenceQName()); temp.add(constants.getSequenceFaultQName()); temp.add(constants.getSequenceAcknowledgementQName()); temp.add(constants.getAckRequestedQName()); temp.add(constants.getCreateSequenceQName()); temp.add(constants.getCreateSequenceResponseQName()); temp.add(constants.getCloseSequenceQName()); temp.add(constants.getCloseSequenceResponseQName()); temp.add(constants.getTerminateSequenceQName()); temp.add(constants.getTerminateSequenceResponseQName()); PROTOCOL_OPERATION_QNAMES = Collections.unmodifiableSet(temp); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMDeliveryQuality.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/extensions/wsrm/RMDeliveryQu0000644000175000017500000000747010723247145031656 0ustar godgod/* * 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.wsrm; /** * Represents message delivery quality * * @author richard.opalka@jboss.com */ public enum RMDeliveryQuality { /** * Each message is to be delivered at most once. The RM Source MAY retry transmission of * unacknowledged messages, but is NOT REQUIRED to do so. The requirement on the RM * Destination is that it MUST filter out duplicate messages, i.e. that it MUST NOT * deliver a duplicate of a message that has already been delivered. */ AT_MOST_ONCE("AtMostOnce"), /** * Each message is to be delivered exactly once; if a message cannot be delivered then an error * MUST be raised by the RM Source and/or RM Destination. The requirement on an RM Source is * that it SHOULD retry transmission of every message sent by the Application Source until it * receives an acknowledgement from the RM Destination. The requirement on the RM Destination * is that it SHOULD retry the transfer to the Application Destination of any message that it * accepts from the RM Source until that message has been successfully delivered, and that it * MUST NOT deliver a duplicate of a message that has already been delivered. */ AT_LEAST_ONCE("AtLeastOnce"), /** * Each message is to be delivered at least once, or else an error MUST be raised by the RM * Source and/or RM Destination. The requirement on an RM Source is that it SHOULD retry * transmission of every message sent by the Application Source until it receives an * acknowledgement from the RM Destination. The requirement on the RM Destination is that it * SHOULD retry the transfer to the Application Destination of any message that it accepts * from the RM Source, until that message has been successfully delivered. There is no * requirement for the RM Destination to apply duplicate message filtering. */ EXACTLY_ONCE("ExactlyOnce"); // associated string representation private final String quality; RMDeliveryQuality(String quality) { this.quality = quality; } /** * Returns associated constant with passed quality string. Note this method is case sensitive. * Allowed values are: AtMostOnce, AtLeastOnce, ExactlyOnce. * @param quality to be parsed * @return associated constant * @throws IllegalArgumentException if quality string has no associated enumeration value */ public static RMDeliveryQuality parseDeliveryQuality(String quality) { if (AT_MOST_ONCE.quality.equals(quality)) return AT_MOST_ONCE; if (AT_LEAST_ONCE.quality.equals(quality)) return AT_LEAST_ONCE; if (EXACTLY_ONCE.quality.equals(quality)) return EXACTLY_ONCE; throw new IllegalArgumentException("Unrecognized string: " + quality); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/0000755000175000017500000000000010755000261025753 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/acessor/0000755000175000017500000000000010755000260027411 5ustar godgod././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/acessor/ReflectiveMethodAccessor.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/acessor/ReflectiveM0000755000175000017500000000667110543061077031566 0ustar godgod/* * 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.metadata.acessor; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import org.jboss.ws.WSException; import org.jboss.ws.metadata.umdm.Accessor; import org.jboss.ws.metadata.umdm.AccessorFactory; import org.jboss.ws.metadata.umdm.AccessorFactoryCreator; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; /** * A simple JavaBean accessor that uses ordinary reflection. * * @author Jason T. Greene * @version $Revision: 1760 $ */ @SuppressWarnings("unchecked") public class ReflectiveMethodAccessor implements Accessor { private Method getter; private Method setter; public static AccessorFactoryCreator FACTORY_CREATOR = new AccessorFactoryCreator() { public AccessorFactory create(ParameterMetaData parameter) { return create(parameter.getJavaType()); } public AccessorFactory create(FaultMetaData fault) { return create(fault.getFaultBean()); } private AccessorFactory create(final Class clazz) { return new AccessorFactory() { public Accessor create(WrappedParameter parameter) { try { PropertyDescriptor pd = new PropertyDescriptor(parameter.getVariable(), clazz); return new ReflectiveMethodAccessor(pd.getReadMethod(), pd.getWriteMethod()); } catch (Throwable t) { WSException ex = new WSException(t.getMessage()); ex.setStackTrace(t.getStackTrace()); throw ex; } } }; } }; private ReflectiveMethodAccessor(Method getter, Method setter) { this.getter = getter; this.setter = setter; } public Object get(Object bean) { try { return getter.invoke(bean); } catch (Throwable e) { WSException ex = new WSException(e.getMessage()); ex.setStackTrace(ex.getStackTrace()); throw ex; } } public void set(Object bean, Object value) { try { setter.invoke(bean, value); } catch (Throwable e) { WSException ex = new WSException(e.getMessage()); ex.setStackTrace(ex.getStackTrace()); throw ex; } } }././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/acessor/ReflectiveFieldAccessor.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/acessor/ReflectiveF0000755000175000017500000000761610551372426031561 0ustar godgod/* * 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.metadata.acessor; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import org.jboss.ws.WSException; import org.jboss.ws.metadata.umdm.Accessor; import org.jboss.ws.metadata.umdm.AccessorFactory; import org.jboss.ws.metadata.umdm.AccessorFactoryCreator; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; /** * A simple Java field accessor that uses ordinary reflection. * * @author Jason T. Greene * @version $Revision: 1760 $ */ @SuppressWarnings("unchecked") public class ReflectiveFieldAccessor implements Accessor { private Field field; public static AccessorFactoryCreator FACTORY_CREATOR = new AccessorFactoryCreator() { public AccessorFactory create(ParameterMetaData parameter) { return create(parameter.getJavaType()); } public AccessorFactory create(FaultMetaData fault) { return create(fault.getFaultBean()); } private AccessorFactory create(final Class clazz) { return new AccessorFactory() { public Accessor create(WrappedParameter parameter) { String fieldName = parameter.getVariable(); try { Field field; try { field = clazz.getField(fieldName); } catch (NoSuchFieldException e) { // Search for a private field field = clazz.getDeclaredField(fieldName); field.setAccessible(true); } if (Modifier.isStatic(field.getModifiers())) throw new WSException("Field can not be static: " + fieldName); return new ReflectiveFieldAccessor(field); } catch (Throwable t) { WSException ex = new WSException("Error accessing field: " + fieldName + t.getClass().getSimpleName() + ": " + t.getMessage()); ex.setStackTrace(t.getStackTrace()); throw ex; } } }; } }; private ReflectiveFieldAccessor(Field field) { this.field = field; } public Object get(Object bean) { try { return field.get(bean); } catch (Throwable e) { WSException ex = new WSException(e.getMessage()); ex.setStackTrace(ex.getStackTrace()); throw ex; } } public void set(Object bean, Object value) { try { field.set(bean, value); } catch (Throwable e) { WSException ex = new WSException(e.getMessage()); ex.setStackTrace(ex.getStackTrace()); throw ex; } } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/acessor/JAXBAccessor.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/acessor/JAXBAccesso0000755000175000017500000001005410644464306031400 0ustar godgod/* * 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.metadata.acessor; import javax.xml.bind.JAXBException; import javax.xml.namespace.QName; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxws.JAXBContextFactory; import org.jboss.ws.metadata.umdm.Accessor; import org.jboss.ws.metadata.umdm.AccessorFactory; import org.jboss.ws.metadata.umdm.AccessorFactoryCreator; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import com.sun.xml.bind.api.AccessorException; import com.sun.xml.bind.api.JAXBRIContext; import com.sun.xml.bind.api.RawAccessor; /** * A JAXB object accessor. * * @author Jason T. Greene * @version $Revision: 3828 $ */ @SuppressWarnings("unchecked") public class JAXBAccessor implements Accessor { private RawAccessor accessor; public static AccessorFactoryCreator FACTORY_CREATOR = new AccessorFactoryCreator() { public AccessorFactory create(ParameterMetaData parameter) { return create(parameter.getJavaType()); } public AccessorFactory create(FaultMetaData fault) { return create(fault.getFaultBean()); } private AccessorFactory create(final Class clazz) { final JAXBRIContext ctx = (JAXBRIContext) JAXBContextFactory.newInstance().createContext(clazz); return new AccessorFactory() { public Accessor create(WrappedParameter parameter) { RawAccessor accessor; try { QName name = parameter.getName(); accessor = ctx.getElementPropertyAccessor( clazz, name.getNamespaceURI().intern(), // JAXB internally optimizes String usage towards intern() name.getLocalPart().intern() // see com.sun.xml.bind.v2.util.QNameMap; ); } catch (Throwable t) { WSException ex = new WSException(t.getMessage()); ex.setStackTrace(t.getStackTrace()); throw ex; } if (accessor == null) throw new IllegalStateException("Could not obtain accessor for parameter: " + parameter); return new JAXBAccessor(accessor); } }; } }; private JAXBAccessor(RawAccessor accessor) { this.accessor = accessor; } public Object get(Object bean) { try { return accessor.get(bean); } catch (AccessorException a) { WSException ex = new WSException(a.getMessage()); ex.setStackTrace(a.getStackTrace()); throw ex; } } public void set(Object bean, Object value) { try { accessor.set(bean, value); } catch (AccessorException a) { WSException ex = new WSException(a.getMessage()); ex.setStackTrace(a.getStackTrace()); throw ex; } } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/0000755000175000017500000000000010755000260026733 5ustar godgod././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/WSSecurityConfigFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/WSSecurityConf0000644000175000017500000000756510655560267031603 0ustar godgod/* * 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.metadata.wsse; // $Id: $ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCServerMetaDataBuilder; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; /** * Create a WSSecurityConfiguration * * @author Heiko.Braun@jboss.com * @author Thomas.Diesler@jboss.com */ public class WSSecurityConfigFactory { // provide logging final Logger log = Logger.getLogger(WSSecurityConfigFactory.class); public static WSSecurityConfigFactory newInstance() { return new WSSecurityConfigFactory(); } public WSSecurityConfiguration createConfiguration(UnifiedVirtualFile vfsRoot, String resourceName) throws IOException { URL configLocation = null; try { configLocation = new URL(resourceName); } catch (MalformedURLException ex) { // ignore } if (configLocation == null) configLocation = getResource(vfsRoot, "WEB-INF/" + resourceName, false); if (configLocation == null) configLocation = getResource(vfsRoot, "META-INF/" + resourceName, false); WSSecurityConfiguration config = null; if (configLocation != null) { log.debug("createConfiguration from: " + configLocation); config = WSSecurityOMFactory.newInstance().parse(configLocation); initKeystorePath(vfsRoot, config); } else { // an exception might be better here... log.trace("Unable to load ws-security config ("+resourceName+"). Security processing will be disabled"); } return config; } public void initKeystorePath(UnifiedVirtualFile vfsRoot, WSSecurityConfiguration config) { // Get and set deployment path to the keystore file URL keystoreLocation = null; if (config.getKeyStoreFile() != null) { keystoreLocation = getResource(vfsRoot, config.getKeyStoreFile(), true); log.debug("Add keystore: " + keystoreLocation); config.setKeyStoreURL(keystoreLocation); } URL truststoreLocation = null; if (config.getTrustStoreFile() != null) { truststoreLocation = getResource(vfsRoot, config.getTrustStoreFile(), true); log.debug("Add truststore: " + truststoreLocation); config.setTrustStoreURL(truststoreLocation); } } private URL getResource(UnifiedVirtualFile vfsRoot, String resource, boolean failOnNotFound) { URL resourceURL = null; try { UnifiedVirtualFile child = vfsRoot.findChild(resource); resourceURL = child.toURL(); } catch (IOException ex) { if (failOnNotFound) throw new WSException("Cannot find required security resource: " + resource); } return resourceURL; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Targetable.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Targetable.jav0000644000175000017500000000337210542776150031530 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; import java.util.ArrayList; /** * Targetable is the base class for tags which support target * tags as child elements. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class Targetable implements Serializable { private static final long serialVersionUID = -4034435076127402668L; private ArrayList targets; public ArrayList getTargets() { return targets; } public void setTargets(ArrayList targets) { this.targets = targets; } public void addTarget(Target target) { if (targets == null) targets = new ArrayList(); targets.add(target); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Requires.java0000644000175000017500000000415310560634370031411 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; /** * Requires represents the require tag. * * @author Jason T. Greene * @version $Revision: 2250 $ */ public class Requires implements Serializable { private static final long serialVersionUID = 6899913633295989845L; private RequireTimestamp requireTimestamp; private RequireSignature requireSignature; private RequireEncryption requireEncryption; public RequireEncryption getRequireEncryption() { return requireEncryption; } public void setRequireEncryption(RequireEncryption requireEncryption) { this.requireEncryption = requireEncryption; } public RequireSignature getRequireSignature() { return requireSignature; } public void setRequireSignature(RequireSignature requireSignature) { this.requireSignature = requireSignature; } public RequireTimestamp getRequireTimestamp() { return requireTimestamp; } public void setRequireTimestamp(RequireTimestamp requireTimestamp) { this.requireTimestamp = requireTimestamp; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Sign.java0000644000175000017500000000445410716057127030520 0ustar godgod/* * 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.metadata.wsse; /** * Sign represents the sign tag, which declares that a message * should be signed. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public class Sign extends Targetable { private static final long serialVersionUID = -2645745357707804441L; private String type; private String alias; private boolean includeTimestamp; private String tokenRefType; public Sign(String type, String alias, boolean includeTimestamp, String tokenRefType) { this.type = type; this.alias = alias; this.includeTimestamp = includeTimestamp; this.tokenRefType = tokenRefType; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public String getType() { return type; } public void setType(String type) { this.type = type; } public boolean isIncludeTimestamp() { return includeTimestamp; } public void setIncludeTimestamp(boolean includeTimestamp) { this.includeTimestamp = includeTimestamp; } public String getTokenRefType() { return tokenRefType; } public void setTokenRefType(String tokenRefType) { this.tokenRefType = tokenRefType; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Operation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Operation.java0000644000175000017500000000337110560634370031553 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; /** * Operation represents a wsdl operation. Used to declare per * operation configurations. * * @author Jason T. Greene * @version $Revision: 2250 $ */ public class Operation implements Serializable { private static final long serialVersionUID = 4223295703633326725L; private Config config; private String name; public Operation(String name) { this.name = name; } public Config getConfig() { return config; } public void setConfig(Config config) { this.config = config; } public String getName() { return name; } public void setName(String name) { this.name = name; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/RequireTimestamp.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/RequireTimesta0000644000175000017500000000263710542776150031645 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; public class RequireTimestamp implements Serializable { private static final long serialVersionUID = 278316358447518411L; private String maxAge; public RequireTimestamp(String maxAge) { this.maxAge = maxAge; } public String getMaxAge() { return maxAge; } public void setMaxAge(String maxAge) { this.maxAge = maxAge; } }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Timestamp.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Timestamp.java0000644000175000017500000000256510542776150031565 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; public class Timestamp implements Serializable { private static final long serialVersionUID = 8273360977250180943L; private String ttl; public Timestamp(String ttl) { this.ttl = ttl; } public String getTtl() { return ttl; } public void setTtl(String ttl) { this.ttl = ttl; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Config.java0000644000175000017500000000427010560634370031017 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; /** * Config represents the config tag. * * @author Jason T. Greene * @version $Revision: 2250 $ */ public class Config implements Serializable { private static final long serialVersionUID = 4219543242657899910L; private Timestamp timestamp; private Username username; private Sign sign; private Encrypt encrypt; private Requires requires; public Encrypt getEncrypt() { return encrypt; } public void setEncrypt(Encrypt encrypt) { this.encrypt = encrypt; } public Sign getSign() { return sign; } public void setSign(Sign sign) { this.sign = sign; } public Timestamp getTimestamp() { return timestamp; } public void setTimestamp(Timestamp timestamp) { this.timestamp = timestamp; } public Username getUsername() { return username; } public void setUsername(Username username) { this.username = username; } public Requires getRequires() { return requires; } public void setRequires(Requires requires) { this.requires = requires; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Port.java0000644000175000017500000000430410560634370030534 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; import java.util.HashMap; /** * Port represents a per wsdl port configuration for a * security configuration. * * @author Jason T. Greene * @version $Revision: 2250 $ */ public class Port implements Serializable { private static final long serialVersionUID = 8294850341855208663L; private String name; private Config defaultConfig; private HashMap operations = new HashMap(); public Port(String name) { this.name = name; } public Config getDefaultConfig() { return defaultConfig; } public void setDefaultConfig(Config defaultConfig) { this.defaultConfig = defaultConfig; } public HashMap getOperations() { return operations; } public void setOperations(HashMap operations) { this.operations = operations; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void addOperation(Operation operation) { operations.put(operation.getName(), operation); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/WSSecurityOMFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/WSSecurityOMFa0000644000175000017500000004113210716057127031456 0ustar godgod/* * 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.metadata.wsse; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.net.URL; import java.util.HashMap; import org.jboss.logging.Logger; import org.jboss.ws.core.utils.ResourceURL; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; /** * A JBossXB Object Model Factory that represets a JBoss WS-Security * configuration. See the jboss-ws-security_1_0.xsd file for more info. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public class WSSecurityOMFactory implements ObjectModelFactory { public static String SERVER_RESOURCE_NAME = "jboss-wsse-server.xml"; public static String CLIENT_RESOURCE_NAME = "jboss-wsse-client.xml"; private static HashMap options = new HashMap(6); static { options.put("key-store-file", "setKeyStoreFile"); options.put("key-store-type", "setKeyStoreType"); options.put("key-store-password", "setKeyStorePassword"); options.put("trust-store-file", "setTrustStoreFile"); options.put("trust-store-type", "setTrustStoreType"); options.put("trust-store-password", "setTrustStorePassword"); } // provide logging private static final Logger log = Logger.getLogger(WSSecurityOMFactory.class); // Hide constructor private WSSecurityOMFactory() { } /** * Create a new instance of a jaxrpc-mapping factory */ public static WSSecurityOMFactory newInstance() { return new WSSecurityOMFactory(); } public WSSecurityConfiguration parse(URL configURL) throws IOException { if (configURL == null) throw new IllegalArgumentException("Security config URL cannot be null"); InputStream is = new ResourceURL(configURL).openStream(); try { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); WSSecurityConfiguration configuration = (WSSecurityConfiguration)unmarshaller.unmarshal(is, this, null); return configuration; } catch (JBossXBException e) { IOException ioex = new IOException("Cannot parse: " + configURL); Throwable cause = e.getCause(); if (cause != null) ioex.initCause(cause); throw ioex; } finally { is.close(); } } public WSSecurityConfiguration parse(String xmlString) throws JBossXBException { if (xmlString == null) throw new IllegalArgumentException("Security config xml String cannot be null"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); WSSecurityConfiguration configuration = (WSSecurityConfiguration)unmarshaller.unmarshal(xmlString, this, null); return configuration; } public WSSecurityConfiguration parse(StringReader strReader) throws JBossXBException { if (strReader == null) throw new IllegalArgumentException("Security InputStream cannot be null"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); WSSecurityConfiguration configuration = (WSSecurityConfiguration)unmarshaller.unmarshal(strReader, this, null); return configuration; } /** * This method is called on the factory by the object model builder when the * parsing starts. */ public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return new WSSecurityConfiguration(); } public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name) { return root; } public void setValue(WSSecurityConfiguration configuration, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + configuration + ",value=" + value + "]"); String method = (String)options.get(localName); if (method == null) return; // Dispatch to propper initializer try { WSSecurityConfiguration.class.getMethod(method, new Class[] { String.class }).invoke(configuration, new Object[] { value }); } catch (Exception e) { log.error("Could not set option: " + method + " to: " + value, e); } } /** * Called when parsing of a new element started. */ public Object newChild(WSSecurityConfiguration configuration, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("config".equals(localName)) { return new Config(); } if ("key-passwords".equals(localName)) { HashMap pwds = new HashMap(); configuration.setKeyPasswords(pwds); return pwds; } if ("port".equals(localName)) { return new Port(attrs.getValue("", "name")); } return null; } /** * Called when parsing the contents of the tag. */ public Object newChild(HashMap passwords, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("key-password".equals(localName)) { String alias = attrs.getValue("", "alias"); String pwd = attrs.getValue("", "password"); passwords.put(alias, pwd); } return null; } /** * Called when parsing character is complete. */ public void addChild(WSSecurityConfiguration configuration, Config defaultConfig, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + configuration + ",child=" + defaultConfig + "]"); configuration.setDefaultConfig(defaultConfig); } /** * Called when parsing character is complete. */ public void addChild(WSSecurityConfiguration configuration, Port port, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + configuration + ",child=" + port + "]"); configuration.addPort(port); } /** * Called when parsing of a new element started. */ public Object newChild(Config config, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("sign".equals(localName)) { // By default, we alwyas include a timestamp Boolean include = new Boolean(true); String timestamp = attrs.getValue("", "includeTimestamp"); if (timestamp != null) include = (Boolean)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_BOOLEAN_NAME, timestamp, null); return new Sign(attrs.getValue("", "type"), attrs.getValue("", "alias"), include.booleanValue(), attrs.getValue("", "tokenReference")); } else if ("encrypt".equals(localName)) { return new Encrypt(attrs.getValue("", "type"), attrs.getValue("", "alias"), attrs.getValue("", "algorithm"), attrs.getValue("", "keyWrapAlgorithm"), attrs.getValue("", "tokenReference")); } else if ("timestamp".equals(localName)) { return new Timestamp(attrs.getValue("", "ttl")); } else if ("requires".equals(localName)) { return new Requires(); } else if ("username".equals(localName)) { return new Username(); } return null; } /** * Called when parsing character is complete. */ public void addChild(Config config, Encrypt encrypt, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + config + ",child=" + encrypt + "]"); config.setEncrypt(encrypt); } /** * Called when parsing character is complete. */ public void addChild(Config config, Sign sign, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + config + ",child=" + sign + "]"); config.setSign(sign); } /** * Called when parsing character is complete. */ public void addChild(Config config, Timestamp timestamp, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + config + ",child=" + timestamp + "]"); config.setTimestamp(timestamp); } /** * Called when parsing character is complete. */ public void addChild(Config config, Username username, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + config + ",child=" + username + "]"); config.setUsername(username); } /** * Called when parsing character is complete. */ public void addChild(Config config, Requires requires, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + config + ",child=" + requires + "]"); config.setRequires(requires); } private Object handleTargets(Object object, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("target".equals(localName)) { Target target = new Target(attrs.getValue("", "type")); if ("true".equals(attrs.getValue("", "contentOnly"))) target.setContentOnly(true); return target; } return null; } /** * Called when parsing of a new element started. */ public Object newChild(Encrypt encrypt, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return handleTargets(encrypt, navigator, namespaceURI, localName, attrs); } /** * Called when parsing of a new element started. */ public Object newChild(Sign sign, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return handleTargets(sign, navigator, namespaceURI, localName, attrs); } /** * Called when parsing of a new element started. */ public Object newChild(Requires requires, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("signature".equals(localName)) { return new RequireSignature(); } else if ("encryption".equals(localName)) { return new RequireEncryption(); } else if ("timestamp".equals(localName)) { return new RequireTimestamp(attrs.getValue("", "maxAge")); } return null; } /** * Called when parsing of a new element started. */ public Object newChild(RequireSignature requireSignature, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return handleTargets(requireSignature, navigator, namespaceURI, localName, attrs); } /** * Called when parsing of a new element started. */ public Object newChild(RequireEncryption requireEncryption, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return handleTargets(requireEncryption, navigator, namespaceURI, localName, attrs); } public void setValue(Target target, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + target + ",value=" + value + "]"); target.setValue(value); } /** * Called when parsing character is complete. */ public void addChild(Encrypt encrypt, Target target, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + encrypt + ",child=" + target + "]"); encrypt.addTarget(target); } /** * Called when parsing character is complete. */ public void addChild(Sign sign, Target target, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + sign + ",child=" + target + "]"); sign.addTarget(target); } /** * Called when parsing character is complete. */ public void addChild(Requires requires, RequireEncryption requireEncryption, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + requires + ",child=" + requireEncryption + "]"); requires.setRequireEncryption(requireEncryption); } /** * Called when parsing character is complete. */ public void addChild(Requires requires, RequireSignature requireSignature, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + requires + ",child=" + requireSignature + "]"); requires.setRequireSignature(requireSignature); } /** * Called when parsing character is complete. */ public void addChild(Requires requires, RequireTimestamp requireTimestamp, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + requires + ",child=" + requireTimestamp + "]"); requires.setRequireTimestamp(requireTimestamp); } /** * Called when parsing character is complete. */ public void addChild(RequireEncryption requireEncryption, Target target, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + requireEncryption + ",child=" + target + "]"); requireEncryption.addTarget(target); } /** * Called when parsing character is complete. */ public void addChild(RequireSignature requireSignature, Target target, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + requireSignature + ",child=" + target + "]"); requireSignature.addTarget(target); } /** * Called when parsing of a new element started. */ public Object newChild(Port port, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("operation".equals(localName)) { return new Operation(attrs.getValue("", "name")); } else if ("config".equals(localName)) { return new Config(); } return null; } /** * Called when parsing character is complete. */ public void addChild(Port port, Operation operation, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + port + ",child=" + operation + "]"); port.addOperation(operation); } /** * Called when parsing character is complete. */ public void addChild(Port port, Config config, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + port + ",child=" + config + "]"); port.setDefaultConfig(config); } /** * Called when parsing of a new element started. */ public Object newChild(Operation operation, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("config".equals(localName)) { return new Config(); } return null; } /** * Called when parsing character is complete. */ public void addChild(Operation operation, Config config, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + operation + ",child=" + config + "]"); operation.setConfig(config); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/WSSecurityConfiguration.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/WSSecurityConf0000644000175000017500000000771510642000211031546 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; import java.net.URL; import java.util.HashMap; /** * Root configuration class, represents the "jboss-ws-security" tag. * * @author Jason T. Greene * @version $Revision: 3772 $ */ public class WSSecurityConfiguration implements Serializable { private static final long serialVersionUID = 1022564645797303076L; private Config defaultConfig; private HashMap ports = new HashMap(); private String keyStoreFile; private URL keyStoreURL; private String keyStoreType; private String keyStorePassword; private String trustStoreFile; private URL trustStoreURL; private String trustStoreType; private String trustStorePassword; private HashMap keyPasswords = new HashMap(); public WSSecurityConfiguration() { } public Config getDefaultConfig() { return defaultConfig; } public void setDefaultConfig(Config defaultConfig) { this.defaultConfig = defaultConfig; } public HashMap getPorts() { return ports; } public void setPorts(HashMap ports) { this.ports = ports; } public String getKeyStoreFile() { return keyStoreFile; } public void setKeyStoreFile(String keyStoreFile) { this.keyStoreFile = keyStoreFile; } public URL getKeyStoreURL() { return keyStoreURL; } public void setKeyStoreURL(URL keyStoreURL) { this.keyStoreURL = keyStoreURL; } public void addPort(Port port) { this.ports.put(port.getName(), port); } public String getKeyStorePassword() { return keyStorePassword; } public void setKeyStorePassword(String keyStorePassword) { this.keyStorePassword = keyStorePassword; } public String getKeyStoreType() { return keyStoreType; } public void setKeyStoreType(String keyStoreType) { this.keyStoreType = keyStoreType; } public String getTrustStorePassword() { return trustStorePassword; } public void setTrustStorePassword(String trustStorePassword) { this.trustStorePassword = trustStorePassword; } public String getTrustStoreType() { return trustStoreType; } public void setTrustStoreType(String trustStoreType) { this.trustStoreType = trustStoreType; } public URL getTrustStoreURL() { return trustStoreURL; } public void setTrustStoreURL(URL trustStoreURL) { this.trustStoreURL = trustStoreURL; } public String getTrustStoreFile() { return trustStoreFile; } public void setTrustStoreFile(String trustStoreFile) { this.trustStoreFile = trustStoreFile; } public HashMap getKeyPasswords() { return keyPasswords; } public void setKeyPasswords(HashMap keyPasswords) { this.keyPasswords = keyPasswords; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Username.java0000644000175000017500000000223610542776150031374 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; public class Username implements Serializable { private static final long serialVersionUID = 8273360977250180943L; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Encrypt.java0000644000175000017500000000502710716057127031241 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; /** * Encrypt represents the encrypt tag, which signifies that the * message should be encrypted. * * @author Jason T. Greene * @version $Revision: 5034 $ */ public class Encrypt extends Targetable implements Serializable { private static final long serialVersionUID = -2802677183149218760L; private String type; private String alias; private String algorithm; private String keyWrapAlgorithm; private String tokenRefType; public Encrypt(String type, String alias, String algorithm, String wrap, String tokenRefType) { this.type = type; this.alias = alias; this.algorithm = algorithm; this.keyWrapAlgorithm = wrap; this.tokenRefType = tokenRefType; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getAlgorithm() { return algorithm; } public void setAlgorithm(String algorithm) { this.algorithm = algorithm; } public String getWrap() { return keyWrapAlgorithm; } public void setWrap(String wrap) { this.keyWrapAlgorithm = wrap; } public String getTokenRefType() { return tokenRefType; } public void setTokenRefType(String tokenRefType) { this.tokenRefType = tokenRefType; } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/Target.java0000644000175000017500000000360210542776150031041 0ustar godgod/* * 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.metadata.wsse; import java.io.Serializable; /** * Target represents the target tag. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class Target implements Serializable { private static final long serialVersionUID = 5718485529854012480L; private String type; private String value; private boolean contentOnly; public Target(String type) { this.type = type; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public boolean isContentOnly() { return contentOnly; } public void setContentOnly(boolean contentOnly) { this.contentOnly = contentOnly; } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/RequireEncryption.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/RequireEncrypt0000644000175000017500000000252410542776150031656 0ustar godgod/* * 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.metadata.wsse; /** * Sign represents the sign tag, which declares that a message * should be signed. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class RequireEncryption extends Targetable { private static final long serialVersionUID = 3765798680988205647L; } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/RequireSignature.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsse/RequireSignatu0000644000175000017500000000252410542776150031644 0ustar godgod/* * 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.metadata.wsse; /** * Sign represents the sign tag, which declares that a message * should be signed. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class RequireSignature extends Targetable { private static final long serialVersionUID = -3854930944550152309L; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/0000755000175000017500000000000010755000260026714 5ustar godgod././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ServerEndpoint0000644000175000017500000001717710652335426031636 0ustar godgod/* * 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.metadata.umdm; // $Id: ServerEndpointMetaData.java 4020 2007-07-27 09:29:58Z thomas.diesler@jboss.com $ import org.jboss.logging.Logger; import org.jboss.ws.metadata.config.ConfigurationProvider; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import org.jboss.wsf.spi.binding.BindingCustomization; import javax.management.ObjectName; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Collection; import java.util.List; /** * Client side endpoint meta data. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 12-May-2005 */ public class ServerEndpointMetaData extends EndpointMetaData { protected static final Logger log = Logger.getLogger(ServerEndpointMetaData.class); public static final String SEPID_DOMAIN = "jboss.ws"; public static final String SEPID_PROPERTY_CONTEXT = "context"; public static final String SEPID_PROPERTY_ENDPOINT = "endpoint"; // The associated SPI endpoint private Endpoint endpoint; // The REQUIRED link name private String linkName; // Legacy JSR-109 port component name private String portComponentName; // The endpoint implementation bean private String implName; // The unique service endpointID private ObjectName sepID; // The HTTP context root private String contextRoot; // The HTTP virtual hosts private String[] virtualHosts; // The HTTP url parttern private String urlPattern; // The optional transport guarantee private String transportGuarantee; // The optional secure wsdl access private boolean secureWSDLAccess; public ServerEndpointMetaData(ServiceMetaData service, Endpoint endpoint, QName portName, QName portTypeName, Type type) { super(service, portName, portTypeName, type); this.endpoint = endpoint; super.configName = ConfigurationProvider.DEFAULT_ENDPOINT_CONFIG_NAME; if (type == Type.JAXRPC) configFile = ConfigurationProvider.DEFAULT_JAXRPC_ENDPOINT_CONFIG_FILE; else configFile = ConfigurationProvider.DEFAULT_JAXWS_ENDPOINT_CONFIG_FILE; } public Endpoint getEndpoint() { return endpoint; } public void setEndpoint(Endpoint endpoint) { this.endpoint = endpoint; } public String getLinkName() { return linkName; } public void setLinkName(String linkName) { this.linkName = linkName; } public String getPortComponentName() { return portComponentName; } public void setPortComponentName(String portComponentName) { this.portComponentName = portComponentName; } public String getServiceEndpointImplName() { return implName; } public void setServiceEndpointImplName(String endpointImpl) { this.implName = endpointImpl; } public ObjectName getServiceEndpointID() { return sepID; } public void setServiceEndpointID(ObjectName endpointID) { this.sepID = endpointID; } public String[] getVirtualHosts() { return virtualHosts; } public void setVirtualHosts(String[] virtualHosts) { this.virtualHosts = virtualHosts; } public String getContextRoot() { return contextRoot; } public void setContextRoot(String contextRoot) { if (contextRoot != null && !(contextRoot.startsWith("/"))) throw new IllegalArgumentException("context root should start with '/'"); this.contextRoot = contextRoot; } public String getURLPattern() { return urlPattern; } public void setURLPattern(String urlPattern) { if (urlPattern != null && !urlPattern.startsWith("/")) throw new IllegalArgumentException("URL pattern should start with '/'"); this.urlPattern = urlPattern; } public String getTransportGuarantee() { return transportGuarantee; } public void setTransportGuarantee(String transportGuarantee) { this.transportGuarantee = transportGuarantee; } public boolean isSecureWSDLAccess() { return secureWSDLAccess; } public void setSecureWSDLAccess(boolean secureWSDLAccess) { this.secureWSDLAccess = secureWSDLAccess; } @Override public String getEndpointAddress() { return endpoint != null ? endpoint.getAddress() : null; } @Override public void setEndpointAddress(String endpointAddress) { if (endpoint == null) throw new IllegalStateException("Endpoint not available"); endpoint.setAddress(endpointAddress); } /** * Will be set through a deployment aspect * @return List of available customizations */ public Collection getBindingCustomizations() { List list = new ArrayList(); for (Object att : endpoint.getAttachments()) { if (att instanceof BindingCustomization) list.add((BindingCustomization)att); } return list; } public String toString() { StringBuilder buffer = new StringBuilder("\nServerEndpointMetaData:"); buffer.append("\n type=").append(getType()); buffer.append("\n qname=").append(getPortName()); buffer.append("\n id=").append(getServiceEndpointID().getCanonicalName()); buffer.append("\n address=").append(getEndpointAddress()); buffer.append("\n binding=").append(getBindingId()); buffer.append("\n linkName=").append(getLinkName()); buffer.append("\n implName=").append(getServiceEndpointImplName()); buffer.append("\n seiName=").append(getServiceEndpointInterfaceName()); buffer.append("\n serviceMode=").append(getServiceMode()); buffer.append("\n portComponentName=").append(getPortComponentName()); buffer.append("\n contextRoot=").append(getContextRoot()); buffer.append("\n urlPattern=").append(getURLPattern()); buffer.append("\n configFile=").append(getConfigFile()); buffer.append("\n configName=").append(getConfigName()); buffer.append("\n authMethod=").append(getAuthMethod()); buffer.append("\n transportGuarantee=").append(getTransportGuarantee()); buffer.append("\n secureWSDLAccess=").append(isSecureWSDLAccess()); buffer.append("\n properties=").append(getProperties()); for (OperationMetaData opMetaData : getOperations()) { buffer.append("\n").append(opMetaData); } for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL)) { buffer.append("\n").append(hdlMetaData); } return buffer.toString(); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/OperationMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/OperationMetaD0000644000175000017500000003566710743173754031553 0ustar godgod/* * 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.metadata.umdm; // $Id: OperationMetaData.java 5471 2008-01-15 18:14:04Z alessio.soldano@jboss.com $ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.soap.Use; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.wsf.common.JavaUtils; import org.w3c.dom.Element; /** * An Operation component describes an operation that a given interface supports. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 12-May-2004 */ public class OperationMetaData extends ExtensibleMetaData { // provide logging private final Logger log = Logger.getLogger(OperationMetaData.class); // The parent interface private EndpointMetaData epMetaData; private QName qname; private QName responseName; private String javaName; private Method javaMethod; private boolean oneWay; private String soapAction; private ParameterStyle parameterStyle; private List parameters = new ArrayList(); private List faults = new ArrayList(); private ParameterMetaData returnParam; private String documentation; public OperationMetaData(EndpointMetaData epMetaData, QName qname, String javaName) { log.trace("new OperationMetaData: [xmlName=" + qname + ",javaName=" + javaName + "]"); initOperationMetaData(epMetaData, qname, javaName); } private void initOperationMetaData(EndpointMetaData epMetaData, QName qname, String javaName) { this.epMetaData = epMetaData; this.qname = qname; this.javaName = javaName; if (qname == null) throw new IllegalArgumentException("Invalid null qname argument"); if (javaName == null) throw new IllegalArgumentException("Invalid null javaName argument, for: " + qname); String nsURI = qname.getNamespaceURI(); String localPart = qname.getLocalPart(); this.responseName = new QName(nsURI, localPart + "Response"); } public EndpointMetaData getEndpointMetaData() { return epMetaData; } public QName getQName() { return qname; } public QName getResponseName() { return responseName; } public String getSOAPAction() { return soapAction; } public void setSOAPAction(String soapAction) { this.soapAction = soapAction; } public Style getStyle() { return epMetaData.getStyle(); } public Use getUse() { return epMetaData.getEncodingStyle(); } public ParameterStyle getParameterStyle() { return (parameterStyle != null) ? parameterStyle : epMetaData.getParameterStyle(); } public void setParameterStyle(ParameterStyle parameterStyle) { this.parameterStyle = parameterStyle; } public boolean isRPCLiteral() { return getStyle() == Style.RPC && getUse() == Use.LITERAL; } public boolean isRPCEncoded() { return getStyle() == Style.RPC && getUse() == Use.ENCODED; } public boolean isDocumentBare() { return getStyle() == Style.DOCUMENT && getParameterStyle() == ParameterStyle.BARE; } public boolean isDocumentWrapped() { return getStyle() == Style.DOCUMENT && getParameterStyle() == ParameterStyle.WRAPPED; } public String getJavaName() { return javaName; } public Method getJavaMethod() { Method tmpMethod = javaMethod; Class seiClass = epMetaData.getServiceEndpointInterface(); if (tmpMethod == null && seiClass != null) { for (Method method : seiClass.getMethods()) { if (isJavaMethod(method)) { tmpMethod = method; UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData(); if (wsMetaData.isEagerInitialized()) { if (UnifiedMetaData.isFinalRelease() == false) log.warn("Loading java method after eager initialization", new IllegalStateException()); javaMethod = method; } break; } } if ((tmpMethod == null) && (epMetaData.getConfig().getRMMetaData() == null)) // RM hack throw new WSException("Cannot find java method: " + javaName); } return tmpMethod; } public boolean isJavaMethod(Method method) { boolean isJavaMethod = method.equals(javaMethod); if (isJavaMethod == false) { String methodName = method.getName(); if (javaName.equals(methodName)) { log.trace("Found java method: " + method); // compare params by java type name if (matchParameters(method, true)) { if(log.isDebugEnabled()) log.debug("Found best matching java method: " + method); isJavaMethod = true; } // compare params by assignability if (!isJavaMethod && matchParameters(method, false)) { if(log.isDebugEnabled()) log.debug("Found possible matching java method: " + method); isJavaMethod = true; } } } if (log.isTraceEnabled()) log.trace("Synchronized java method:\n" + method + "\nwith: " + toString()); return isJavaMethod; } private boolean matchParameters(Method method, boolean exact) { Class[] paramTypes = method.getParameterTypes(); Set matches = new HashSet(paramTypes.length); for (ParameterMetaData param : getParameters()) { if (!param.matchParameter(method, matches, exact)) return false; } ParameterMetaData returnMetaData = getReturnParameter(); if (returnMetaData != null && !returnMetaData.matchParameter(method, matches, exact)) return false; // We should have an entry for every parameter index if we match return matches.size() == paramTypes.length; } /** Return true if this is a generic message style destination that takes a org.w3c.dom.Element */ public boolean isMessageEndpoint() { boolean isMessageEndpoint = false; if (parameters.size() == 1) { ParameterMetaData inParam = parameters.get(0); if (JavaUtils.isAssignableFrom(Element.class, inParam.getJavaType())) { isMessageEndpoint = true; } } return isMessageEndpoint; } public boolean isOneWay() { return oneWay; } public void setOneWay(boolean oneWay) { this.oneWay = oneWay; assertOneWayOperation(); } public ParameterMetaData getParameter(QName xmlName) { ParameterMetaData paramMetaData = null; for (int i = 0; paramMetaData == null && i < parameters.size(); i++) { ParameterMetaData aux = parameters.get(i); if (xmlName.equals(aux.getXmlName())) paramMetaData = aux; } return paramMetaData; } /** Get the IN or INOUT parameter list */ public List getInputParameters() { List retList = new ArrayList(); for (ParameterMetaData paramMetaData : parameters) { ParameterMode mode = paramMetaData.getMode(); if (mode == ParameterMode.IN || mode == ParameterMode.INOUT) retList.add(paramMetaData); } return retList; } /** Get the OUT or INOUT parameter list */ public List getOutputParameters() { List retList = new ArrayList(); for (ParameterMetaData paramMetaData : parameters) { ParameterMode mode = paramMetaData.getMode(); if (mode == ParameterMode.OUT || mode == ParameterMode.INOUT) retList.add(paramMetaData); } return retList; } /** Get the non header parameter list */ public List getNonHeaderParameters() { List retList = new ArrayList(); for (ParameterMetaData paramMetaData : parameters) { if (paramMetaData.isInHeader() == false) retList.add(paramMetaData); } return retList; } public List getParameters() { return new ArrayList(parameters); } public void addParameter(ParameterMetaData pmd) { log.trace("addParameter: [xmlName=" + pmd.getXmlName() + ",xmlType=" + pmd.getXmlType() + "]"); parameters.add(pmd); assertOneWayOperation(); } public void removeAllParameters() { parameters.clear(); } public ParameterMetaData getReturnParameter() { return returnParam; } public void setReturnParameter(ParameterMetaData returnParam) { log.trace("setReturnParameter: " + returnParam); returnParam.setMode(ParameterMode.OUT); returnParam.setIndex(-1); this.returnParam = returnParam; assertOneWayOperation(); } public List getFaults() { return new ArrayList(faults); } public FaultMetaData getFault(QName xmlName) { FaultMetaData faultMetaData = null; for (int i = 0; faultMetaData == null && i < faults.size(); i++) { FaultMetaData aux = faults.get(i); if (aux.getXmlName().equals(xmlName)) faultMetaData = aux; } return faultMetaData; } public FaultMetaData getFaultMetaData(Class javaType) { FaultMetaData faultMetaData = null; for (FaultMetaData aux : faults) { if (aux.getJavaType().equals(javaType)) { faultMetaData = aux; break; } } return faultMetaData; } public void addFault(FaultMetaData fault) { log.trace("addFault: " + fault); faults.add(fault); assertOneWayOperation(); } // A JSR-181 processor is REQUIRED to report an error if an // operation marked @Oneway has a return value, declares any checked exceptions or has any // INOUT or OUT parameters. private void assertOneWayOperation() { if (oneWay) { if (returnParam != null) throw new WSException("OneWay operations cannot have a return parameter"); if (faults.size() > 0) throw new WSException("OneWay operations cannot have checked exceptions"); for (ParameterMetaData paramMetaData : parameters) { if (paramMetaData.getMode() != ParameterMode.IN) throw new WSException("OneWay operations cannot have INOUT or OUT parameters"); } } } public void assertDocumentBare() { if (isDocumentBare()) { int in = 0; int out = 0; for (ParameterMetaData paramMetaData : parameters) { if (paramMetaData.isInHeader()) continue; ParameterMode mode = paramMetaData.getMode(); if (mode != ParameterMode.OUT) in++; if (mode != ParameterMode.IN) out++; } if (returnParam != null && !returnParam.isInHeader()) out++; if (in > 1 || out > (oneWay ? 0 : 1)) throw new WSException("The body of a document/literal bare message requires at most 1 input and at most 1 output (or 0 if oneway). method: " + javaName + " in: " + in + " out: " + out); } } public void validate() { for (ParameterMetaData parameter : parameters) parameter.validate(); for (FaultMetaData fault : faults) fault.validate(); } /** * @see UnifiedMetaData#eagerInitialize() */ public void eagerInitialize(List unsynchronizedMethods) { // reset java method javaMethod = null; for (ParameterMetaData parameter : parameters) parameter.eagerInitialize(); if (returnParam != null) returnParam.eagerInitialize(); for (FaultMetaData fault : faults) fault.eagerInitialize(); // Method initialization for (Method method : unsynchronizedMethods) { if (isJavaMethod(method)) { javaMethod = method; break; } } // Report unsynchronized java method boolean isRMMethod = RMProvider.get().getConstants().getNamespaceURI().equals(qname.getNamespaceURI()); if ((javaMethod == null) && (isRMMethod == false)) // RM hack { StringBuilder errMsg = new StringBuilder("Cannot synchronize to any of these methods:"); for (Method method : unsynchronizedMethods) { errMsg.append("\n" + method); } errMsg.append("\n" + toString()); throw new IllegalStateException(errMsg.toString()); } } public String toString() { StringBuilder buffer = new StringBuilder("\nOperationMetaData:"); buffer.append("\n qname=" + qname); buffer.append("\n javaName=" + javaName); buffer.append("\n style=" + getStyle() + "/" + getUse()); if (getStyle() == Style.DOCUMENT) { buffer.append("/" + getParameterStyle()); } buffer.append("\n oneWay=" + oneWay); buffer.append("\n soapAction=" + soapAction); for (ParameterMetaData param : parameters) { buffer.append(param); } if (returnParam != null) { buffer.append(returnParam.toString()); } for (FaultMetaData fault : faults) { buffer.append(fault); } return buffer.toString(); } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ServiceMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ServiceMetaDat0000644000175000017500000003267610654066746031540 0ustar godgod/* * 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.metadata.umdm; // $Id: ServiceMetaData.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; import javax.xml.namespace.QName; import javax.xml.rpc.encoding.TypeMappingRegistry; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl; import org.jboss.ws.core.jaxrpc.binding.jbossxb.SchemaBindingBuilder; import org.jboss.ws.core.soap.Use; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLTypes; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; /** * A Service component describes a set of endpoints. * * @author Thomas.Diesler@jboss.org * @since 12-May-2005 */ public class ServiceMetaData { // provide logging private static final Logger log = Logger.getLogger(ServiceMetaData.class); // The parent meta data. private UnifiedMetaData wsMetaData; // The service endpoints private Map endpoints = new LinkedHashMap(); private QName serviceName; private String serviceRefName; private String wsdName; private URL wsdlLocation; private String wsdlFile; private URL mappingLocation; private String wsdlPublishLocation; // The optional service handlers private List handlers = new ArrayList(); // The type mapping that is maintained by this service private TypesMetaData types; private TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl(); private SchemaBinding schemaBinding; // Arbitrary properties given by private Properties properties; // derived cached encoding style private Use encStyle; // The security configuration private WSSecurityConfiguration securityConfig; // The key to the wsdl cache private String wsdlCacheKey; public ServiceMetaData(UnifiedMetaData wsMetaData, QName serviceName) { this.wsMetaData = wsMetaData; this.serviceName = serviceName; this.types = new TypesMetaData(this); } public UnifiedMetaData getUnifiedMetaData() { return wsMetaData; } public void setServiceName(QName serviceName) { this.serviceName = serviceName; } public QName getServiceName() { return serviceName; } public String getServiceRefName() { return serviceRefName; } public void setServiceRefName(String serviceRefName) { this.serviceRefName = serviceRefName; } public String getWebserviceDescriptionName() { return wsdName; } public void setWebserviceDescriptionName(String wsdName) { this.wsdName = wsdName; } public String getWsdlFile() { return wsdlFile; } public void setWsdlFile(String wsdlFile) { this.wsdlFile = wsdlFile; } public URL getWsdlLocation() { return wsdlLocation; } public void setWsdlLocation(URL wsdlLocation) { this.wsdlLocation = wsdlLocation; } public String getWsdlPublishLocation() { return wsdlPublishLocation; } public void setWsdlPublishLocation(String wsdlPublishLocation) { this.wsdlPublishLocation = wsdlPublishLocation; } public Properties getProperties() { return properties; } public void setProperties(Properties properties) { this.properties = properties; } public TypesMetaData getTypesMetaData() { return types; } public void addHandler(HandlerMetaDataJAXWS handler) { handlers.add(handler); } public List getHandlerMetaData() { return Collections.unmodifiableList(handlers); } public List getEndpoints() { return new ArrayList(endpoints.values()); } public EndpointMetaData getEndpoint(QName portName) { return endpoints.get(portName); } public EndpointMetaData removeEndpoint(QName portName) { return endpoints.remove(portName); } public EndpointMetaData getEndpointByServiceEndpointInterface(String seiName) { EndpointMetaData epMetaData = null; for (EndpointMetaData epmd : endpoints.values()) { if (seiName.equals(epmd.getServiceEndpointInterfaceName())) { if (epMetaData != null) { // The CTS uses Service.getPort(Class) with multiple endpoints implementing the same SEI log.warn("Multiple possible endpoints implementing SEI: " + seiName); } epMetaData = epmd; } } return epMetaData; } public void addEndpoint(EndpointMetaData epMetaData) { QName portName = epMetaData.getPortName(); // This happends when we have multiple port components in sharing the same wsdl port // The EndpointMetaData name is the wsdl port, so we cannot have multiple meta data for the same port. if (endpoints.get(portName) != null) throw new WSException("EndpointMetaData name must be unique: " + portName); endpoints.put(portName, epMetaData); } public URL getMappingLocation() { return mappingLocation; } public void setMappingLocation(URL mappingLocation) { this.mappingLocation = mappingLocation; } public JavaWsdlMapping getJavaWsdlMapping() { JavaWsdlMapping javaWsdlMapping = null; if (mappingLocation != null) { javaWsdlMapping = (JavaWsdlMapping)wsMetaData.getMappingDefinition(mappingLocation.toExternalForm()); if (javaWsdlMapping == null) { try { JavaWsdlMappingFactory mappingFactory = JavaWsdlMappingFactory.newInstance(); javaWsdlMapping = mappingFactory.parse(mappingLocation); wsMetaData.addMappingDefinition(mappingLocation.toExternalForm(), javaWsdlMapping); } catch (IOException e) { throw new WSException("Cannot parse jaxrpc-mapping.xml", e); } } } return javaWsdlMapping; } /** * Get the wsdl definition that corresponds to the wsdl-file element. */ public WSDLDefinitions getWsdlDefinitions() { URL wsdlURL = wsdlLocation; if (wsdlURL == null && wsdlFile != null) { // Try wsdlFile as URL try { wsdlURL = new URL(wsdlFile); } catch (MalformedURLException e) { // ignore } // Try wsdlFile as child from root if (wsdlURL == null) { try { UnifiedVirtualFile vfsRoot = getUnifiedMetaData().getRootFile(); wsdlURL = vfsRoot.findChild(wsdlFile).toURL(); } catch (IOException ex) { throw new IllegalStateException("Cannot find wsdl: " + wsdlFile); } } } WSDLDefinitions wsdlDefinitions = null; if (wsdlURL != null) { // The key should not after it is assigned if (wsdlCacheKey == null) wsdlCacheKey = "#" + (wsdlLocation != null ? wsdlLocation : wsdlFile); wsdlDefinitions = (WSDLDefinitions)wsMetaData.getWsdlDefinition(wsdlCacheKey); if (wsdlDefinitions == null) { WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance(); wsdlDefinitions = factory.parse(wsdlURL); wsMetaData.addWsdlDefinition(wsdlCacheKey, wsdlDefinitions); } } return wsdlDefinitions; } public TypeMappingImpl getTypeMapping() { Use encStyle = getEncodingStyle(); TypeMappingImpl typeMapping = (TypeMappingImpl)tmRegistry.getTypeMapping(encStyle.toURI()); if (typeMapping == null) throw new WSException("No type mapping for encoding style: " + encStyle); return typeMapping; } public WSSecurityConfiguration getSecurityConfiguration() { return securityConfig; } public void setSecurityConfiguration(WSSecurityConfiguration securityConfiguration) { this.securityConfig = securityConfiguration; } public Use getEncodingStyle() { if (encStyle == null) { if (endpoints.size() > 0) { for (EndpointMetaData epMetaData : endpoints.values()) { if (encStyle == null) { encStyle = epMetaData.getEncodingStyle(); } else if (encStyle.equals(epMetaData.getEncodingStyle()) == false) { throw new WSException("Conflicting encoding styles not supported"); } } } else { encStyle = Use.LITERAL; } } return encStyle; } public SchemaBinding getSchemaBinding() { JavaWsdlMapping wsdlMapping = getJavaWsdlMapping(); if (schemaBinding == null && getEncodingStyle() == Use.LITERAL && wsdlMapping != null) { JBossXSModel xsModel = types.getSchemaModel(); SchemaBindingBuilder bindingBuilder = new SchemaBindingBuilder(); schemaBinding = bindingBuilder.buildSchemaBinding(xsModel, wsdlMapping); } return schemaBinding; } public void validate() { // Validate that there is at least one handler configured // if we have a security configuration if (securityConfig != null) { int handlerCount = 0; for (EndpointMetaData epMetaData : endpoints.values()) { handlerCount += epMetaData.getHandlerMetaData(HandlerType.ALL).size(); } if (handlerCount == 0) log.warn("WS-Security requires a security handler to be configured"); } // Validate endpoints for (EndpointMetaData epMetaData : endpoints.values()) epMetaData.validate(); } /** * @see UnifiedMetaData#eagerInitialize() */ public void eagerInitialize() { // Initialize all wsdl definitions and schema objects WSDLDefinitions definitions = getWsdlDefinitions(); if (definitions != null) { WSDLTypes types = definitions.getWsdlTypes(); if (types != null) { JBossXSModel model = WSDLUtils.getSchemaModel(types); if (model != null) model.eagerInitialize(); } } // Initialize jaxrpc-mapping data getJavaWsdlMapping(); // Initialize endpoints for (EndpointMetaData epMetaData : endpoints.values()) epMetaData.eagerInitialize(); // Initialize schema binding getSchemaBinding(); } /** Assert that the given namespace is the WSDL's target namespace */ public void assertTargetNamespace(String targetNS) { if (getServiceName().getNamespaceURI().equals(targetNS) == false) throw new WSException("Requested namespace is not WSDL target namespace: " + targetNS); } public String toString() { StringBuilder buffer = new StringBuilder("\nServiceMetaData:"); buffer.append("\n qname=" + serviceName); buffer.append("\n refName=" + serviceRefName); buffer.append("\n wsdName=" + wsdName); buffer.append("\n wsdlFile=" + wsdlFile); buffer.append("\n wsdlLocation=" + wsdlLocation); buffer.append("\n jaxrpcMapping=" + mappingLocation); buffer.append("\n publishLocation=" + wsdlPublishLocation); buffer.append("\n securityConfig=" + (securityConfig != null ? "found" : null)); buffer.append("\n properties=" + properties); buffer.append("\n" + types); buffer.append("\n"); for (EndpointMetaData epMetaData : endpoints.values()) { buffer.append(epMetaData); } return buffer.toString(); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/TypesMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/TypesMetaData.0000644000175000017500000001434610561611275031443 0ustar godgod/* * 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.metadata.umdm; // $Id: TypesMetaData.java 2275 2007-02-05 11:19:25Z heiko.braun@jboss.com $ import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; /** * Types meta data * * @author Thomas.Diesler@jboss.org * @since 12-May-2005 */ public class TypesMetaData { // provide logging private static final Logger log = Logger.getLogger(TypesMetaData.class); // The parent meta data. private ServiceMetaData serviceMetaData; // The list of type meta data private List typeList = new ArrayList(); private JBossXSModel schemaModel; public TypesMetaData(ServiceMetaData serviceMetaData) { this.serviceMetaData = serviceMetaData; } public ServiceMetaData getServiceMetaData() { return serviceMetaData; } public JBossXSModel getSchemaModel() { return schemaModel; } public void setSchemaModel(JBossXSModel model) { this.schemaModel = model; } public void addSchemaModel(JBossXSModel model) { if (this.schemaModel == null) { this.schemaModel = model; } else { this.schemaModel.merge(model); } } public List getTypeMappings() { return new ArrayList(typeList); } public void addTypeMapping(TypeMappingMetaData tmMetaData) { if (typeList.contains(tmMetaData) == false) { log.trace("Add type mapping: " + tmMetaData); typeList.add(tmMetaData); } } public TypeMappingMetaData getTypeMappingByXMLType(QName xmlType) { TypeMappingMetaData tmMetaData = null; for (TypeMappingMetaData aux : typeList) { boolean isElementScope = TypeMappingMetaData.QNAME_SCOPE_ELEMENT.equals(aux.getQNameScope()); if (aux.getXmlType().equals(xmlType) && isElementScope == false) { if (tmMetaData != null) { log.error(tmMetaData + "\n" + aux); throw new WSException("Ambiguous type mappping for: " + xmlType); } tmMetaData = aux; } } if (tmMetaData == null && schemaModel != null) { // Simple types are not neccessary mapped in jaxrpc-mapping.xml, lazily add the mapping here XSTypeDefinition xsType = schemaModel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); if (xsType instanceof XSSimpleTypeDefinition) { XSSimpleTypeDefinition xsSimpleType = (XSSimpleTypeDefinition)xsType; String javaTypeName = null; // // // if (xsSimpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST) { XSSimpleTypeDefinition itemType = xsSimpleType.getItemType(); QName xmlBaseType = new QName(itemType.getNamespace(), itemType.getName()); javaTypeName = new LiteralTypeMapping().getJavaTypeName(xmlBaseType); if (javaTypeName != null) { javaTypeName += "[]"; } } // // // // // XSTypeDefinition xsBaseType = xsType.getBaseType(); while (javaTypeName == null && xsBaseType != null) { QName xmlBaseType = new QName(xsBaseType.getNamespace(), xsBaseType.getName()); javaTypeName = new LiteralTypeMapping().getJavaTypeName(xmlBaseType); xsBaseType = xsBaseType.getBaseType(); } if (javaTypeName != null) { tmMetaData = new TypeMappingMetaData(this, xmlType, javaTypeName); tmMetaData.setQNameScope(TypeMappingMetaData.QNAME_SCOPE_SIMPLE_TYPE); if(log.isDebugEnabled()) log.debug("Adding a simpleType without jaxrpc-mapping: " + tmMetaData); addTypeMapping(tmMetaData); } else { log.warn("Cannot obtain javaTypeName for xmlType: " + xmlType); } } } return tmMetaData; } public TypeMappingMetaData getTypeMappingByJavaType(String javaTypeName) { TypeMappingMetaData tmMetaData = null; for (TypeMappingMetaData aux : typeList) { if (aux.getJavaTypeName().equals(javaTypeName)) tmMetaData = aux; } return tmMetaData; } public String toString() { StringBuilder buffer = new StringBuilder("\nTypesMetaData: "); for (TypeMappingMetaData tmd : typeList) { buffer.append("\n " + tmd); } buffer.append("\n" + (schemaModel != null ? schemaModel.serialize() : "")); return buffer.toString(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/Accessor.java0000644000175000017500000000150010543061077031325 0ustar godgod/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. * * This is free software; you can redistribute it and/or modify it * under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as * published by JBoss Inc.; either version 1.0 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. */ package org.jboss.ws.metadata.umdm; /** * @author Jason T. Greene * @version $Revision: 1760 $ */ public interface Accessor { public Object get(Object bean); public void set(Object bean, Object value); }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ExtensibleMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ExtensibleMeta0000644000175000017500000000126010567644021031561 0ustar godgodpackage org.jboss.ws.metadata.umdm; import java.util.HashMap; import java.util.Map; /** * Base class for UMD elements that are extensible. * * @author Heiko Braun, * @since 21-Mar-2006 */ public abstract class ExtensibleMetaData { private Map extensions = new HashMap(); public Map getExtensions() { return extensions; } public void addExtension(MetaDataExtension ext) { getExtensions().put(ext.getExtensionNameSpace(), ext); } public MetaDataExtension getExtension(String namespace) { return getExtensions().get(namespace); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/WrappedParameter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/WrappedParamet0000755000175000017500000000713510650145103031564 0ustar godgod/* * 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.metadata.umdm; import javax.xml.namespace.QName; import org.jboss.wsf.common.JavaUtils; /** * WrappedParameter represents a document/literal wrapped parameter. * * @author Jason T. Greene * @version $Revision: 3959 $ */ public class WrappedParameter { public static final int RETURN = -1; private QName name; private String type; private String[] typeArguments; private String variable; private boolean holder = false; private int index = -2; private Accessor accessor; private boolean swaRef; private boolean xop; public WrappedParameter(WrappedParameter wrapped) { this.name = wrapped.name; this.type = wrapped.type; this.typeArguments = wrapped.typeArguments; this.variable = wrapped.variable; this.holder = wrapped.holder; this.index = wrapped.index; this.accessor = wrapped.accessor; } public WrappedParameter(QName name, String type, String variable, int index) { this.setName(name); this.setType(type); this.setVariable(variable); this.setIndex(index); } public Accessor accessor() { return accessor; } public void setName(QName name) { this.name = name; } public QName getName() { return name; } public void setType(String type) { this.type = type; } public String getType() { return type; } public void setTypeArguments(String[] typeArguments) { this.typeArguments = typeArguments; } public String[] getTypeArguments() { return typeArguments; } public void setVariable(String variable) { this.variable = variable; } public String getVariable() { return variable; } public void setHolder(boolean holder) { this.holder = holder; } public boolean isHolder() { return holder; } public void setIndex(int index) { this.index = index; } public int getIndex() { return index; } void setAccessor(Accessor accessor) { this.accessor = accessor; } public boolean isSwaRef() { return swaRef; } public void setSwaRef(boolean swaRef) { this.swaRef = swaRef; } public boolean isXop() { return xop; } public void setXOP(boolean xop) { this.xop = xop; } public String toString() { return "[name = " + getName() + ", type = " + getType() + ", typeArgs = " + JavaUtils.printArray(getTypeArguments()) + ", variable = " + getVariable() + ", index = " + getIndex() + "]"; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/AccessorFactoryCreator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/AccessorFactor0000644000175000017500000000155710543061077031560 0ustar godgod/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. * * This is free software; you can redistribute it and/or modify it * under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as * published by JBoss Inc.; either version 1.0 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. */ package org.jboss.ws.metadata.umdm; /** * @author Jason T. Greene * @version $Revision: 1760 $ */ public interface AccessorFactoryCreator { public AccessorFactory create(ParameterMetaData parameter); public AccessorFactory create(FaultMetaData fault); }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/FaultMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/FaultMetaData.0000644000175000017500000003555610650145103031407 0ustar godgod/* * 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.metadata.umdm; // $Id: FaultMetaData.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxws.DynamicWrapperGenerator; import org.jboss.ws.metadata.acessor.ReflectiveFieldAccessor; import org.jboss.ws.metadata.acessor.ReflectiveMethodAccessor; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.wsf.common.JavaUtils; /** * A Fault component describes a fault that a given operation supports. * * @author Thomas.Diesler@jboss.org * @author jason.greene@jboss.com * @since 12-May-2005 */ public class FaultMetaData { // provide logging private final Logger log = Logger.getLogger(FaultMetaData.class); // The parent operation private OperationMetaData opMetaData; private QName xmlName; private QName xmlType; private String javaTypeName; private String faultBeanName; private Class javaType; private Class faultBean; private Method faultInfoMethod; private Constructor serviceExceptionConstructor; private Method[] serviceExceptionGetters; private WrappedParameter[] faultBeanProperties; private Class[] propertyTypes; public FaultMetaData(OperationMetaData operation, QName xmlName, QName xmlType, String javaTypeName) { this(operation, xmlName, javaTypeName); setXmlType(xmlType); } public FaultMetaData(OperationMetaData operation, QName xmlName, String javaTypeName) { if (xmlName == null) throw new IllegalArgumentException("Invalid null xmlName argument"); if (javaTypeName == null) throw new IllegalArgumentException("Invalid null javaTypeName argument, for: " + xmlName); this.opMetaData = operation; this.xmlName = xmlName; this.javaTypeName = javaTypeName; } public OperationMetaData getOperationMetaData() { return opMetaData; } public QName getXmlName() { return xmlName; } public QName getXmlType() { return xmlType; } public void setXmlType(QName xmlType) { if (xmlType == null) throw new IllegalArgumentException("Invalid null xmlType argument, for: " + xmlName); this.xmlType = xmlType; } public String getJavaTypeName() { return javaTypeName; } /** Load the java type. * It should only be cached during eager initialization. */ public Class getJavaType() { if (javaType != null) return javaType; if (javaTypeName == null) return null; try { ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader(); Class exceptionType = JavaUtils.loadJavaType(javaTypeName, loader); if (Exception.class.isAssignableFrom(exceptionType) == false) throw new IllegalStateException("Is not assignable to exception: " + exceptionType); if (opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isEagerInitialized()) { log.warn("Loading java type after eager initialization"); javaType = exceptionType; } return exceptionType; } catch (ClassNotFoundException ex) { throw new WSException("Cannot load java type: " + javaTypeName, ex); } } public String getFaultBeanName() { return faultBeanName; } public void setFaultBeanName(String faultBeanName) { this.faultBeanName = faultBeanName; } public Class loadFaultBean() { Class faultBean = null; try { ClassLoader loader = getOperationMetaData().getEndpointMetaData().getClassLoader(); faultBean = JavaUtils.loadJavaType(faultBeanName, loader); } catch (ClassNotFoundException ex) { // ignore } return faultBean; } public Class getFaultBean() { Class tmpFaultBean = faultBean; if (tmpFaultBean == null && faultBeanName != null) { try { ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader(); tmpFaultBean = JavaUtils.loadJavaType(faultBeanName, loader); } catch (ClassNotFoundException ex) { throw new WSException("Cannot load fault bean: " + faultBeanName, ex); } } return tmpFaultBean; } public void validate() { // nothing to do } public void eagerInitialize() { Type epType = getOperationMetaData().getEndpointMetaData().getType(); if (epType == EndpointMetaData.Type.JAXWS && faultBeanName != null) { if (loadFaultBean() == null) { ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader(); new DynamicWrapperGenerator(loader).generate(this); } } // Initialize the cache javaType = getJavaType(); if (javaType == null) throw new WSException("Cannot load java type: " + javaTypeName); if (JavaUtils.isAssignableFrom(Exception.class, javaType) == false) throw new WSException("Fault java type is not a java.lang.Exception: " + javaTypeName); if (epType == EndpointMetaData.Type.JAXWS) { faultBean = getFaultBean(); if (faultBean != null) initializeFaultBean(); } } private void initializeFaultBean() { /* JAX-WS 3.7: For exceptions that match the pattern described in section * 2.5 (i.e. exceptions that have a getFaultInfo method), the FaultBean * is used as input to JAXB */ try { /* JAX-WS 2.5: A wsdl:fault element refers to a wsdl:message that contains * a single part. The global element declaration referred to by that part * is mapped to a Java bean. A wrapper exception class contains the * following methods: * . WrapperException(String message, FaultBean faultInfo) * . WrapperException(String message, FaultBean faultInfo, Throwable cause) * . FaultBean getFaultInfo() */ serviceExceptionConstructor = javaType.getConstructor(String.class, faultBean); faultInfoMethod = javaType.getMethod("getFaultInfo"); } /* JAX-WS 3.7: For exceptions that do not match the pattern described in * section 2.5, JAX-WS maps those exceptions to Java beans and then uses * those Java beans as input to the JAXB mapping. */ catch (NoSuchMethodException nsme) { /* For each getter in the exception and its superclasses, a property of * the same type and name is added to the bean. */ XmlType xmlType = (XmlType)faultBean.getAnnotation(XmlType.class); if (xmlType == null) throw new WebServiceException("@XmlType missing from fault bean: " + faultBeanName); AccessorFactory accessorFactory = getAccessorFactory(faultBean); String[] propertyNames = xmlType.propOrder(); int propertyCount = propertyNames.length; propertyTypes = new Class[propertyCount]; faultBeanProperties = new WrappedParameter[propertyCount]; serviceExceptionGetters = new Method[propertyCount]; for (int i = 0; i < propertyCount; i++) { String propertyName = propertyNames[i]; // extract property metadata from the fault bean try { PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, faultBean); Class propertyType = propertyDescriptor.getPropertyType(); WrappedParameter faultBeanProperty = new WrappedParameter(null, propertyType.getName(), propertyName, i); faultBeanProperty.setAccessor(accessorFactory.create(faultBeanProperty)); faultBeanProperties[i] = faultBeanProperty; propertyTypes[i] = propertyType; } catch (IntrospectionException ie) { throw new WSException("Property '" + propertyName + "' not found in fault bean '" + faultBeanName + "'", ie); } // extract property metadata from the service exception try { /* use PropertyDescriptor(String, Class, String, String) instead * of PropertyDescriptor(String, Class) because the latter requires * the setter method to be present */ PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, javaType, "is" + JavaUtils.capitalize(propertyName), null); serviceExceptionGetters[i] = propertyDescriptor.getReadMethod(); } catch (IntrospectionException ie) { throw new WSException("Property '" + propertyName + "' not found in service exception '" + javaTypeName, ie); } } try { // Attempt to locate a usable constructor serviceExceptionConstructor = javaType.asSubclass(Exception.class).getConstructor(propertyTypes); } catch (NoSuchMethodException e) { // Only needed for client side. The spec does not clarify this, and the TCK makes use of non matching constructors, // so we allow them for server side usage and only fail when used by the client. } } } private AccessorFactory getAccessorFactory(Class faultBean) { // This should catch all cases due to the constraints that JAX-WS puts on the fault bean // However, if issues arrise then switch this to a full jaxb reflection library XmlAccessorType type = (XmlAccessorType)faultBean.getAnnotation(XmlAccessorType.class); if (type != null && type.value() == XmlAccessType.FIELD) return ReflectiveFieldAccessor.FACTORY_CREATOR.create(this); return ReflectiveMethodAccessor.FACTORY_CREATOR.create(this); } public Object toFaultBean(Exception serviceException) { Object faultBeanInstance; try { /* is the service exception a wrapper * (i.e. does it match the pattern in JAX-WS 2.5)? */ if (faultInfoMethod != null) { // extract the fault bean from the wrapper exception faultBeanInstance = faultInfoMethod.invoke(serviceException); } else { // instantiate the fault bean try { faultBeanInstance = faultBean.newInstance(); } catch (InstantiationException e) { throw new WebServiceException("Fault bean class is not instantiable", e); } // copy the properties from the service exception to the fault bean for (int i = 0; i < serviceExceptionGetters.length; i++) { Object propertyValue = serviceExceptionGetters[i].invoke(serviceException); WrappedParameter faultBeanProperty = faultBeanProperties[i]; if (log.isTraceEnabled()) log.trace("copying from " + javaType.getSimpleName() + '.' + serviceExceptionGetters[i].getName() + " to " + faultBean.getSimpleName() + '.' + faultBeanProperty.getVariable() + "<->" + faultBeanProperty.getName() + ": " + propertyValue); faultBeanProperty.accessor().set(faultBeanInstance, propertyValue); } } } catch (IllegalAccessException e) { throw new WebServiceException(e); } catch (InvocationTargetException e) { throw new WebServiceException(e.getTargetException()); } return faultBeanInstance; } public Exception toServiceException(Object faultBean, String message) { Exception serviceException; try { /* is the service exception a wrapper * (i.e. does it match the pattern in JAX-WS 2.5)? */ if (faultInfoMethod != null) { serviceException = (Exception)serviceExceptionConstructor.newInstance(message, faultBean); } else { if (serviceExceptionConstructor == null) throw new WSException("Could not instantiate service exception (" + javaType.getSimpleName() +"), since neither a faultInfo nor sorted constructor is present: " + Arrays.toString(propertyTypes)); // extract the properties from the fault bean int propertyCount = faultBeanProperties.length; Object[] propertyValues = new Object[propertyCount]; for (int i = 0; i < propertyCount; i++) propertyValues[i] = faultBeanProperties[i].accessor().get(faultBean); log.debug("constructing " + javaType.getSimpleName() + ": " + Arrays.toString(propertyValues)); serviceException = (Exception)serviceExceptionConstructor.newInstance(propertyValues); } } catch (InstantiationException e) { throw new WebServiceException("Service exception is not instantiable", e); } catch (IllegalAccessException e) { throw new WebServiceException(e); } catch (InvocationTargetException e) { throw new WebServiceException(e.getTargetException()); } return serviceException; } public String toString() { StringBuilder buffer = new StringBuilder("\nFaultMetaData"); buffer.append("\n xmlName=" + xmlName); buffer.append("\n xmlType=" + xmlType); buffer.append("\n javaType=" + javaTypeName); buffer.append("\n faultBean=" + faultBeanName); return buffer.toString(); } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/MetaDataExtension.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/MetaDataExtens0000644000175000017500000000277110542776150031531 0ustar godgod/* * 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.metadata.umdm; // $Id: MetaDataExtension.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * Operation metaData extension. * * @author Heiko Braun, * @since 17-Mar-2006 */ public abstract class MetaDataExtension { private String extensionNameSpace; public MetaDataExtension(String extensionNameSpace) { this.extensionNameSpace = extensionNameSpace; } public String getExtensionNameSpace() { return extensionNameSpace; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/HandlerMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/HandlerMetaDat0000644000175000017500000001220010642000211031436 0ustar godgod/* * 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.metadata.umdm; // $Id:HandlerMetaData.java 915 2006-09-08 08:40:45Z thomas.diesler@jboss.com $ import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * The common metdata data for a handler element * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public abstract class HandlerMetaData implements Serializable { // provide logging private final Logger log = Logger.getLogger(HandlerMetaData.class); private transient EndpointMetaData epMetaData; // The required element private String handlerName; // The required element private String handlerClassName; // The required handler type private HandlerType handlerType; // The optional elements private Set soapHeaders = new HashSet(); // The optional elements private List initParams = new ArrayList(); // The cached handler class private Class handlerClass; public HandlerMetaData(HandlerType type) { this.handlerType = type; } public void setEndpointMetaData(EndpointMetaData epMetaData) { this.epMetaData = epMetaData; } public EndpointMetaData getEndpointMetaData() { return epMetaData; } public void setHandlerName(String value) { this.handlerName = value; } public String getHandlerName() { return handlerName; } public void setHandlerClassName(String handlerClass) { this.handlerClassName = handlerClass; } public String getHandlerClassName() { return handlerClassName; } public Class getHandlerClass() { if (handlerClassName == null) throw new IllegalStateException("Handler class name cannot be null"); Class localClass = handlerClass; if (localClass == null) { try { ClassLoader loader = getClassLoader(); localClass = loader.loadClass(handlerClassName); } catch (ClassNotFoundException ex) { throw new WSException("Cannot load handler: " + handlerClassName, ex); } } return localClass; } private ClassLoader getClassLoader() { // The EndpointMetaData classloader is not availabel for a handler associaated with a JAXWS Service.handlerResolver ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); return (epMetaData != null ? epMetaData.getClassLoader() : ctxLoader); } public HandlerType getHandlerType() { return handlerType; } public void setSoapHeaders(Set soapHeaders) { this.soapHeaders = soapHeaders; } public Set getSoapHeaders() { return soapHeaders; } public void setInitParams(List initParams) { this.initParams = initParams; } public List getInitParams() { return initParams; } public void validate() { List securityHandlers = new ArrayList(); securityHandlers.add(org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerInbound.class.getName()); securityHandlers.add(org.jboss.ws.extensions.security.jaxrpc.WSSecurityHandlerOutbound.class.getName()); securityHandlers.add(org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer.class.getName()); securityHandlers.add(org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient.class.getName()); if (securityHandlers.contains(handlerClassName) && epMetaData != null) { if (epMetaData.getServiceMetaData().getSecurityConfiguration() == null) log.warn("WS-Security requires security configuration"); } } public void eagerInitialize() { handlerClass = getHandlerClass(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ClientEndpoint0000644000175000017500000000672610702657335031606 0ustar godgod/* * 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.metadata.umdm; // $Id: ClientEndpointMetaData.java 4701 2007-10-09 10:58:37Z thomas.diesler@jboss.com $ import org.jboss.ws.core.jaxws.handler.PortInfoImpl; import org.jboss.ws.metadata.config.ConfigurationProvider; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import javax.xml.namespace.QName; import javax.xml.ws.handler.PortInfo; /** * Client side endpoint meta data. * * @author Thomas.Diesler@jboss.org * @since 12-May-2005 */ public class ClientEndpointMetaData extends EndpointMetaData { // The endpoint address private String endpointAddress; public ClientEndpointMetaData(ServiceMetaData service, QName qname, QName portTypeName, Type type) { super(service, qname, portTypeName, type); configName = ConfigurationProvider.DEFAULT_CLIENT_CONFIG_NAME; if (type == Type.JAXRPC) configFile = ConfigurationProvider.DEFAULT_JAXRPC_CLIENT_CONFIG_FILE; else configFile = ConfigurationProvider.DEFAULT_JAXWS_CLIENT_CONFIG_FILE; } public String getEndpointAddress() { return endpointAddress; } public void setEndpointAddress(String endpointAddress) { this.endpointAddress = endpointAddress; } public PortInfo getPortInfo() { QName serviceName = getServiceMetaData().getServiceName(); QName portName = getPortName(); String bindingID = getBindingId(); PortInfo portInfo = new PortInfoImpl(serviceName, portName, bindingID); return portInfo; } public String toString() { StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:"); buffer.append("\n type=").append(getType()); buffer.append("\n qname=").append(getPortName()); buffer.append("\n address=").append(getEndpointAddress()); buffer.append("\n binding=").append(getBindingId()); buffer.append("\n seiName=").append(getServiceEndpointInterfaceName()); buffer.append("\n configFile=").append(getConfigFile()); buffer.append("\n configName=").append(getConfigName()); buffer.append("\n authMethod=").append(getAuthMethod()); buffer.append("\n properties=").append(getProperties()); for (OperationMetaData opMetaData : getOperations()) { buffer.append("\n").append(opMetaData); } for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL)) { buffer.append("\n").append(hdlMetaData); } return buffer.toString(); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ParameterMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/ParameterMetaD0000644000175000017500000004244110650145103031477 0ustar godgod/* * 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.metadata.umdm; // $Id: ParameterMetaData.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.StringTokenizer; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.ParameterWrapping; import org.jboss.ws.core.jaxws.DynamicWrapperGenerator; import org.jboss.ws.core.utils.HolderUtils; import org.jboss.ws.extensions.xop.jaxws.AttachmentScanResult; import org.jboss.ws.extensions.xop.jaxws.ReflectiveAttachmentRefScanner; import org.jboss.ws.metadata.acessor.ReflectiveMethodAccessor; import org.jboss.ws.metadata.config.EndpointFeature; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.wsf.common.JavaUtils; /** * A request/response parameter that a given operation supports. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 12-May-2005 */ public class ParameterMetaData { // provide logging private final Logger log = Logger.getLogger(ParameterMetaData.class); // The parent operation private OperationMetaData opMetaData; private QName xmlName; private String partName; private QName xmlType; private String javaTypeName; private Class javaType; private ParameterMode mode; private Set mimeTypes; private boolean inHeader; private boolean isSwA; private boolean isXOP; private boolean isSwaRef; private List wrappedParameters; private int index; // SOAP-ENC:Array private boolean soapArrayParam; private QName soapArrayCompType; private AccessorFactoryCreator accessorFactoryCreator = ReflectiveMethodAccessor.FACTORY_CREATOR; private static final List messageTypes = new ArrayList(); static { messageTypes.add("javax.xml.soap.SOAPElement"); messageTypes.add("org.w3c.dom.Element"); } public ParameterMetaData(OperationMetaData opMetaData, QName xmlName, QName xmlType, String javaTypeName) { this(opMetaData, xmlName, javaTypeName); setXmlType(xmlType); } public ParameterMetaData(OperationMetaData opMetaData, QName xmlName, String javaTypeName) { if (xmlName == null) throw new IllegalArgumentException("Invalid null xmlName argument"); // Remove the prefixes if (xmlName.getNamespaceURI().length() > 0) xmlName = new QName(xmlName.getNamespaceURI(), xmlName.getLocalPart()); this.xmlName = xmlName; this.opMetaData = opMetaData; this.mode = ParameterMode.IN; this.javaTypeName = javaTypeName; this.partName = xmlName.getLocalPart(); } private static boolean matchParameter(Method method, int index, Class expectedType, Set matches, boolean exact, boolean holder) { Class returnType = method.getReturnType(); if (index == -1 && matchTypes(returnType, expectedType, exact, false)) return true; Class[] classParameters = method.getParameterTypes(); if (index < 0 || index >= classParameters.length) return false; boolean matchTypes; if (JavaUtils.isRetro14()) { matchTypes = matchTypes(classParameters[index], expectedType, exact, holder); } else { java.lang.reflect.Type[] genericParameters = method.getGenericParameterTypes(); matchTypes = matchTypes(genericParameters[index], expectedType, exact, holder); } if (matchTypes) { matches.add(index); return true; } return false; } private static boolean matchTypes(java.lang.reflect.Type actualType, Class expectedType, boolean exact, boolean holder) { if (holder && HolderUtils.isHolderType(actualType) == false) return false; java.lang.reflect.Type valueType = (holder ? HolderUtils.getValueType(actualType) : actualType); Class valueClass = JavaUtils.erasure(valueType); return matchTypesInternal(valueClass, expectedType, exact); } // This duplication is needed because Class does not implement Type in 1.4, // which makes retrotranslation not possible. This takes advantage of overloading to // prevent the problem. private static boolean matchTypes(Class actualType, Class expectedType, boolean exact, boolean holder) { if (holder && HolderUtils.isHolderType(actualType) == false) return false; Class valueClass = (holder ? HolderUtils.getValueType(actualType) : actualType); return matchTypesInternal(valueClass, expectedType, exact); } private static boolean matchTypesInternal(Class valueClass, Class expectedType, boolean exact) { // FIXME - Why do we need this hack? The method signature should _ALWAYS_ match, else we will get ambiguous or incorrect results List anyTypes = new ArrayList(); anyTypes.add(javax.xml.soap.SOAPElement.class); anyTypes.add(org.w3c.dom.Element.class); boolean matched; if (exact) { matched = valueClass.getName().equals(expectedType.getName()); if (matched == false && anyTypes.contains(valueClass)) matched = anyTypes.contains(expectedType); } else { matched = JavaUtils.isAssignableFrom(valueClass, expectedType); } return matched; } public OperationMetaData getOperationMetaData() { return opMetaData; } public QName getXmlName() { return xmlName; } public QName getXmlType() { return xmlType; } public void setXmlType(QName xmlType) { if (xmlType == null) throw new IllegalArgumentException("Invalid null xmlType"); // Remove potential prefix if (xmlType.getNamespaceURI().length() > 0) this.xmlType = new QName(xmlType.getNamespaceURI(), xmlType.getLocalPart()); else this.xmlType = xmlType; // Special case to identify attachments if (Constants.NS_ATTACHMENT_MIME_TYPE.equals(xmlType.getNamespaceURI())) { String mimeType = convertXmlTypeToMimeType(xmlType); setMimeTypes(mimeType); this.isSwA = true; } } public String getJavaTypeName() { return javaTypeName; } public void setJavaTypeName(String typeName) { // Warn if this is called after eager initialization UnifiedMetaData wsMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData(); if (wsMetaData.isEagerInitialized() && UnifiedMetaData.isFinalRelease() == false) log.warn("Set java type name after eager initialization", new IllegalStateException()); javaTypeName = typeName; javaType = null; } public Class loadWrapperBean() { Class wrapperBean = null; try { ClassLoader loader = getClassLoader(); wrapperBean = JavaUtils.loadJavaType(javaTypeName, loader); } catch (ClassNotFoundException ex) { // ignore } return wrapperBean; } /** Load the java type. * It should only be cached during eager initialization. */ public Class getJavaType() { Class tmpJavaType = javaType; if (tmpJavaType == null && javaTypeName != null) { try { ClassLoader loader = getClassLoader(); tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader); UnifiedMetaData wsMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData(); if (wsMetaData.isEagerInitialized()) { // This should not happen, see the warning in setJavaTypeName javaType = tmpJavaType; } } catch (ClassNotFoundException ex) { throw new WSException("Cannot load java type: " + javaTypeName, ex); } } return tmpJavaType; } public ParameterMode getMode() { return mode; } public void setMode(String mode) { if ("IN".equals(mode)) setMode(ParameterMode.IN); else if ("INOUT".equals(mode)) setMode(ParameterMode.INOUT); else if ("OUT".equals(mode)) setMode(ParameterMode.OUT); else throw new IllegalArgumentException("Invalid mode: " + mode); } public void setMode(ParameterMode mode) { this.mode = mode; } public Set getMimeTypes() { return mimeTypes; } public void setMimeTypes(String mimeStr) { mimeTypes = new HashSet(); StringTokenizer st = new StringTokenizer(mimeStr, ","); while (st.hasMoreTokens()) mimeTypes.add(st.nextToken().trim()); } public boolean isInHeader() { return inHeader; } public void setInHeader(boolean inHeader) { this.inHeader = inHeader; } public boolean isSwA() { return isSwA; } public void setSwA(boolean isSwA) { this.isSwA = isSwA; } public boolean isSwaRef() { return isSwaRef; } public void setSwaRef(boolean swaRef) { isSwaRef = swaRef; } public boolean isXOP() { return isXOP; } public void setXOP(boolean isXOP) { this.isXOP = isXOP; } public boolean isSOAPArrayParam() { return soapArrayParam; } public void setSOAPArrayParam(boolean soapArrayParam) { this.soapArrayParam = soapArrayParam; } public QName getSOAPArrayCompType() { return soapArrayCompType; } public void setSOAPArrayCompType(QName compXmlType) { if (compXmlType != null && !compXmlType.equals(soapArrayCompType)) { String logmsg = "SOAPArrayCompType: [xmlType=" + xmlType + ",compType=" + compXmlType + "]"; log.debug((soapArrayCompType == null ? "set" : "reset") + logmsg); } this.soapArrayCompType = compXmlType; } @Deprecated // FIXME This hack should be removed public boolean isMessageType() { return messageTypes.contains(javaTypeName); } @Deprecated public static boolean isMessageType(String javaTypeName) { return messageTypes.contains(javaTypeName); } /** Converts a proprietary JBossWS attachment xml type to the MIME type that it represents. */ private String convertXmlTypeToMimeType(QName xmlType) { StringBuilder mimeName = new StringBuilder(xmlType.getLocalPart()); int pos = mimeName.indexOf("_"); if (pos == -1) throw new IllegalArgumentException("Invalid mime type: " + xmlType); mimeName.setCharAt(pos, '/'); return mimeName.toString(); } public int getIndex() { return index; } /** * Sets the method parameter index of the parameter this meta data corresponds to. A value of -1 indicates * that this parameter is mapped to the return value. * * @param index the method parameter offset, or -1 for a return value */ public void setIndex(int index) { this.index = index; } public List getWrappedParameters() { return wrappedParameters; } public void setWrappedParameters(List wrappedParameters) { this.wrappedParameters = wrappedParameters; } public String getPartName() { // [JBWS-771] Use part names that are friendly to .NET String auxPartName = partName; if (opMetaData.getEndpointMetaData().getConfig().hasFeature(EndpointFeature.BINDING_WSDL_DOTNET)) { if (opMetaData.isDocumentWrapped() && inHeader == false) auxPartName = "parameters"; } return auxPartName; } public void setPartName(String partName) { this.partName = partName; } public void validate() { // nothing to do } /** * @see UnifiedMetaData#eagerInitialize() */ public void eagerInitialize() { // reset java type javaType = null; // TODO - Remove messageType hack Type epType = getOperationMetaData().getEndpointMetaData().getType(); if (getOperationMetaData().isDocumentWrapped() && !isInHeader() && !isSwA() && !isMessageType()) { if (loadWrapperBean() == null) { if (epType == EndpointMetaData.Type.JAXRPC) throw new WSException("Autogeneration of wrapper beans not supported with JAXRPC"); new DynamicWrapperGenerator( getClassLoader() ).generate(this); } // Initialize accessors AccessorFactory factory = accessorFactoryCreator.create(this); for (WrappedParameter wrapped : wrappedParameters) wrapped.setAccessor(factory.create(wrapped)); } javaType = getJavaType(); if (javaType == null) throw new WSException("Cannot load java type: " + javaTypeName); initializeAttachmentParameter(epType); } /** * Identify MTOM and SWA:Ref parameter as these require special treatment. * This only affects JAX-WS endpoints. * * Note: For SEI parameter annotations this happens within the metadata builder. * @param epType */ private void initializeAttachmentParameter(Type epType) { if (epType == Type.JAXWS) { ReflectiveAttachmentRefScanner scanner = new ReflectiveAttachmentRefScanner(); AttachmentScanResult scanResult = scanner.scanBean(javaType); if (scanResult != null) { if(log.isDebugEnabled()) log.debug("Identified attachment reference: " + xmlName + ", type="+scanResult.getType()); if(scanResult.getType() == AttachmentScanResult.Type.XOP) setXOP(true); else setSwaRef(true); } } } private ClassLoader getClassLoader() { ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader(); if (loader == null) throw new WSException("ClassLoader not available"); return loader; } public boolean matchParameter(Method method, Set matches, boolean exact) { ClassLoader loader = getOperationMetaData().getEndpointMetaData().getClassLoader(); List wrappedParameters = getWrappedParameters(); Class wrapperType = getJavaType(); // Standard type if (wrappedParameters == null) return matchParameter(method, getIndex(), getJavaType(), matches, exact, mode != ParameterMode.IN); // Wrapped type for (WrappedParameter wrapped : wrappedParameters) { String typeName = wrapped.getType(); try { Class type = (typeName != null) ? JavaUtils.loadJavaType(typeName, loader) : ParameterWrapping.getWrappedType(wrapped.getVariable(), wrapperType); if (type == null) return false; if (!matchParameter(method, wrapped.getIndex(), type, matches, exact, wrapped.isHolder())) return false; } catch (Exception ex) { if(log.isDebugEnabled()) log.debug("Invalid wrapper type:" + typeName, ex); return false; } } return true; } public void setAccessorFactoryCreator(AccessorFactoryCreator accessorFactoryCreator) { this.accessorFactoryCreator = accessorFactoryCreator; } public String toString() { boolean isReturn = (opMetaData.getReturnParameter() == this); StringBuilder buffer = new StringBuilder("\n" + (isReturn ? "ReturnMetaData:" : "ParameterMetaData:")); buffer.append("\n xmlName=" + getXmlName()); buffer.append("\n partName=" + getPartName()); buffer.append("\n xmlType=" + getXmlType()); if (soapArrayParam) buffer.append("\n soapArrayCompType=" + soapArrayCompType); buffer.append("\n javaType=" + getJavaTypeName()); buffer.append("\n mode=" + getMode()); buffer.append("\n inHeader=" + isInHeader()); buffer.append("\n index=" + index); if (isSwA()) { buffer.append("\n isSwA=" + isSwA()); buffer.append("\n mimeTypes=" + getMimeTypes()); } if (isXOP()) { buffer.append("\n isXOP=" + isXOP()); buffer.append("\n mimeTypes=" + getMimeTypes()); } if (wrappedParameters != null) buffer.append("\n wrappedParameters=" + wrappedParameters); return buffer.toString(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/EndpointMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/EndpointMetaDa0000644000175000017500000006072310743173754031523 0ustar godgod/* * 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.metadata.umdm; // $Id: EndpointMetaData.java 5471 2008-01-15 18:14:04Z alessio.soldano@jboss.com $ import java.lang.reflect.Method; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Observable; import java.util.Properties; import java.util.Set; import java.util.Observer; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.ws.Service.Mode; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonBindingProvider; import org.jboss.ws.core.CommonSOAPBinding; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.SOAPArraySerializerFactory; import org.jboss.ws.core.jaxws.JAXBContextCache; import org.jboss.ws.core.jaxws.JAXBDeserializerFactory; import org.jboss.ws.core.jaxws.JAXBSerializerFactory; import org.jboss.ws.core.jaxws.client.DispatchBinding; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.soap.Use; import org.jboss.ws.extensions.wsrm.config.RMConfig; import org.jboss.ws.extensions.wsrm.config.RMPortConfig; import org.jboss.ws.metadata.config.CommonConfig; import org.jboss.ws.metadata.config.Configurable; import org.jboss.ws.metadata.config.ConfigurationProvider; import org.jboss.ws.metadata.config.EndpointFeature; import org.jboss.ws.metadata.config.JBossWSConfigFactory; import org.jboss.wsf.common.JavaUtils; import org.jboss.wsf.spi.binding.BindingCustomization; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * A Service component describes a set of endpoints. * * @author Thomas.Diesler@jboss.org * @since 12-May-2005 */ public abstract class EndpointMetaData extends ExtensibleMetaData implements ConfigurationProvider { // provide logging private static Logger log = Logger.getLogger(EndpointMetaData.class); public enum Type { JAXRPC, JAXWS } public static final Set SUPPORTED_BINDINGS = new HashSet(); static { SUPPORTED_BINDINGS.add(Constants.SOAP11HTTP_BINDING); SUPPORTED_BINDINGS.add(Constants.SOAP12HTTP_BINDING); SUPPORTED_BINDINGS.add(Constants.SOAP11HTTP_MTOM_BINDING); SUPPORTED_BINDINGS.add(Constants.SOAP12HTTP_MTOM_BINDING); SUPPORTED_BINDINGS.add(Constants.HTTP_BINDING); } // The parent meta data. private ServiceMetaData serviceMetaData; // The REQUIRED endpoint config private CommonConfig config; // The REQUIRED name private QName portName; // The REQUIRED binding id private String bindingId; // The REQUIRED name of the WSDL interface/portType private QName portTypeName; // The REQUIRED config-name protected String configName; // The REQUIRED config-file protected String configFile; // The endpoint interface name private String seiName; // The endpoint interface private Class seiClass; // The optional authentication method private String authMethod; // Arbitrary properties given by private Properties properties; // The SOAPBinding style private Style style; // The SOAPBinding use private Use use; // The SOAPBinding parameter style private ParameterStyle parameterStyle; // The JAXWS ServiceMode private Mode serviceMode; // Whether the endpoint was deployed from annotations private Type type; // The list of service meta data private List operations = new ArrayList(); // The optional handlers private List handlers = new ArrayList(); // True if the handlers are initialized private boolean handlersInitialized; // Maps the java method to the operation meta data private Map opMetaDataCache = new HashMap(); // All of the registered types private List registeredTypes = new ArrayList(); private ConfigObservable configObservable = new ConfigObservable(); private List serviceRefContrib = new ArrayList(); private JAXBContextCache jaxbCache = new JAXBContextCache(); private List bindingCustomization = new ArrayList(); private String documentation; public EndpointMetaData(ServiceMetaData service, QName portName, QName portTypeName, Type type) { this.serviceMetaData = service; this.portName = portName; this.portTypeName = portTypeName; this.type = type; // The default binding this.bindingId = Constants.SOAP11HTTP_BINDING; } public ServiceMetaData getServiceMetaData() { return serviceMetaData; } public QName getPortName() { return portName; } public void setPortName(QName portName) { this.portName = portName; } public QName getPortTypeName() { return portTypeName; } public abstract String getEndpointAddress(); public abstract void setEndpointAddress(String endpointAddress); public String getBindingId() { return bindingId; } public void setBindingId(String bindingId) { if (SUPPORTED_BINDINGS.contains(bindingId) == false) throw new WSException("Unsupported binding: " + bindingId); this.bindingId = bindingId; } public String getServiceEndpointInterfaceName() { return seiName; } public void setServiceEndpointInterfaceName(String seiName) { this.seiName = seiName; this.seiClass = null; UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData(); if (wsMetaData.isEagerInitialized()) { if (UnifiedMetaData.isFinalRelease() == false) log.warn("Set SEI name after eager initialization", new IllegalStateException()); // reinitialize initializeInternal(); } } /** Get the class loader associated with the endpoint meta data */ public ClassLoader getClassLoader() { return getServiceMetaData().getUnifiedMetaData().getClassLoader(); } /** * Load the service endpoint interface. * It should only be cached during eager initialization. */ public Class getServiceEndpointInterface() { Class tmpClass = seiClass; if (tmpClass == null && seiName != null) { try { ClassLoader classLoader = getClassLoader(); tmpClass = classLoader.loadClass(seiName); if (serviceMetaData.getUnifiedMetaData().isEagerInitialized()) { log.warn("Loading SEI after eager initialization"); seiClass = tmpClass; } } catch (ClassNotFoundException ex) { throw new WSException("Cannot load service endpoint interface: " + seiName, ex); } } return tmpClass; } public Use getEncodingStyle() { if (use == null) { use = Use.getDefaultUse(); log.debug("Using default encoding style: " + use); } return use; } public void setEncodingStyle(Use value) { if (value != null && use != null && !use.equals(value)) throw new WSException("Mixed encoding styles not supported"); log.trace("setEncodingStyle: " + value); this.use = value; } public Style getStyle() { if (style == null) { style = Style.getDefaultStyle(); log.debug("Using default style: " + style); } return style; } public void setStyle(Style value) { if (value != null && style != null && !style.equals(value)) throw new WSException("Mixed styles not supported"); log.trace("setStyle: " + value); this.style = value; } public ParameterStyle getParameterStyle() { if (parameterStyle == null) { parameterStyle = ParameterStyle.WRAPPED; log.debug("Using default parameter style: " + parameterStyle); } return parameterStyle; } public void setParameterStyle(ParameterStyle value) { if (value != null && parameterStyle != null && !parameterStyle.equals(value)) throw new WSException("Mixed SOAP parameter styles not supported"); log.debug("setParameterStyle: " + value); this.parameterStyle = value; } public Mode getServiceMode() { return serviceMode; } public void setServiceMode(Mode serviceMode) { this.serviceMode = serviceMode; } public Type getType() { return type; } public Collection getBindingCustomizations() { return bindingCustomization; } public String getAuthMethod() { return authMethod; } public void setAuthMethod(String authMethod) { this.authMethod = authMethod; } public Properties getProperties() { if (null == this.properties) this.properties = new Properties(); return this.properties; } public void setProperties(Properties properties) { this.properties = properties; } public List getOperations() { return new ArrayList(operations); } public OperationMetaData getOperation(QName xmlName) { OperationMetaData opMetaData = null; for (OperationMetaData aux : operations) { QName opQName = aux.getQName(); String javaName = aux.getJavaName(); if (opQName.equals(xmlName) && !javaName.endsWith(Constants.ASYNC_METHOD_SUFFIX)) { if (opMetaData == null) { opMetaData = aux; } else { throw new WSException("Cannot uniquely indentify operation: " + xmlName); } } } if (opMetaData == null && getStyle() == Style.DOCUMENT) { for (OperationMetaData auxOperation : operations) { ParameterMetaData paramMetaData = null; for (ParameterMetaData auxParam : auxOperation.getParameters()) { ParameterMode mode = auxParam.getMode(); if (!auxParam.isInHeader() && mode != ParameterMode.OUT) { paramMetaData = auxParam; break; } } if (paramMetaData != null && paramMetaData.getXmlName().equals(xmlName)) { if (opMetaData == null) { opMetaData = auxOperation; } else { throw new WSException("Cannot uniquely indentify operation: " + xmlName); } } } } return opMetaData; } public OperationMetaData getOperation(Method method) { if (opMetaDataCache.size() == 0) { // This can happen when the SEI mapping was not found log.warn("Access to empty operation meta data cache, reinitializing"); initializeInternal(); } OperationMetaData opMetaData = opMetaDataCache.get(method); if (opMetaData == null) { for (OperationMetaData aux : operations) { boolean doesMatch = aux.getJavaMethod().equals(method); // fallback for async methods if (!doesMatch && method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX)) { String name = method.getName(); name = name.substring(0, name.length() - 5); doesMatch = aux.getJavaName().equals(name); } if (doesMatch) { opMetaDataCache.put(method, aux); opMetaData = aux; break; } } } return opMetaData; } public void addOperation(OperationMetaData opMetaData) { operations.add(opMetaData); } public void clearOperations() { operations.clear(); } public void addHandlers(List configHandlers) { for (HandlerMetaData handler : configHandlers) handler.setEndpointMetaData(this); handlers.addAll(configHandlers); } public void addHandler(HandlerMetaData handler) { handler.setEndpointMetaData(this); handlers.add(handler); } public void clearHandlers() { handlers.clear(); handlersInitialized = false; } public List getHandlerMetaData(HandlerType type) { List typeHandlers = new ArrayList(); for (HandlerMetaData hmd : handlers) { if (hmd.getHandlerType() == type || type == HandlerType.ALL) typeHandlers.add(hmd); } return typeHandlers; } public boolean isHandlersInitialized() { return handlersInitialized; } public void setHandlersInitialized(boolean flag) { this.handlersInitialized = flag; } public void validate() { for (HandlerMetaData handler : handlers) handler.validate(); for (OperationMetaData opMetaData : operations) opMetaData.validate(); } /** * @see UnifiedMetaData#eagerInitialize() */ public void eagerInitialize() { initializeInternal(); } private void initializeInternal() { // reset sei class seiClass = null; // Initialize handlers for (HandlerMetaData handler : handlers) handler.eagerInitialize(); eagerInitializeOperations(); eagerInitializeTypes(); } private void eagerInitializeOperations() { seiClass = getServiceEndpointInterface(); if (seiClass != null) { List unsynchronizedMethods = new ArrayList(); unsynchronizedMethods.addAll(Arrays.asList(seiClass.getMethods())); for (OperationMetaData opMetaData : operations) { opMetaData.eagerInitialize(unsynchronizedMethods); Method method = opMetaData.getJavaMethod(); if (method != null) { opMetaDataCache.put(method, opMetaData); unsynchronizedMethods.remove(method); } } } } private void eagerInitializeTypes() { TypeMappingImpl typeMapping = serviceMetaData.getTypeMapping(); List typeMappings = serviceMetaData.getTypesMetaData().getTypeMappings(); registeredTypes = new ArrayList(typeMappings.size()); for (TypeMappingMetaData tmMetaData : typeMappings) { String javaTypeName = tmMetaData.getJavaTypeName(); QName xmlType = tmMetaData.getXmlType(); if (xmlType != null) { List types = typeMapping.getJavaTypes(xmlType); // TODO: Clarification. In which cases is the type already registered? boolean registered = false; for (Class current : types) { if (current.getName().equals(javaTypeName)) { registeredTypes.add(current); registered = true; break; } } if (registered == false) { try { ClassLoader classLoader = getClassLoader(); Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader); if (JavaUtils.isPrimitive(javaTypeName)) javaType = JavaUtils.getWrapperType(javaType); // Needed for runtime JAXB context registeredTypes.add(javaType); if (getEncodingStyle() == Use.ENCODED && javaType.isArray()) { typeMapping.register(javaType, xmlType, new SOAPArraySerializerFactory(), new SOAPArrayDeserializerFactory()); } else { if (getType() == Type.JAXWS) { typeMapping.register(javaType, xmlType, new JAXBSerializerFactory(), new JAXBDeserializerFactory()); } else { typeMapping.register(javaType, xmlType, new JBossXBSerializerFactory(), new JBossXBDeserializerFactory()); } } } catch (ClassNotFoundException e) { log.warn("Cannot load class for type: " + xmlType + "," + javaTypeName); } } } } } // --------------------------------------------------------------- // Configuration provider impl /** * Callback for components that require configuration through jbossws-dd */ public void configure(Configurable configurable) { // Make sure we have a configuration if (config == null) initEndpointConfig(); // SOAPBinding configuration if (configurable instanceof CommonBindingProvider) { log.debug("Configure SOAPBinding"); if (config.hasFeature(EndpointFeature.MTOM)) { CommonBindingProvider provider = (CommonBindingProvider)configurable; ((CommonSOAPBinding)provider.getCommonBinding()).setMTOMEnabled(true); log.debug("Enable MTOM on endpoint " + getPortName()); } } else if (configurable instanceof DispatchBinding) { DispatchBinding dpb = (DispatchBinding)configurable; dpb.setValidateDispatch(config.hasFeature(EndpointFeature.VALIDATE_DISPATCH)); } } public UnifiedVirtualFile getRootFile() { return getServiceMetaData().getUnifiedMetaData().getRootFile(); } public void registerConfigObserver(Configurable observer) { configObservable.addObserver(observer); } public JAXBContextCache getJaxbCache() { return jaxbCache; } public String getConfigFile() { return configFile; } public String getConfigName() { return configName; } public CommonConfig getConfig() { // Make sure we have a configuration if (config == null) initEndpointConfig(); return config; } public void setConfigName(String configName) { setConfigNameInternal(configName, null); } public void setConfigName(String configName, String configFile) { setConfigNameInternal(configName, configFile); } private void setConfigNameInternal(String configName, String configFile) { if (configName == null) throw new IllegalArgumentException("Config name cannot be null"); if (configFile != null) this.configFile = configFile; if (configName.equals(this.configName) == false) { this.configName = configName; log.debug("Reconfiguration forced, new config is '" + configName + "'"); initEndpointConfig(); configObservable.doNotify(configName); } } public void initEndpointConfig() { log.debug("Create new config [name=" + getConfigName() + ",file=" + getConfigFile() + "]"); JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance(); List rmPortMetaData = backupRMMD(); config = factory.getConfig(getRootFile(), getConfigName(), getConfigFile()); propagateRMMD(rmPortMetaData); reconfigHandlerMetaData(); } private List backupRMMD() { if ((config != null) && (config.getRMMetaData() != null)) return config.getRMMetaData().getPorts(); return null; } private void propagateRMMD(List backedUpMD) { if ((backedUpMD != null) && (backedUpMD.size() > 0)) { if (config.getRMMetaData() == null) { config.setRMMetaData(new RMConfig()); config.getRMMetaData().getPorts().addAll(backedUpMD); } else { // RM policy specified in config file will be always used List ports = config.getRMMetaData().getPorts(); for (RMPortConfig portMD : backedUpMD) { QName portName = portMD.getPortName(); if (!contains(ports, portName)) { ports.add(portMD); } } } } } private boolean contains(List ports, QName portName) { for (RMPortConfig pMD : ports) { if (pMD.getPortName().equals(portName)) return true; } return false; } private void reconfigHandlerMetaData() { log.debug("Configure EndpointMetaData"); List sepHandlers = getHandlerMetaData(HandlerType.ENDPOINT); clearHandlers(); List preHandlers = config.getHandlers(this, HandlerType.PRE); List postHandlers = config.getHandlers(this, HandlerType.POST); addHandlers(preHandlers); addHandlers(sepHandlers); addHandlers(postHandlers); log.debug("Added " + preHandlers.size() + " PRE handlers"); log.debug("Added " + sepHandlers.size() + " ENDPOINT handlers"); log.debug("Added " + postHandlers.size() + " POST handlers"); } public List getRegisteredTypes() { return Collections.unmodifiableList(registeredTypes); } class ConfigObservable extends Observable { private List> observer = new ArrayList>(); public void doNotify(Object object) { setChanged(); notifyObservers(object); } public synchronized void addObserver(Observer o) { observer.add( new WeakReference(o)); } public synchronized void deleteObserver(Observer o) { for(WeakReference w : observer) { Observer tmp = w.get(); if(tmp.equals(o)) { observer.remove(o); break; } } } public void notifyObservers() { notifyObservers(null); } public void notifyObservers(Object arg) { if(hasChanged()) { for(WeakReference w : observer) { Observer tmp = w.get(); tmp.update(this, arg); } } } } public List getServiceRefContrib() { return serviceRefContrib; } public boolean matches(UnifiedPortComponentRefMetaData pcRef) { String seiName = pcRef.getServiceEndpointInterface(); QName portName = pcRef.getPortQName(); boolean match; if (seiName != null && portName != null) { match = getServiceEndpointInterfaceName().equals(seiName) && getPortName().equals(portName); } else { match = getServiceEndpointInterfaceName().equals(seiName) || getPortName().equals(portName); } return match; } public String getDocumentation() { return documentation; } public void setDocumentation(String documentation) { this.documentation = documentation; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/UnifiedMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/UnifiedMetaDat0000644000175000017500000001601010654066746031503 0ustar godgod/* * 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.metadata.umdm; // $Id: UnifiedMetaData.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import org.jboss.logging.Logger; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; /** * The top level meta data. * *

      Thread safety

      *

      A UnifiedMetaData instance may be shared accross threads provided that the following conditions are met: *

        *
      1. {@link #eagerInitialize() eagerInitialize()} is called from a single thread on startup
      2. *
      3. Multi-thread access is limited to read-only calls
      4. *

      * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 12-May-2005 */ public class UnifiedMetaData { // provide logging private static Logger log = Logger.getLogger(UnifiedMetaData.class); // The canonical deployment name private String deploymentName; // The modules class loader private ClassLoader classLoader; // The resource loader private UnifiedVirtualFile vfsRoot; // The optional security domain private String securityDomain; // The implementation version private static String implementationVersion; // True if this is a final release private static boolean isFinalRelease; // Map the wsdl-file to the wsdl Document // Note the same wsdl can be used in multiple webservice descriptions Map wsdlMap = new HashMap(); // Maps the jaxrpc-mapping-file to {@link JavaWsdlMapping} object // Note the same jaxrpc-mapping.xml can be used in multiple webservice descriptions Map jaxrpcMap = new HashMap(); // The list of service meta data private List services = new ArrayList(); // Used by eager initialization private boolean eagerInitialized; // Used by validate private boolean validated; public UnifiedMetaData(UnifiedVirtualFile vfsRoot) { if (vfsRoot == null) throw new IllegalArgumentException("VFS root cannot be null"); this.vfsRoot = vfsRoot; this.classLoader = Thread.currentThread().getContextClassLoader(); } public ClassLoader getClassLoader() { if (classLoader == null) throw new IllegalStateException("Class loader not available"); return classLoader; } public void setRootFile(UnifiedVirtualFile vfsRoot) { this.vfsRoot = vfsRoot; } public UnifiedVirtualFile getRootFile() { return vfsRoot; } public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } public String getDeploymentName() { return deploymentName; } public void setDeploymentName(String deploymentName) { this.deploymentName = deploymentName; } public String getSecurityDomain() { return securityDomain; } public void setSecurityDomain(String domain) { String prefix = "java:/jaas/"; if (domain != null && domain.startsWith(prefix)) domain = domain.substring(prefix.length()); this.securityDomain = domain; } public List getServices() { return new ArrayList(services); } public void addService(ServiceMetaData serviceMetaData) { services.add(serviceMetaData); } public void addWsdlDefinition(String wsdlFile, WSDLDefinitions wsdlDefinitions) { wsdlMap.put(wsdlFile, wsdlDefinitions); } public WSDLDefinitions getWsdlDefinition(String wsdlFile) { return wsdlMap.get(wsdlFile); } public void addMappingDefinition(String jaxrpcFile, JavaWsdlMapping javaWsdlMapping) { jaxrpcMap.put(jaxrpcFile, javaWsdlMapping); } public JavaWsdlMapping getMappingDefinition(String jaxrpcFile) { return jaxrpcMap.get(jaxrpcFile); } public void validate() { if (validated == false) { for (ServiceMetaData service : services) { service.validate(); } validated = true; } } public boolean isEagerInitialized() { return eagerInitialized; } /** * Eagerly initialize all cache values that are normally lazy-loaded. This * allows for concurrent read-only access to a UnifiedMetaData * instance. This method, however, must be called from a single thread. */ public synchronized void eagerInitialize() { if (eagerInitialized == false) { log.debug("Eagerly initialize the meta data model"); for (ServiceMetaData service : services) { service.eagerInitialize(); } eagerInitialized = true; } } public static String getImplementationVersion() { if (implementationVersion == null) { implementationVersion = UnifiedMetaData.class.getPackage().getImplementationVersion(); if (implementationVersion != null) isFinalRelease = new StringTokenizer(implementationVersion).nextToken().endsWith(".GA"); } return implementationVersion; } public static boolean isFinalRelease() { getImplementationVersion(); return isFinalRelease; } public String toString() { StringBuilder buffer = new StringBuilder("\nUnifiedMetaData: "); buffer.append("\n implementation: " + getImplementationVersion()); buffer.append("\n deploymentName: " + getDeploymentName()); buffer.append("\n securityDomain: " + getSecurityDomain()); //buffer.append("\n resourceLoader: " + resourceLoader); //buffer.append("\n classLoader: " + classLoader); buffer.append("\n"); for (ServiceMetaData serviceMetaData : services) { buffer.append(serviceMetaData); } return buffer.toString(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/HandlerMetaDat0000644000175000017500000000621610642000211031450 0ustar godgod/* * 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.metadata.umdm; //$Id:HandlerMetaDataJAXRPC.java 915 2006-09-08 08:40:45Z thomas.diesler@jboss.com $ import java.util.HashSet; import java.util.Set; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * The JAXRPC metdata data for a handler element * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public class HandlerMetaDataJAXRPC extends HandlerMetaData { private static final long serialVersionUID = -5232305815202943509L; // The optional elements private Set soapRoles = new HashSet(); // The optional elements private Set portNames = new HashSet(); public static HandlerMetaDataJAXRPC newInstance(UnifiedHandlerMetaData uhmd, HandlerType type) { HandlerMetaDataJAXRPC hmd = new HandlerMetaDataJAXRPC(type); hmd.setHandlerName(uhmd.getHandlerName()); hmd.setHandlerClassName(uhmd.getHandlerClass()); hmd.setInitParams(uhmd.getInitParams()); hmd.setSoapHeaders(uhmd.getSoapHeaders()); hmd.setSoapRoles(uhmd.getSoapRoles()); hmd.setPortNames(uhmd.getPortNames()); return hmd; } public HandlerMetaDataJAXRPC(HandlerType type) { super(type); } public void setSoapRoles(Set soapRoles) { this.soapRoles = soapRoles; } public Set getSoapRoles() { return soapRoles; } public void setPortNames(Set portNames) { this.portNames = portNames; } public Set getPortNames() { return portNames; } public String toString() { StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXRPC:"); buffer.append("\n type=" + getHandlerType()); buffer.append("\n name=" + getHandlerName()); buffer.append("\n class=" + getHandlerClassName()); buffer.append("\n params=" + getInitParams()); buffer.append("\n headers=" + getSoapHeaders()); buffer.append("\n roles=" + getSoapRoles()); buffer.append("\n ports=" + getPortNames()); return buffer.toString(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/AccessorFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/AccessorFactor0000644000175000017500000000145010543061077031550 0ustar godgod/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. * * This is free software; you can redistribute it and/or modify it * under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as * published by JBoss Inc.; either version 1.0 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. */ package org.jboss.ws.metadata.umdm; /** * @author Jason T. Greene * @version $Revision: 1760 $ */ public interface AccessorFactory { public Accessor create(WrappedParameter parameter); }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/HandlerMetaDataJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/HandlerMetaDat0000644000175000017500000000727210642000211031453 0ustar godgod/* * 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.metadata.umdm; //$Id: HandlerMetaDataJAXWS.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * The JAXWS metdata data for a handler element * * @author Thomas.Diesler@jboss.org * @since 05-May-2006 */ public class HandlerMetaDataJAXWS extends HandlerMetaData { private static final long serialVersionUID = 7631133188974299826L; // The JAXWS service name pattern private QName serviceNamePattern; // The JAXWS port name pattern private QName portNamePattern; // The JAXWS protocol bindings private String protocolBindings; public static HandlerMetaDataJAXWS newInstance(UnifiedHandlerMetaData uhmd, HandlerType type) { HandlerMetaDataJAXWS hmd = new HandlerMetaDataJAXWS(type); hmd.setHandlerName(uhmd.getHandlerName()); hmd.setHandlerClassName(uhmd.getHandlerClass()); hmd.setInitParams(uhmd.getInitParams()); UnifiedHandlerChainMetaData handlerChain = uhmd.getHandlerChain(); if (handlerChain != null) { hmd.setProtocolBindings(handlerChain.getProtocolBindings()); hmd.setServiceNamePattern(handlerChain.getServiceNamePattern()); hmd.setPortNamePattern(handlerChain.getPortNamePattern()); } return hmd; } public HandlerMetaDataJAXWS(HandlerType type) { super(type); } public QName getPortNamePattern() { return portNamePattern; } public void setPortNamePattern(QName portNamePattern) { this.portNamePattern = portNamePattern; } public String getProtocolBindings() { return protocolBindings; } public void setProtocolBindings(String protocolBindings) { this.protocolBindings = protocolBindings; } public QName getServiceNamePattern() { return serviceNamePattern; } public void setServiceNamePattern(QName serviceNamePattern) { this.serviceNamePattern = serviceNamePattern; } public String toString() { StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXWS:"); buffer.append("\n type=" + getHandlerType()); buffer.append("\n name=" + getHandlerName()); buffer.append("\n class=" + getHandlerClass()); buffer.append("\n params=" + getInitParams()); buffer.append("\n protocols=" + getProtocolBindings()); buffer.append("\n services=" + getServiceNamePattern()); buffer.append("\n ports=" + getPortNamePattern()); return buffer.toString(); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/TypeMappingMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/umdm/TypeMappingMet0000644000175000017500000000636210542776150031565 0ustar godgod/* * 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.metadata.umdm; // $Id: TypeMappingMetaData.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.util.Arrays; import java.util.List; import javax.xml.namespace.QName; /** * Type mapping meta data * * @author Thomas.Diesler@jboss.org * @since 12-May-2005 */ public class TypeMappingMetaData { // The parent meta data. private TypesMetaData typesMetaData; private QName xmlType; private String javaTypeName; private String qnameScope; // List of allowed qname scopes public static final String QNAME_SCOPE_SIMPLE_TYPE = "simpleType"; public static final String QNAME_SCOPE_COMPLEX_TYPE = "complexType"; public static final String QNAME_SCOPE_ELEMENT = "element"; private static List allowedScopes = Arrays.asList(new String[] { QNAME_SCOPE_COMPLEX_TYPE, QNAME_SCOPE_SIMPLE_TYPE, QNAME_SCOPE_ELEMENT }); public TypeMappingMetaData(TypesMetaData typesMetaData, QName xmlType, String javaTypeName) { if (xmlType == null) throw new IllegalArgumentException("Invalid null xmlType"); if (javaTypeName == null) throw new IllegalArgumentException("Invalid null javaTypeName"); this.typesMetaData = typesMetaData; this.javaTypeName = javaTypeName; this.xmlType = xmlType; this.qnameScope = QNAME_SCOPE_COMPLEX_TYPE; } public TypesMetaData getTypesMetaData() { return typesMetaData; } public String getJavaTypeName() { return javaTypeName; } public QName getXmlType() { return xmlType; } public String getQNameScope() { return qnameScope; } public void setQNameScope(String qnameScope) { if (allowedScopes.contains(qnameScope) == false) throw new IllegalArgumentException("Invalid qname scope: " + qnameScope); this.qnameScope = qnameScope; } public int hashCode() { return toString().hashCode(); } public boolean equals(Object obj) { if (obj instanceof TypeMappingMetaData == false) return false; TypeMappingMetaData other = (TypeMappingMetaData)obj; return toString().equals(other.toString()); } public String toString() { return "[" + qnameScope + "=" + xmlType + ",javaType=" + javaTypeName + "]"; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/0000755000175000017500000000000010755000261030616 5ustar godgod././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/ExceptionMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/Excep0000644000175000017500000000675410542776150031634 0ustar godgod/* * 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.metadata.jaxrpcmapping; // $Id: ExceptionMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import javax.xml.namespace.QName; /** * XML mapping of the java-wsdl-mapping/exception-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class ExceptionMapping implements Serializable { private static final long serialVersionUID = 2964098233936811614L; // The parent element private JavaWsdlMapping javaWsdlMapping; // The required element private String exceptionType; // The required element private QName wsdlMessage; // The optional element private ArrayList constructorParameterOrder = new ArrayList(); public ExceptionMapping(JavaWsdlMapping javaWsdlMapping) { this.javaWsdlMapping = javaWsdlMapping; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } public String getExceptionType() { return exceptionType; } public void setExceptionType(String exceptionType) { this.exceptionType = exceptionType; } public QName getWsdlMessage() { return wsdlMessage; } public void setWsdlMessage(QName wsdlMessage) { this.wsdlMessage = wsdlMessage; } public String[] getConstructorParameterOrder() { String[] arr = new String[constructorParameterOrder.size()]; constructorParameterOrder.toArray(arr); return arr; } public void addConstructorParameter(String elementName) { constructorParameterOrder.add(elementName); } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append(""); sb.append("").append(exceptionType).append(""); sb.append(""); sb.append("exMsgNS").append(":").append(wsdlMessage.getLocalPart()); sb.append(""); if (constructorParameterOrder.size() > 0) { sb.append(""); for (Iterator i = constructorParameterOrder.iterator(); i.hasNext();) sb.append("").append(i.next()).append(""); sb.append(""); } sb.append(""); return sb.toString(); } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/VariableMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/Varia0000644000175000017500000000722710542776150031626 0ustar godgod/* * 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.metadata.jaxrpcmapping; import java.io.Serializable; // $Id: VariableMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * XML mapping of the java-wsdl-mapping/java-xml-type-mapping/varaible-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class VariableMapping implements Serializable { private static final long serialVersionUID = 4168728468137337167L; // The parent element private JavaXmlTypeMapping typeMapping; // The required element private String javaVariableName; // The optional element private boolean dataMember; // The choice [ | | ] private String xmlAttributeName; private String xmlElementName; private boolean xmlWildcard; public VariableMapping(JavaXmlTypeMapping typeMapping) { this.typeMapping = typeMapping; } public JavaXmlTypeMapping getTypeMapping() { return typeMapping; } public boolean isDataMember() { return dataMember; } public void setDataMember(boolean dataMember) { this.dataMember = dataMember; } public String getJavaVariableName() { return javaVariableName; } public void setJavaVariableName(String javaVariableName) { this.javaVariableName = javaVariableName; } public String getXmlAttributeName() { return xmlAttributeName; } public void setXmlAttributeName(String xmlAttributeName) { this.xmlAttributeName = xmlAttributeName; } public String getXmlElementName() { return xmlElementName; } public void setXmlElementName(String xmlElementName) { this.xmlElementName = xmlElementName; } public boolean getXmlWildcard() { return xmlWildcard; } public void setXmlWildcard(boolean xmlWildcard) { this.xmlWildcard = xmlWildcard; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append(""); sb.append("").append(javaVariableName).append(""); if(dataMember) { sb.append(""); } if (xmlElementName != null) { sb.append("").append(xmlElementName).append(""); } else if (xmlAttributeName != null) { sb.append("").append(xmlAttributeName).append(""); } else if (xmlWildcard) { sb.append(""); } sb.append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/PortMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/PortM0000644000175000017500000000500410542776150031614 0ustar godgod/* * 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.metadata.jaxrpcmapping; import java.io.Serializable; // $Id: PortMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * XML mapping of the java-wsdl-mapping/service-interface-mapping/port-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class PortMapping implements Serializable { private static final long serialVersionUID = 8229257516720800393L; // The parent element private ServiceInterfaceMapping serviceInterfaceMapping; // The required element private String portName; // The required element private String javaPortName; public PortMapping(ServiceInterfaceMapping serviceInterfaceMapping) { this.serviceInterfaceMapping = serviceInterfaceMapping; } public ServiceInterfaceMapping getServiceInterfaceMapping() { return serviceInterfaceMapping; } public String getJavaPortName() { return javaPortName; } public void setJavaPortName(String javaPortName) { this.javaPortName = javaPortName; } public String getPortName() { return portName; } public void setPortName(String portName) { this.portName = portName; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append("").append(portName).append(""); sb.append(javaPortName).append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMappingFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/JavaW0000644000175000017500000005007010553526221031560 0ustar godgod/* * 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.metadata.jaxrpcmapping; // $Id: JavaWsdlMappingFactory.java 1991 2007-01-17 23:09:05Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.net.URL; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.core.utils.ResourceURL; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; /** * A JBossXB factory for {@link org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping} * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class JavaWsdlMappingFactory implements ObjectModelFactory { // provide logging private static Logger log = Logger.getLogger(JavaWsdlMappingFactory.class); // Hide constructor private JavaWsdlMappingFactory() { } /** * Create a new instance of a jaxrpc-mapping factory */ public static JavaWsdlMappingFactory newInstance() { return new JavaWsdlMappingFactory(); } /** * Factory method for JavaWsdlMapping */ public JavaWsdlMapping parse(URL mappingURL) throws IOException { if (mappingURL == null) { throw new IllegalArgumentException("JAXRPC mapping URL cannot be null"); } // setup the XML binding Unmarshaller InputStream is = new ResourceURL(mappingURL).openStream(); try { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); JavaWsdlMapping javaWsdlMapping = (JavaWsdlMapping)unmarshaller.unmarshal(is, this, null); return javaWsdlMapping; } catch (JBossXBException e) { IOException ioex = new IOException("Cannot parse: " + mappingURL); Throwable cause = e.getCause(); if (cause != null) ioex.initCause(cause); throw ioex; } finally { is.close(); } } /** * This method is called on the factory by the object model builder when the parsing starts. */ public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return new JavaWsdlMapping(); } public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name) { return root; } /** * Called when parsing of a new element started. */ public Object newChild(JavaWsdlMapping javaWsdlMapping, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("package-mapping".equals(localName)) { return new PackageMapping(javaWsdlMapping); } if ("java-xml-type-mapping".equals(localName)) { return new JavaXmlTypeMapping(javaWsdlMapping); } if ("exception-mapping".equals(localName)) { return new ExceptionMapping(javaWsdlMapping); } if ("service-interface-mapping".equals(localName)) { return new ServiceInterfaceMapping(javaWsdlMapping); } if ("service-endpoint-interface-mapping".equals(localName)) { return new ServiceEndpointInterfaceMapping(javaWsdlMapping); } return null; } /** * Called when parsing character is complete. */ public void addChild(JavaWsdlMapping javaWsdlMapping, PackageMapping packageMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" + packageMapping + "]"); javaWsdlMapping.addPackageMapping(packageMapping); } /** * Called when parsing character is complete. */ public void addChild(JavaWsdlMapping javaWsdlMapping, JavaXmlTypeMapping typeMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" + typeMapping + "]"); javaWsdlMapping.addJavaXmlTypeMappings(typeMapping); } /** * Called when parsing character is complete. */ public void addChild(JavaWsdlMapping javaWsdlMapping, ExceptionMapping exceptionMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" + exceptionMapping + "]"); javaWsdlMapping.addExceptionMappings(exceptionMapping); } /** * Called when parsing character is complete. */ public void addChild(JavaWsdlMapping javaWsdlMapping, ServiceInterfaceMapping siMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" + siMapping + "]"); javaWsdlMapping.addServiceInterfaceMappings(siMapping); } /** * Called when parsing character is complete. */ public void addChild(JavaWsdlMapping javaWsdlMapping, ServiceEndpointInterfaceMapping seiMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + javaWsdlMapping + ",child=" + seiMapping + "]"); javaWsdlMapping.addServiceEndpointInterfaceMappings(seiMapping); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(PackageMapping packageMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + packageMapping + ",localName=" + localName + ",value=" + value + "]"); if ("package-type".equals(localName)) { packageMapping.setPackageType(value); } else if ("namespaceURI".equals(localName)) { packageMapping.setNamespaceURI(value); } } /** * Called when parsing of a new element started. */ public Object newChild(JavaXmlTypeMapping typeMapping, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("variable-mapping".equals(localName)) { return new VariableMapping(typeMapping); } return null; } /** * Called when parsing character is complete. */ public void addChild(JavaXmlTypeMapping typeMapping, VariableMapping variableMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + typeMapping + ",child=" + variableMapping + "]"); typeMapping.addVariableMapping(variableMapping); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(JavaXmlTypeMapping typeMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + typeMapping + ",localName=" + localName + ",value=" + value + "]"); if ("java-type".equals(localName)) { typeMapping.setJavaType(value); } else if ("root-type-qname".equals(localName)) { QName qname = navigator.resolveQName(value); typeMapping.setRootTypeQName(qname); } else if ("anonymous-type-qname".equals(localName)) { QName qname = null; try { // typeNS:>root qname = navigator.resolveQName(value); } catch (Exception e) { // ignore unresolved qname } if (qname == null) { // http://example.com/stockquote/schemas:>GetLastTradePrice int index = value.lastIndexOf(':'); if (index > 0) { String nsURI = value.substring(0, index); String localPart = value.substring(index + 1); qname = new QName(nsURI, localPart); } } if (qname == null) throw new IllegalArgumentException("Invalid anonymous qname: " + value); typeMapping.setAnonymousTypeQName(qname); } else if ("qname-scope".equals(localName)) { typeMapping.setQNameScope(value); } } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(ExceptionMapping exceptionMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + exceptionMapping + ",localName=" + localName + ",value=" + value + "]"); if ("exception-type".equals(localName)) { exceptionMapping.setExceptionType(value); } else if ("wsdl-message".equals(localName)) { exceptionMapping.setWsdlMessage(navigator.resolveQName(value)); } else if ("constructor-parameter-order".equals(localName)) { exceptionMapping.addConstructorParameter(value); } } /** * Called when parsing of a new element started. */ public Object newChild(ServiceInterfaceMapping siMapping, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("port-mapping".equals(localName)) { return new PortMapping(siMapping); } return null; } /** * Called when parsing character is complete. */ public void addChild(ServiceInterfaceMapping siMapping, PortMapping portMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + siMapping + ",child=" + portMapping + "]"); siMapping.addPortMapping(portMapping); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(ServiceInterfaceMapping siMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + siMapping + ",localName=" + localName + ",value=" + value + "]"); if ("service-interface".equals(localName)) { siMapping.setServiceInterface(value); } else if ("wsdl-service-name".equals(localName)) { siMapping.setWsdlServiceName(navigator.resolveQName(value)); } } /** * Called when parsing of a new element started. */ public Object newChild(ServiceEndpointInterfaceMapping seiMapping, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("service-endpoint-method-mapping".equals(localName)) { return new ServiceEndpointMethodMapping(seiMapping); } return null; } /** * Called when parsing character is complete. */ public void addChild(ServiceEndpointInterfaceMapping seiMapping, ServiceEndpointMethodMapping seiMethodMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + seiMapping + ",child=" + seiMapping + "]"); seiMapping.addServiceEndpointMethodMapping(seiMethodMapping); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(ServiceEndpointInterfaceMapping seiMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + seiMapping + ",localName=" + localName + ",value=" + value + "]"); if ("service-endpoint-interface".equals(localName)) { seiMapping.setServiceEndpointInterface(value); } else if ("wsdl-port-type".equals(localName)) { seiMapping.setWsdlPortType(navigator.resolveQName(value)); } else if ("wsdl-binding".equals(localName)) { seiMapping.setWsdlBinding(navigator.resolveQName(value)); } } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(VariableMapping variableMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + variableMapping + ",localName=" + localName + ",value=" + value + "]"); if ("java-variable-name".equals(localName)) { variableMapping.setJavaVariableName(value); } else if ("data-member".equals(localName)) { variableMapping.setDataMember(true); } else if ("xml-attribute-name".equals(localName)) { variableMapping.setXmlAttributeName(value); } else if ("xml-element-name".equals(localName)) { variableMapping.setXmlElementName(value); } } /** * Called when parsing of a new element started. */ public Object newChild(VariableMapping variableMapping, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("data-member".equals(localName)) { variableMapping.setDataMember(true); } else if ("xml-wildcard".equals(localName)) { variableMapping.setXmlWildcard(true); } return null; } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(PortMapping portMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + portMapping + ",localName=" + localName + ",value=" + value + "]"); if ("port-name".equals(localName)) { portMapping.setPortName(value); } else if ("java-port-name".equals(localName)) { portMapping.setJavaPortName(value); } } /** * Called when parsing of a new element started. */ public Object newChild(ServiceEndpointMethodMapping methodMapping, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("method-param-parts-mapping".equals(localName)) { return new MethodParamPartsMapping(methodMapping); } if ("wsdl-return-value-mapping".equals(localName)) { return new WsdlReturnValueMapping(methodMapping); } if ("wrapped-element".equals(localName)) { methodMapping.setWrappedElement(true); } return null; } /** * Called when parsing character is complete. */ public void addChild(ServiceEndpointMethodMapping methodMapping, MethodParamPartsMapping partsMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + methodMapping + ",child=" + partsMapping + "]"); methodMapping.addMethodParamPartsMapping(partsMapping); } /** * Called when parsing character is complete. */ public void addChild(ServiceEndpointMethodMapping methodMapping, WsdlReturnValueMapping returnValueMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + methodMapping + ",child=" + returnValueMapping + "]"); methodMapping.setWsdlReturnValueMapping(returnValueMapping); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(ServiceEndpointMethodMapping methodMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + methodMapping + ",localName=" + localName + ",value=" + value + "]"); if ("java-method-name".equals(localName)) { methodMapping.setJavaMethodName(value); } else if ("wsdl-operation".equals(localName)) { methodMapping.setWsdlOperation(value); } } /** * Called when parsing of a new element started. */ public Object newChild(MethodParamPartsMapping partsMapping, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("wsdl-message-mapping".equals(localName)) { return new WsdlMessageMapping(partsMapping); } return null; } /** * Called when parsing character is complete. */ public void addChild(MethodParamPartsMapping partsMapping, WsdlMessageMapping msgMapping, UnmarshallingContext navigator, String namespaceURI, String localName) { log.trace("addChild: [obj=" + partsMapping + ",child=" + msgMapping + "]"); partsMapping.setWsdlMessageMapping(msgMapping); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(MethodParamPartsMapping partsMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + partsMapping + ",localName=" + localName + ",value=" + value + "]"); if ("param-position".equals(localName)) { partsMapping.setParamPosition(new Integer(value).intValue()); } else if ("param-type".equals(localName)) { partsMapping.setParamType(value); } } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(WsdlReturnValueMapping retValueMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + retValueMapping + ",localName=" + localName + ",value=" + value + "]"); if ("method-return-value".equals(localName)) { retValueMapping.setMethodReturnValue(value); } else if ("wsdl-message".equals(localName)) { retValueMapping.setWsdlMessage(navigator.resolveQName(value)); } else if ("wsdl-message-part-name".equals(localName)) { retValueMapping.setWsdlMessagePartName(value); } } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(WsdlMessageMapping msgMapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { log.trace("setValue: [obj=" + msgMapping + ",localName=" + localName + ",value=" + value + "]"); if ("wsdl-message".equals(localName)) { msgMapping.setWsdlMessage(navigator.resolveQName(value)); } else if ("wsdl-message-part-name".equals(localName)) { msgMapping.setWsdlMessagePartName(value); } else if ("parameter-mode".equals(localName)) { msgMapping.setParameterMode(value); } } /** * Called when parsing of a new element started. */ public Object newChild(WsdlMessageMapping msgMapping, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("newChild: " + localName); if ("soap-header".equals(localName)) { msgMapping.setSoapHeader(true); } return null; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/JavaXmlTypeMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/JavaX0000644000175000017500000001122010542776150031561 0ustar godgod/* * 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.metadata.jaxrpcmapping; // $Id: JavaXmlTypeMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import java.util.ArrayList; import javax.xml.namespace.QName; /** * XML mapping of the java-wsdl-mapping/java-xml-type-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class JavaXmlTypeMapping implements Serializable { private static final long serialVersionUID = -7671078579082015103L; // The parent element private JavaWsdlMapping javaWsdlMapping; /** The required element * The java-type element is the fully qualified class name of a Java class. */ private String javaType; // The choice element private QName rootTypeQName; // The choice element private QName anonymousTypeQName; /** The required element * The qname-scope elements scopes the reference of a QName to the WSDL element type it applies to. * The value of qname-scope may be simpleType, complexType, or element */ private String qnameScope; // Zero or more elements private ArrayList variableMappings = new ArrayList(); public JavaXmlTypeMapping(JavaWsdlMapping javaWsdlMapping) { this.javaWsdlMapping = javaWsdlMapping; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } public String getJavaType() { return javaType; } public void setJavaType(String javaType) { this.javaType = javaType; } public String getQnameScope() { return qnameScope; } public void setQNameScope(String qnameScope) { this.qnameScope = qnameScope; } public QName getRootTypeQName() { return rootTypeQName; } public void setRootTypeQName(QName rootTypeQName) { this.rootTypeQName = rootTypeQName; } public QName getAnonymousTypeQName() { return anonymousTypeQName; } public void setAnonymousTypeQName(QName anonymousTypeQName) { this.anonymousTypeQName = anonymousTypeQName; } public VariableMapping[] getVariableMappings() { VariableMapping[] arr = new VariableMapping[variableMappings.size()]; variableMappings.toArray(arr); return arr; } public void addVariableMapping(VariableMapping variableMapping) { variableMappings.add(variableMapping); } public String toString() { return "[qname=" + rootTypeQName + ",javaType=" + javaType + ",scope=" + qnameScope + "]"; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append(""); sb.append("").append(javaType).append(""); if (rootTypeQName != null) { sb.append(""); sb.append(rootTypeQName.getPrefix()).append(":").append(rootTypeQName.getLocalPart()); sb.append(""); } if (anonymousTypeQName != null) { sb.append(""); sb.append(anonymousTypeQName.getPrefix()).append(":").append(anonymousTypeQName.getLocalPart()); sb.append(""); } sb.append("").append(qnameScope).append(""); int len = variableMappings.size(); for(int i = 0 ; i < len ; i ++) sb.append(((VariableMapping)variableMappings.get(i)).serialize()); sb.append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/MethodParamPartsMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/Metho0000644000175000017500000000631510542776150031635 0ustar godgod/* * 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.metadata.jaxrpcmapping; import java.io.Serializable; // $Id: MethodParamPartsMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * XML mapping of the java-wsdl-mapping/service-endpoint-interface-mapping/service-endpoint-method-mapping/method-param-parts-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class MethodParamPartsMapping implements Serializable { private static final long serialVersionUID = -1351920471783503813L; // The parent element private ServiceEndpointMethodMapping serviceEndpointMethodMapping; // The required element private int paramPosition; // The required element private String paramType; // The required element private WsdlMessageMapping wsdlMessageMapping; public MethodParamPartsMapping(ServiceEndpointMethodMapping serviceEndpointMethodMapping) { this.serviceEndpointMethodMapping = serviceEndpointMethodMapping; } public ServiceEndpointMethodMapping getServiceEndpointMethodMapping() { return serviceEndpointMethodMapping; } public int getParamPosition() { return paramPosition; } public void setParamPosition(int paramPosition) { this.paramPosition = paramPosition; } public String getParamType() { return paramType; } public void setParamType(String paramType) { this.paramType = paramType; } public WsdlMessageMapping getWsdlMessageMapping() { return wsdlMessageMapping; } public void setWsdlMessageMapping(WsdlMessageMapping wsdlMessageMapping) { this.wsdlMessageMapping = wsdlMessageMapping; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append("").append(paramPosition).append(""); sb.append("").append(paramType).append(""); if(wsdlMessageMapping == null) throw new IllegalStateException("wsdlMessageMapping is null"); sb.append(wsdlMessageMapping.serialize()); sb.append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/JavaWsdlMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/JavaW0000644000175000017500000002537610542776150031601 0ustar godgod/* * 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.metadata.jaxrpcmapping; // $Id: JavaWsdlMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import org.jboss.logging.Logger; /** * XML mapping of the java-wsdl-mapping root element in jaxrpc-mapping.xml * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class JavaWsdlMapping implements Serializable { private static final long serialVersionUID = -142671631068024054L; // provide logging private static Logger log = Logger.getLogger(JavaWsdlMapping.class); // One or more elements private List packageMappings = new ArrayList(); // Zero or more elements private List javaXmlTypeMappings = new ArrayList(); // Zero or more elements private List exceptionMappings = new ArrayList(); // Zero or more elements private List serviceInterfaceMappings = new ArrayList(); // Zero or more elements private List serviceEndpointInterfaceMappings = new ArrayList(); public PackageMapping[] getPackageMappings() { PackageMapping[] arr = new PackageMapping[packageMappings.size()]; packageMappings.toArray(arr); return arr; } public JavaXmlTypeMapping[] getJavaXmlTypeMappings() { JavaXmlTypeMapping[] arr = new JavaXmlTypeMapping[javaXmlTypeMappings.size()]; javaXmlTypeMappings.toArray(arr); return arr; } public ExceptionMapping[] getExceptionMappings() { ExceptionMapping[] arr = new ExceptionMapping[exceptionMappings.size()]; exceptionMappings.toArray(arr); return arr; } public ServiceInterfaceMapping[] getServiceInterfaceMappings() { ServiceInterfaceMapping[] arr = new ServiceInterfaceMapping[serviceInterfaceMappings.size()]; serviceInterfaceMappings.toArray(arr); return arr; } public ServiceEndpointInterfaceMapping[] getServiceEndpointInterfaceMappings() { ServiceEndpointInterfaceMapping[] arr = new ServiceEndpointInterfaceMapping[serviceEndpointInterfaceMappings.size()]; serviceEndpointInterfaceMappings.toArray(arr); return arr; } // convenience methods ******************************************************************** /** Get the package string for a given URI */ public String getPackageNameForNamespaceURI(String nsURI) { String packageStr = null; for (int i = 0; packageStr == null && i < packageMappings.size(); i++) { PackageMapping mapping = (PackageMapping)packageMappings.get(i); if (mapping.getNamespaceURI().equals(nsURI)) packageStr = mapping.getPackageType(); } return packageStr; } /** Get the type mapping fo a given root-type-qname */ public JavaXmlTypeMapping getTypeMappingForQName(QName xmlType) { JavaXmlTypeMapping typeMapping = null; if (xmlType != null) { // Check the Iterator it = javaXmlTypeMappings.iterator(); while (typeMapping == null && it.hasNext()) { JavaXmlTypeMapping mapping = (JavaXmlTypeMapping)it.next(); if (xmlType.equals(mapping.getRootTypeQName())) typeMapping = mapping; } // Check the it = javaXmlTypeMappings.iterator(); while (typeMapping == null && it.hasNext()) { JavaXmlTypeMapping mapping = (JavaXmlTypeMapping)it.next(); QName anonymousQName = mapping.getAnonymousTypeQName(); if (anonymousQName != null) { if (xmlType.getNamespaceURI().equals(anonymousQName.getNamespaceURI())) { String localPart = xmlType.getLocalPart(); if (anonymousQName.getLocalPart().equals(localPart)) typeMapping = mapping; if (anonymousQName.getLocalPart().equals(">" + localPart)) typeMapping = mapping; } } } if (typeMapping == null) log.warn("Cannot find jaxrpc-mapping for type: " + xmlType); } return typeMapping; } /** Get the exception mapping fo a given wsdl message */ public ExceptionMapping getExceptionMappingForMessageQName(QName wsdlMessage) { ExceptionMapping exMapping = null; if (wsdlMessage != null) { Iterator it = exceptionMappings.iterator(); while (it.hasNext()) { ExceptionMapping mapping = (ExceptionMapping)it.next(); if (wsdlMessage.equals(mapping.getWsdlMessage())) exMapping = mapping; } } return exMapping; } /** Get the exception mapping fo a given exception type */ public ExceptionMapping getExceptionMappingForExceptionType(String javaType) { ExceptionMapping exMapping = null; if (javaType != null) { Iterator it = exceptionMappings.iterator(); while (it.hasNext()) { ExceptionMapping mapping = (ExceptionMapping)it.next(); if (javaType.equals(mapping.getExceptionType())) exMapping = mapping; } } return exMapping; } /** Get the port type qname for a given service endpoint infterface */ public QName getPortTypeQNameForServiceEndpointInterface(String seiName) { QName portTypeQName = null; ServiceEndpointInterfaceMapping[] seiMappings = getServiceEndpointInterfaceMappings(); for (int i = 0; i < seiMappings.length; i++) { ServiceEndpointInterfaceMapping aux = seiMappings[i]; if (aux.getServiceEndpointInterface().equals(seiName)) portTypeQName = aux.getWsdlPortType(); } return portTypeQName; } /** Get the service endpoint infterfacemapping for a given port type qname */ public ServiceEndpointInterfaceMapping getServiceEndpointInterfaceMappingByPortType(QName portType) { ServiceEndpointInterfaceMapping seiMapping = null; ServiceEndpointInterfaceMapping[] seiMappings = getServiceEndpointInterfaceMappings(); for (int i = 0; seiMapping == null && i < seiMappings.length; i++) { ServiceEndpointInterfaceMapping aux = seiMappings[i]; if (aux.getWsdlPortType().equals(portType)) seiMapping = aux; } return seiMapping; } /** Get the service endpoint infterface mapping for a service endpoint infterface */ public ServiceEndpointInterfaceMapping getServiceEndpointInterfaceMapping(String seiName) { ServiceEndpointInterfaceMapping seiMapping = null; ServiceEndpointInterfaceMapping[] seiMappings = getServiceEndpointInterfaceMappings(); for (int i = 0; seiMapping == null && i < seiMappings.length; i++) { ServiceEndpointInterfaceMapping aux = seiMappings[i]; if (aux.getServiceEndpointInterface().equals(seiName)) seiMapping = aux; } return seiMapping; } /** * Serialize the model as a String (Should return the mapping file) * * @return */ public String serialize() { StringBuffer sb = new StringBuffer(); //Append Standard Namespace Header sb.append(""); Iterator piter = packageMappings.iterator(); while (piter != null && piter.hasNext()) sb.append(((PackageMapping)piter.next()).serialize()); Iterator jxiter = javaXmlTypeMappings.iterator(); while (jxiter.hasNext()) sb.append(((JavaXmlTypeMapping)jxiter.next()).serialize()); for (Iterator i = exceptionMappings.iterator(); i.hasNext();) sb.append(((ExceptionMapping)i.next()).serialize()); // A is followed by 1 or many elements int lenSIM = serviceInterfaceMappings.size(); for (int i = 0; i < lenSIM; i++) { ServiceInterfaceMapping sim = (ServiceInterfaceMapping)serviceInterfaceMappings.get(i); sb.append(sim.serialize()); ServiceEndpointInterfaceMapping seim = (ServiceEndpointInterfaceMapping)serviceEndpointInterfaceMappings.get(i); sb.append(seim.serialize()); } int lenSEI = serviceEndpointInterfaceMappings.size(); for (int i = lenSIM; i < lenSEI; i++) { ServiceEndpointInterfaceMapping seim = (ServiceEndpointInterfaceMapping)serviceEndpointInterfaceMappings.get(i); sb.append(seim.serialize()); } sb.append(""); return sb.toString(); } // factory methods ******************************************************************** public void addPackageMapping(PackageMapping packageMapping) { packageMappings.add(packageMapping); } public void addJavaXmlTypeMappings(JavaXmlTypeMapping typeMapping) { javaXmlTypeMappings.add(typeMapping); } public void addExceptionMappings(ExceptionMapping exceptionMapping) { exceptionMappings.add(exceptionMapping); } public void addServiceInterfaceMappings(ServiceInterfaceMapping serviceInterfaceMapping) { serviceInterfaceMappings.add(serviceInterfaceMapping); } public void addServiceEndpointInterfaceMappings(ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping) { serviceEndpointInterfaceMappings.add(serviceEndpointInterfaceMapping); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/WsdlReturnValueMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/WsdlR0000644000175000017500000000661210542776150031614 0ustar godgod/* * 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.metadata.jaxrpcmapping; // $Id: WsdlReturnValueMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import javax.xml.namespace.QName; /** * XML mapping of the java-wsdl-mapping/service-endpoint-interface-mapping/service-endpoint-method-mapping/wsdl-return-value-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class WsdlReturnValueMapping implements Serializable { private static final long serialVersionUID = -6910106650463959774L; // The parent element private ServiceEndpointMethodMapping serviceEndpointMethodMapping; // The required element private String methodReturnValue; // The required element private QName wsdlMessage; // The optional element private String wsdlMessagePartName; public WsdlReturnValueMapping(ServiceEndpointMethodMapping serviceEndpointMethodMapping) { this.serviceEndpointMethodMapping = serviceEndpointMethodMapping; } public ServiceEndpointMethodMapping getServiceEndpointMethodMapping() { return serviceEndpointMethodMapping; } public String getMethodReturnValue() { return methodReturnValue; } public void setMethodReturnValue(String methodReturnValue) { this.methodReturnValue = methodReturnValue; } public QName getWsdlMessage() { return wsdlMessage; } public void setWsdlMessage(QName wsdlMessage) { this.wsdlMessage = wsdlMessage; } public String getWsdlMessagePartName() { return wsdlMessagePartName; } public void setWsdlMessagePartName(String wsdlMessagePartName) { this.wsdlMessagePartName = wsdlMessagePartName; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append("").append(methodReturnValue).append(""); sb.append("").append(wsdlMessage.getPrefix()).append(":").append(wsdlMessage.getLocalPart()).append(""); sb.append("").append(wsdlMessagePartName).append(""); sb.append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/ServiceInterfaceMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/Servi0000644000175000017500000000672410542776150031655 0ustar godgod/* * 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.metadata.jaxrpcmapping; // $Id: ServiceInterfaceMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; /** * XML mapping of the java-wsdl-mapping/service-interface-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class ServiceInterfaceMapping implements Serializable { private static final long serialVersionUID = -447051823681281236L; // The parent element private JavaWsdlMapping javaWsdlMapping; // The required element private String serviceInterface; // The required element private QName wsdlServiceName; // Zero or more elements private List portMappings = new ArrayList(); public ServiceInterfaceMapping(JavaWsdlMapping javaWsdlMapping) { this.javaWsdlMapping = javaWsdlMapping; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } public String getServiceInterface() { return serviceInterface; } public void setServiceInterface(String serviceInterface) { this.serviceInterface = serviceInterface; } public QName getWsdlServiceName() { return wsdlServiceName; } public void setWsdlServiceName(QName wsdlServiceName) { this.wsdlServiceName = wsdlServiceName; } public PortMapping[] getPortMappings() { PortMapping[] arr = new PortMapping[portMappings.size()]; portMappings.toArray(arr); return arr; } public void addPortMapping(PortMapping portMapping) { portMappings.add(portMapping); } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append(""); sb.append("").append(serviceInterface).append(""); sb.append(""); sb.append(wsdlServiceName.getPrefix()).append(":").append(wsdlServiceName.getLocalPart()); sb.append(""); Iterator iter = portMappings.iterator(); while(iter != null && iter.hasNext()) sb.append(((PortMapping)iter.next()).serialize()); sb.append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/PackageMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/Packa0000644000175000017500000000514110542776150031574 0ustar godgod/* * 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.metadata.jaxrpcmapping; import java.io.Serializable; // $Id: PackageMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * XML mapping of the java-wsdl-mapping/package-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class PackageMapping implements Serializable { private static final long serialVersionUID = 8105452343429986503L; // The parent element private JavaWsdlMapping javaWsdlMapping; // The required element private String packageType; // The required element private String namespaceURI; public PackageMapping(JavaWsdlMapping javaWsdlMapping) { this.javaWsdlMapping = javaWsdlMapping; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } public String getNamespaceURI() { return namespaceURI; } public void setNamespaceURI(String namespaceURI) { this.namespaceURI = namespaceURI; } public String getPackageType() { return packageType; } public void setPackageType(String packageType) { this.packageType = packageType; } public String toString() { return "[namespaceURI=" + namespaceURI + ",packageType=" + packageType + "]"; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append("").append("").append(packageType).append(""); sb.append("").append(namespaceURI).append("").append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/WsdlMessageMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/WsdlM0000644000175000017500000000725710542776150031615 0ustar godgod/* * 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.metadata.jaxrpcmapping; import java.io.Serializable; import javax.xml.namespace.QName; // $Id: WsdlMessageMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * Created by IntelliJ IDEA. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class WsdlMessageMapping implements Serializable { private static final long serialVersionUID = -3212852147033081838L; // The parent element private MethodParamPartsMapping methodParamPartsMapping; // The required element private QName wsdlMessage; // The required element private String wsdlMessagePartName; // The required element private String parameterMode; // The optional element private boolean soapHeader; public WsdlMessageMapping(MethodParamPartsMapping methodParamPartsMapping) { this.methodParamPartsMapping = methodParamPartsMapping; } public MethodParamPartsMapping getMethodParamPartsMapping() { return methodParamPartsMapping; } public String getParameterMode() { return parameterMode; } public void setParameterMode(String parameterMode) { if ("IN".equals(parameterMode) == false && "OUT".equals(parameterMode) == false && "INOUT".equals(parameterMode) == false) throw new IllegalArgumentException("Invalid parameter mode: " + parameterMode); this.parameterMode = parameterMode; } public boolean isSoapHeader() { return soapHeader; } public void setSoapHeader(boolean soapHeader) { this.soapHeader = soapHeader; } public QName getWsdlMessage() { return wsdlMessage; } public void setWsdlMessage(QName wsdlMessage) { this.wsdlMessage = wsdlMessage; } public String getWsdlMessagePartName() { return wsdlMessagePartName; } public void setWsdlMessagePartName(String wsdlMessagePartName) { this.wsdlMessagePartName = wsdlMessagePartName; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append(" "); sb.append(wsdlMessage.getPrefix()).append(":").append(wsdlMessage.getLocalPart()).append(""); sb.append("").append(wsdlMessagePartName).append(""); sb.append("").append(parameterMode).append(""); if (soapHeader) sb.append(""); sb.append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointInterfaceMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/Servi0000644000175000017500000001137510542776150031653 0ustar godgod/* * 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.metadata.jaxrpcmapping; // $Id: ServiceEndpointInterfaceMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; /** * XML mapping of the java-wsdl-mapping/service-endpoint-interface-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class ServiceEndpointInterfaceMapping implements Serializable { private static final long serialVersionUID = 3336973427288868587L; // The parent element private JavaWsdlMapping javaWsdlMapping; // The required element private String serviceEndpointInterface; // The required element private QName wsdlPortType; // The required element private QName wsdlBinding; // Zero or more elements private List serviceEndpointMethodMappings = new ArrayList(); public ServiceEndpointInterfaceMapping(JavaWsdlMapping javaWsdlMapping) { this.javaWsdlMapping = javaWsdlMapping; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } public String getServiceEndpointInterface() { return serviceEndpointInterface; } public void setServiceEndpointInterface(String serviceEndpointInterface) { this.serviceEndpointInterface = serviceEndpointInterface; } public QName getWsdlPortType() { return wsdlPortType; } public void setWsdlPortType(QName wsdlPortType) { this.wsdlPortType = wsdlPortType; } public QName getWsdlBinding() { return wsdlBinding; } public void setWsdlBinding(QName wsdlBinding) { this.wsdlBinding = wsdlBinding; } public ServiceEndpointMethodMapping[] getServiceEndpointMethodMappings() { ServiceEndpointMethodMapping[] arr = new ServiceEndpointMethodMapping[serviceEndpointMethodMappings.size()]; serviceEndpointMethodMappings.toArray(arr); return arr; } public void addServiceEndpointMethodMapping(ServiceEndpointMethodMapping serviceEndpointMethodMapping) { serviceEndpointMethodMappings.add(serviceEndpointMethodMapping); } public ServiceEndpointMethodMapping getServiceEndpointMethodMappingByWsdlOperation(String wsdlOperation) { ServiceEndpointMethodMapping semMapping = null; Iterator it = serviceEndpointMethodMappings.iterator(); while (it.hasNext()) { ServiceEndpointMethodMapping aux = (ServiceEndpointMethodMapping)it.next(); if (aux.getWsdlOperation().equals(wsdlOperation)) semMapping = aux; } return semMapping; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append(""); sb.append(this.serviceEndpointInterface).append(""); sb.append("").append(wsdlPortType.getPrefix()); sb.append(":").append(wsdlPortType.getLocalPart()).append(""); sb.append("").append(wsdlBinding.getPrefix()); sb.append(":").append(wsdlBinding.getLocalPart()).append(""); Iterator iter = serviceEndpointMethodMappings.iterator(); while(iter != null && iter.hasNext()) sb.append(((ServiceEndpointMethodMapping)iter.next()).serialize()); sb.append(""); return sb.toString(); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/ServiceEndpointMethodMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/jaxrpcmapping/Servi0000644000175000017500000001245310542776150031651 0ustar godgod/* * 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.metadata.jaxrpcmapping; // $Id: ServiceEndpointMethodMapping.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * XML mapping of the java-wsdl-mapping/service-endpoint-interface-mapping/service-endpoint-method-mapping element. * * @author Thomas.Diesler@jboss.org * @since 14-May-2004 */ public class ServiceEndpointMethodMapping implements Serializable { private static final long serialVersionUID = 7857267872017006227L; // The parent element private ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping; // The required element private String javaMethodName; // The required element private String wsdlOperation; // The optional element private boolean wrappedElement; // Zero or more elements private List methodParamPartsMappings = new ArrayList(); // The optional element private WsdlReturnValueMapping wsdlReturnValueMapping; public ServiceEndpointMethodMapping(ServiceEndpointInterfaceMapping serviceEndpointInterfaceMapping) { this.serviceEndpointInterfaceMapping = serviceEndpointInterfaceMapping; } public ServiceEndpointInterfaceMapping getServiceEndpointInterfaceMapping() { return serviceEndpointInterfaceMapping; } public String getJavaMethodName() { return javaMethodName; } public void setJavaMethodName(String javaMethodName) { this.javaMethodName = javaMethodName; } public MethodParamPartsMapping[] getMethodParamPartsMappings() { MethodParamPartsMapping[] arr = new MethodParamPartsMapping[methodParamPartsMappings.size()]; methodParamPartsMappings.toArray(arr); return arr; } public MethodParamPartsMapping getMethodParamPartsMappingByPartName(String partName) { MethodParamPartsMapping paramMapping = null; for (int i = 0; paramMapping == null && i < methodParamPartsMappings.size(); i++) { MethodParamPartsMapping aux = (MethodParamPartsMapping)methodParamPartsMappings.get(i); if (aux.getWsdlMessageMapping().getWsdlMessagePartName().equals(partName)) paramMapping = aux; } return paramMapping; } public MethodParamPartsMapping getMethodParamPartsMappingByPosition(int pos) { MethodParamPartsMapping paramMapping = null; for (int i = 0; paramMapping == null && i < methodParamPartsMappings.size(); i++) { MethodParamPartsMapping aux = (MethodParamPartsMapping)methodParamPartsMappings.get(i); if (aux.getParamPosition() == pos) paramMapping = aux; } return paramMapping; } public void addMethodParamPartsMapping(MethodParamPartsMapping methodParamPartsMapping) { methodParamPartsMappings.add(methodParamPartsMapping); } public boolean isWrappedElement() { return wrappedElement; } public void setWrappedElement(boolean wrappedElement) { this.wrappedElement = wrappedElement; } public String getWsdlOperation() { return wsdlOperation; } public void setWsdlOperation(String wsdlOperation) { this.wsdlOperation = wsdlOperation; } public WsdlReturnValueMapping getWsdlReturnValueMapping() { return wsdlReturnValueMapping; } public void setWsdlReturnValueMapping(WsdlReturnValueMapping wsdlReturnValueMapping) { this.wsdlReturnValueMapping = wsdlReturnValueMapping; } public String serialize() { StringBuffer sb = new StringBuffer(); sb.append("").append(javaMethodName).append(""); sb.append("").append(wsdlOperation).append(""); if (wrappedElement) sb.append(""); Iterator iter = methodParamPartsMappings.iterator(); while (iter != null && iter.hasNext()) sb.append(((MethodParamPartsMapping)iter.next()).serialize()); if (wsdlReturnValueMapping != null) sb.append(wsdlReturnValueMapping.serialize()); sb.append(""); return sb.toString(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/0000755000175000017500000000000010755000261027220 5ustar godgod././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/EndpointProperty.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/EndpointProp0000644000175000017500000000271110626770234031600 0ustar godgod/* * 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.metadata.config; import java.net.URI; /** * @author Heiko.Braun@jboss.org * @version $Id$ * @since 14.12.2006 */ public class EndpointProperty { public final static String MTOM_THRESHOLD = "http://org.jboss.ws/mtom#threshold"; /** * Set to 0 in order to disable chunked encoding */ public final static String CHUNKED_ENCODING_SIZE = "http://org.jboss.ws/http#chunksize"; public URI name; public String value; } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/Configurable.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/Configurable0000644000175000017500000000257610560634370031565 0ustar godgod/* * 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.metadata.config; import java.util.Observer; /** * A marker interface that identifies configurable JBossWS components. * Configurables may register themselves with a {@link ConfigurationProvider} in order * to get notified then the configuration changes. * * @author Heiko.Braun@jboss.org * @since 15.12.2006 */ public interface Configurable extends Observer { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/0000755000175000017500000000000010755000261030507 5ustar godgod././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/EndpointConfigJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/Endpo0000644000175000017500000000245210542776150031515 0ustar godgod/* * 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.metadata.config.jaxrpc; // $Id: EndpointConfigJAXRPC.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A JBossWS endpoint configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public class EndpointConfigJAXRPC extends CommonConfigJAXRPC { } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/CommonConfigJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/Commo0000644000175000017500000000621410623427336031521 0ustar godgod/* * 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.metadata.config.jaxrpc; import java.util.ArrayList; import java.util.List; import org.jboss.ws.metadata.config.CommonConfig; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; // $Id: CommonConfigJAXRPC.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ /** * A JBossWS client configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public abstract class CommonConfigJAXRPC extends CommonConfig { private UnifiedHandlerChainMetaData preHandlerChain; private UnifiedHandlerChainMetaData postHandlerChain; public UnifiedHandlerChainMetaData getPostHandlerChain() { return postHandlerChain; } public void setPostHandlerChain(UnifiedHandlerChainMetaData postHandlerChain) { this.postHandlerChain = postHandlerChain; } public UnifiedHandlerChainMetaData getPreHandlerChain() { return preHandlerChain; } public void setPreHandlerChain(UnifiedHandlerChainMetaData preHandlerChain) { this.preHandlerChain = preHandlerChain; } @Override public List getHandlers(EndpointMetaData epMetaData, HandlerType type) { List handlers = new ArrayList(); UnifiedHandlerChainMetaData handlerChain; if (type == HandlerType.PRE) handlerChain = getPreHandlerChain(); else if (type == HandlerType.POST) handlerChain = getPostHandlerChain(); else throw new IllegalArgumentException("Invalid handler type: " + type); if (handlerChain != null) { for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers()) { HandlerMetaDataJAXRPC hmd = HandlerMetaDataJAXRPC.newInstance(uhmd, type); handlers.add(hmd); } } return handlers; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/ConfigRootJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/Confi0000644000175000017500000000572610542776150031515 0ustar godgod/* * 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.metadata.config.jaxrpc; import java.util.ArrayList; import java.util.List; /** * A JBossWS configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public class ConfigRootJAXRPC { private List clientConfigList = new ArrayList(); private List endpointConfigList = new ArrayList(); public List getClientConfig() { return clientConfigList; } public void setClientConfig(List clientConfig) { this.clientConfigList = clientConfig; } public List getEndpointConfig() { return endpointConfigList; } public void setEndpointConfig(List endpointConfig) { this.endpointConfigList = endpointConfig; } public ClientConfigJAXRPC getClientConfigByName(String configName) { ClientConfigJAXRPC config = null; for(ClientConfigJAXRPC aux : clientConfigList) { if (aux.getConfigName().equals(configName)) { config = aux; break; } } if (config == null && clientConfigList.size() == 1) config = clientConfigList.get(0); return config; } public EndpointConfigJAXRPC getEndpointConfigByName(String configName) { EndpointConfigJAXRPC config = null; for(EndpointConfigJAXRPC aux : endpointConfigList) { if (aux.getConfigName().equals(configName)) { config = aux; break; } } if (config == null && endpointConfigList.size() == 1) config = endpointConfigList.get(0); return config; } public CommonConfigJAXRPC getConfigByName(String name) { CommonConfigJAXRPC config = getClientConfigByName(name); if(null == config) config = getEndpointConfigByName(name); return config; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/ClientConfigJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxrpc/Clien0000644000175000017500000000244310542776150031502 0ustar godgod/* * 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.metadata.config.jaxrpc; // $Id: ClientConfigJAXRPC.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A JBossWS client configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public class ClientConfigJAXRPC extends CommonConfigJAXRPC { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/binding/0000755000175000017500000000000010755000261030632 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/binding/OMFa0000644000175000017500000002277610750144631031362 0ustar godgod/* * 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.metadata.config.binding; //$Id: OMFactoryJAXWS.java 5551 2008-01-30 19:01:45Z richard.opalka@jboss.com $ import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.metadata.config.EndpointProperty; import org.jboss.ws.metadata.config.jaxws.ClientConfigJAXWS; import org.jboss.ws.metadata.config.jaxws.CommonConfigJAXWS; import org.jboss.ws.metadata.config.jaxws.ConfigRootJAXWS; import org.jboss.ws.metadata.config.jaxws.EndpointConfigJAXWS; import org.jboss.ws.metadata.config.jaxws.HandlerChainsConfigJAXWS; import org.jboss.wsf.spi.metadata.j2ee.serviceref.HandlerChainsObjectFactory; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; import org.jboss.ws.extensions.wsrm.config.RMBackPortsServerConfig; import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig; import org.jboss.ws.extensions.wsrm.config.RMMessageRetransmissionConfig; import org.jboss.ws.extensions.wsrm.config.RMConfig; import org.jboss.ws.extensions.wsrm.config.RMPortConfig; /** * ObjectModelFactory for JAXRPC configurations. * * @author Thomas.Diesler@jboss.org * @author Heiko.Braun@jboss.org * @since 18-Dec-2005 */ public class OMFactoryJAXWS extends HandlerChainsObjectFactory { // provide logging private final Logger log = Logger.getLogger(OMFactoryJAXWS.class); public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { return new ConfigRootJAXWS(); } public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName) { return root; } /** * Called when parsing of a new element started. */ public Object newChild(ConfigRootJAXWS config, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("WSConfig newChild: " + localName); if ("endpoint-config".equals(localName)) { EndpointConfigJAXWS wsEndpointConfig = new EndpointConfigJAXWS(); config.getEndpointConfig().add(wsEndpointConfig); return wsEndpointConfig; } if ("client-config".equals(localName)) { ClientConfigJAXWS clientConfig = new ClientConfigJAXWS(); config.getClientConfig().add(clientConfig); return clientConfig; } return null; } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(CommonConfigJAXWS commonConfig, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("CommonConfig setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("config-name")) commonConfig.setConfigName(value); if(localName.equals("feature")) commonConfig.setFeature(value, true); if("property-name".equals(localName)) { commonConfig.addProperty(value, null); } else if("property-value".equals(localName)) { int lastEntry = commonConfig.getProperties().isEmpty() ? 0 : commonConfig.getProperties().size()-1; EndpointProperty p = commonConfig.getProperties().get(lastEntry); p.value = value; } } /** * Called when parsing of a new element started. */ public Object newChild(CommonConfigJAXWS commonConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("CommonConfig newChild: " + localName); if ("pre-handler-chains".equals(localName)) { HandlerChainsConfigJAXWS preHandlerChains = new HandlerChainsConfigJAXWS(); commonConfig.setPreHandlerChains(preHandlerChains); return preHandlerChains; } if ("post-handler-chains".equals(localName)) { HandlerChainsConfigJAXWS postHandlerChains = new HandlerChainsConfigJAXWS(); commonConfig.setPostHandlerChains(postHandlerChains); return postHandlerChains; } if ("reliable-messaging".equals(localName)) { RMConfig wsrmCfg = new RMConfig(); commonConfig.setRMMetaData(wsrmCfg); return wsrmCfg; } return null; } public Object newChild(RMConfig wsrmConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { int countOfAttributes = attrs.getLength(); if (localName.equals("delivery-assurance")) { RMDeliveryAssuranceConfig deliveryAssurance = getDeliveryAssurance(attrs); wsrmConfig.setDeliveryAssurance(deliveryAssurance); return deliveryAssurance; } if (localName.equals("message-retransmission")) { int interval = 0, attempts = 0, timeout=0; for (int i = 0; i < countOfAttributes; i++) { String attrLocalName = attrs.getLocalName(i); if (attrLocalName.equals("interval")) interval = Integer.valueOf(attrs.getValue(i)); if (attrLocalName.equals("attempts")) attempts = Integer.valueOf(attrs.getValue(i)); if (attrLocalName.equals("timeout")) timeout = Integer.valueOf(attrs.getValue(i)); } RMMessageRetransmissionConfig retransmissionConfig = new RMMessageRetransmissionConfig(); retransmissionConfig.setCountOfAttempts(attempts); retransmissionConfig.setRetransmissionInterval(interval); retransmissionConfig.setMessageTimeout(timeout); wsrmConfig.setMessageRetransmission(retransmissionConfig); return retransmissionConfig; } if (localName.equals("backports-server")) { String host = null, port = null; for (int i = 0; i < countOfAttributes && (host == null || port == null); i++) { String attrLocalName = attrs.getLocalName(i); if (attrLocalName.equals("host")) host = attrs.getValue(i); if (attrLocalName.equals("port")) port = attrs.getValue(i); } RMBackPortsServerConfig backportsServer = new RMBackPortsServerConfig(); backportsServer.setHost(host); backportsServer.setPort(port); wsrmConfig.setBackPortsServer(backportsServer); return backportsServer; } if (localName.equals("port")) { String portName = null; for (int i = 0; i < countOfAttributes; i++) { if (attrs.getLocalName(i).equals("name")) { portName = attrs.getValue(i); break; } } RMPortConfig port = new RMPortConfig(); port.setPortName(QName.valueOf(portName)); wsrmConfig.getPorts().add(port); return port; } return null; } public Object newChild(RMPortConfig port, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if (localName.equals("delivery-assurance")) { RMDeliveryAssuranceConfig deliveryAssurance = getDeliveryAssurance(attrs); port.setDeliveryAssurance(deliveryAssurance); return deliveryAssurance; } return null; } private RMDeliveryAssuranceConfig getDeliveryAssurance(Attributes attrs) { String inOrder = null, quality = null; for (int i = 0; i < attrs.getLength() && (inOrder == null || quality == null); i++) { String attrLocalName = attrs.getLocalName(i); if (attrLocalName.equals("inOrder")) inOrder = attrs.getValue(i); if (attrLocalName.equals("quality")) quality = attrs.getValue(i); } RMDeliveryAssuranceConfig deliveryAssurance = new RMDeliveryAssuranceConfig(); deliveryAssurance.setQuality(quality); deliveryAssurance.setInOrder(inOrder); return deliveryAssurance; } /** * Called when parsing of a new element started. */ public Object newChild(HandlerChainsConfigJAXWS handlerChains, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("WSHandlerChainsConfig newChild: " + localName); if ("handler-chain".equals(localName)) { UnifiedHandlerChainMetaData handlerChain = new UnifiedHandlerChainMetaData(null); handlerChains.getHandlerChains().add(handlerChain); return handlerChain; } return null; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/binding/OMFactoryJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/binding/OMFa0000644000175000017500000001701010663312361031343 0ustar godgod/* * 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.metadata.config.binding; //$Id: OMFactoryJAXRPC.java 4491 2007-08-23 14:08:49Z darran.lofthouse@jboss.com $ import java.util.List; import org.jboss.logging.Logger; import org.jboss.ws.metadata.config.EndpointProperty; import org.jboss.ws.metadata.config.jaxrpc.ClientConfigJAXRPC; import org.jboss.ws.metadata.config.jaxrpc.CommonConfigJAXRPC; import org.jboss.ws.metadata.config.jaxrpc.ConfigRootJAXRPC; import org.jboss.ws.metadata.config.jaxrpc.EndpointConfigJAXRPC; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; /** * ObjectModelFactory for JAXRPC configurations. * * @author Thomas.Diesler@jboss.org * @author Heiko.Braun@jboss.org * @since 18-Dec-2005 */ public class OMFactoryJAXRPC implements ObjectModelFactory { // provide logging private final Logger log = Logger.getLogger(OMFactoryJAXRPC.class); public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { return new ConfigRootJAXRPC(); } public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName) { return root; } /** * Called when parsing of a new element started. */ public Object newChild(ConfigRootJAXRPC config, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("WSConfig newChild: " + localName); if ("endpoint-config".equals(localName)) { EndpointConfigJAXRPC wsEndpointConfig = new EndpointConfigJAXRPC(); config.getEndpointConfig().add(wsEndpointConfig); return wsEndpointConfig; } if ("client-config".equals(localName)) { ClientConfigJAXRPC clientConfig = new ClientConfigJAXRPC(); config.getClientConfig().add(clientConfig); return clientConfig; } return null; } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(CommonConfigJAXRPC commonConfig, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("CommonConfig setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("config-name")) commonConfig.setConfigName(value); if(localName.equals("feature")) commonConfig.setFeature(value, true); if("property-name".equals(localName)) { commonConfig.addProperty(value, null); } else if("property-value".equals(localName)) { int lastEntry = commonConfig.getProperties().isEmpty() ? 0 : commonConfig.getProperties().size()-1; EndpointProperty p = commonConfig.getProperties().get(lastEntry); p.value = value; } } /** * Called when parsing of a new element started. */ public Object newChild(CommonConfigJAXRPC commonConfig, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("CommonConfig newChild: " + localName); if ("pre-handler-chain".equals(localName)) { UnifiedHandlerChainMetaData preHandlerChain = new UnifiedHandlerChainMetaData(null); commonConfig.setPreHandlerChain(preHandlerChain); return preHandlerChain; } if ("post-handler-chain".equals(localName)) { UnifiedHandlerChainMetaData postHandlerChain = new UnifiedHandlerChainMetaData(null); commonConfig.setPostHandlerChain(postHandlerChain); return postHandlerChain; } return null; } /** * Called when parsing of a new element started. */ public Object newChild(UnifiedHandlerChainMetaData UnifiedHandlerChainMetaData, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("WSHandlerChainConfig newChild: " + localName); if ("handler".equals(localName)) { UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData(UnifiedHandlerChainMetaData); List handlers = UnifiedHandlerChainMetaData.getHandlers(); handlers.add(handler); return handler; } return null; } /** * Called when parsing of a new element started. */ public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if ("init-param".equals(localName)) return new UnifiedInitParamMetaData(); else return null; } /** * Called when parsing character is complete. */ public void addChild(UnifiedHandlerMetaData handler, UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName) { handler.addInitParam(param); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("handler-name")) handler.setHandlerName(value); else if (localName.equals("handler-class")) handler.setHandlerClass(value); else if (localName.equals("soap-header")) handler.addSoapHeader(navigator.resolveQName(value)); else if (localName.equals("soap-role")) handler.addSoapRole(value); else if (localName.equals("port-name")) handler.addPortName(value); } /** * Called when a new simple child element with text value was read from the XML content. */ public void setValue(UnifiedInitParamMetaData param, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if (log.isTraceEnabled()) log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI + " localName=" + localName + " value=" + value); if (localName.equals("param-name")) param.setParamName(value); else if (localName.equals("param-value")) param.setParamValue(value); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/ConfigurationProvider.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/Configuratio0000644000175000017500000000433110576111502031577 0ustar godgod/* * 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.metadata.config; /** * Provides configuration for JBossWS components.
      * Currently this is implemented by EndpointMetaData. * * @author Heiko.Braun@jboss.org * @version $Id$ * @since 15.12.2006 * * @see org.jboss.ws.metadata.umdm.EndpointMetaData */ public interface ConfigurationProvider { static final String DEFAULT_JAXRPC_ENDPOINT_CONFIG_FILE = "META-INF/standard-jaxrpc-endpoint-config.xml"; static final String DEFAULT_JAXWS_ENDPOINT_CONFIG_FILE = "META-INF/standard-jaxws-endpoint-config.xml"; static final String DEFAULT_ENDPOINT_CONFIG_NAME = "Standard Endpoint"; static final String DEFAULT_JAXRPC_CLIENT_CONFIG_FILE = "META-INF/standard-jaxrpc-client-config.xml"; static final String DEFAULT_JAXWS_CLIENT_CONFIG_FILE = "META-INF/standard-jaxws-client-config.xml"; static final String DEFAULT_CLIENT_CONFIG_NAME = "Standard Client"; /** * Callback for components that require configuration */ void configure(Configurable configurable); void registerConfigObserver(Configurable configurable); String getConfigFile(); String getConfigName(); void setConfigName(String configName); void setConfigName(String configName, String configFile); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/0000755000175000017500000000000010755000261030354 5ustar godgod././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/EndpointConfigJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/Endpoi0000644000175000017500000000244510542776150031535 0ustar godgod/* * 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.metadata.config.jaxws; // $Id: EndpointConfigJAXWS.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A JBossWS endpoint configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public class EndpointConfigJAXWS extends CommonConfigJAXWS { } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/ClientConfigJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/Client0000644000175000017500000000243710542776150031536 0ustar godgod/* * 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.metadata.config.jaxws; // $Id: ClientConfigJAXWS.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A JBossWS client configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public class ClientConfigJAXWS extends CommonConfigJAXWS { } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/ConfigRootJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/Config0000644000175000017500000000570410542776150031525 0ustar godgod/* * 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.metadata.config.jaxws; import java.util.ArrayList; import java.util.List; /** * A JBossWS configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public class ConfigRootJAXWS { private List clientConfigList = new ArrayList(); private List endpointConfigList = new ArrayList(); public List getClientConfig() { return clientConfigList; } public void setClientConfig(List clientConfig) { this.clientConfigList = clientConfig; } public List getEndpointConfig() { return endpointConfigList; } public void setEndpointConfig(List endpointConfig) { this.endpointConfigList = endpointConfig; } public ClientConfigJAXWS getClientConfigByName(String configName) { ClientConfigJAXWS config = null; for(ClientConfigJAXWS aux : clientConfigList) { if (aux.getConfigName().equals(configName)) { config = aux; break; } } if (config == null && clientConfigList.size() == 1) config = clientConfigList.get(0); return config; } public EndpointConfigJAXWS getEndpointConfigByName(String configName) { EndpointConfigJAXWS config = null; for(EndpointConfigJAXWS aux : endpointConfigList) { if (aux.getConfigName().equals(configName)) { config = aux; break; } } if (config == null && endpointConfigList.size() == 1) config = endpointConfigList.get(0); return config; } public CommonConfigJAXWS getConfigByName(String name) { CommonConfigJAXWS config = getClientConfigByName(name); if(null == config) config = getEndpointConfigByName(name); return config; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/CommonConfigJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/Common0000644000175000017500000000641310623427336031545 0ustar godgod/* * 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.metadata.config.jaxws; import java.util.ArrayList; import java.util.List; import org.jboss.ws.metadata.config.CommonConfig; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; // $Id: CommonConfigJAXWS.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ /** * A JBossWS client configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public abstract class CommonConfigJAXWS extends CommonConfig { private HandlerChainsConfigJAXWS preHandlerChains; private HandlerChainsConfigJAXWS postHandlerChains; public HandlerChainsConfigJAXWS getPostHandlerChains() { return postHandlerChains; } public void setPostHandlerChains(HandlerChainsConfigJAXWS postHandlerChain) { this.postHandlerChains = postHandlerChain; } public HandlerChainsConfigJAXWS getPreHandlerChains() { return preHandlerChains; } public void setPreHandlerChains(HandlerChainsConfigJAXWS preHandlerChains) { this.preHandlerChains = preHandlerChains; } public List getHandlers(EndpointMetaData epMetaData, HandlerType type) { List handlers = new ArrayList(); HandlerChainsConfigJAXWS handlerChains; if (type == HandlerType.PRE) handlerChains = getPreHandlerChains(); else if (type == HandlerType.POST) handlerChains = getPostHandlerChains(); else throw new IllegalArgumentException("Invalid handler type: " + type); if (handlerChains != null) { for (UnifiedHandlerChainMetaData handlerChain : handlerChains.getHandlerChains()) { for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers()) { HandlerMetaDataJAXWS hmd = HandlerMetaDataJAXWS.newInstance(uhmd, type); hmd.setEndpointMetaData(epMetaData); handlers.add(hmd); } } } return handlers; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/HandlerChainsConfigJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/jaxws/Handle0000644000175000017500000000307010623427336031504 0ustar godgod/* * 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.metadata.config.jaxws; import java.util.ArrayList; import java.util.List; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; /** * A JBossWS handler chains configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public class HandlerChainsConfigJAXWS { private List chains = new ArrayList(); public HandlerChainsConfigJAXWS() { } public List getHandlerChains() { return chains; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/EndpointFeature.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/EndpointFeat0000644000175000017500000000322510643224172031532 0ustar godgod/* * 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.metadata.config; // $Id: $ /** * @author Heiko.Braun@jboss.org * @author Thomas.Diesler@jboss.org * @since 14.12.2006 */ public interface EndpointFeature { /** Enable MTOM per endpoint */ final static String MTOM = "http://org.jboss.ws/mtom"; /** * Validate the XML stream upon dispatch. * Introduces an additional parsing overhead and could be disabled. */ final static String VALIDATE_DISPATCH = "http://org.jboss.ws/dispatch/validate"; /** Generates message part names 'parameters' in WSDL for document/literal/wapped */ final static String BINDING_WSDL_DOTNET = "http://org.jboss.ws/binding/wsdl/dotnet"; } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/JBossWSConfigFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/JBossWSConfi0000644000175000017500000001267410654422410031430 0ustar godgod/* * 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.metadata.config; //$Id: JBossWSConfigFactory.java 4119 2007-08-02 18:40:08Z thomas.diesler@jboss.com $ import java.io.IOException; import java.net.URL; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.config.binding.OMFactoryJAXRPC; import org.jboss.ws.metadata.config.binding.OMFactoryJAXWS; import org.jboss.ws.metadata.config.jaxrpc.ConfigRootJAXRPC; import org.jboss.ws.metadata.config.jaxws.ConfigRootJAXWS; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.ResourceLoaderAdapter; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.w3c.dom.Element; /** * A factory for the JBossWS endpoint/client configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public class JBossWSConfigFactory { // provide logging private final Logger log = Logger.getLogger(JBossWSConfigFactory.class); private static String URN_JAXRPC_CONFIG = "urn:jboss:jaxrpc-config:2.0"; private static String URN_JAXWS_CONFIG = "urn:jboss:jaxws-config:2.0"; // Hide constructor private JBossWSConfigFactory() { } /** Create a new instance of the factory */ public static JBossWSConfigFactory newInstance() { return new JBossWSConfigFactory(); } public Object parse(URL configURL) { if(log.isDebugEnabled()) log.debug("parse: " + configURL); Object wsConfig; try { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.setValidation(true); unmarshaller.setSchemaValidation(true); String nsURI = getNamespaceURI(configURL); if (URN_JAXRPC_CONFIG.equals(nsURI)) { wsConfig = unmarshaller.unmarshal(configURL.openStream(), new OMFactoryJAXRPC(), null); } else if (URN_JAXWS_CONFIG.equals(nsURI)) { wsConfig = unmarshaller.unmarshal(configURL.openStream(), new OMFactoryJAXWS(), null); } else { throw new WSException("Invalid config namespace: " + nsURI); } } catch (JBossXBException e) { throw new WSException("Error while parsing configuration", e); } catch (IOException e) { throw new WSException("Failed to read config file: " + configURL, e); } return wsConfig; } private String getNamespaceURI(URL configURL) { try { Element root = DOMUtils.parse(configURL.openStream()); return root.getNamespaceURI(); } catch (IOException ex) { throw new WSException(ex); } } /** * @return config - cannot be null */ public CommonConfig getConfig(UnifiedVirtualFile vfsRoot, String configName, String configFile) { if(log.isDebugEnabled()) log.debug("getConfig: [name=" + configName + ",url=" + configFile + "]"); if (configName == null) throw new IllegalArgumentException("Config name cannot be null"); if (configFile == null) throw new IllegalArgumentException("Config file cannot be null"); // Get the config root URL configURL = filenameToURL(vfsRoot, configFile); Object configRoot = parse(configURL); // Get the endpoint config CommonConfig config; if (configRoot instanceof ConfigRootJAXRPC) { config = ((ConfigRootJAXRPC)configRoot).getConfigByName(configName); } else { config = ((ConfigRootJAXWS)configRoot).getConfigByName(configName); } if (config == null) throw new WSException("Cannot obtain config: " + configName); return config; } private URL filenameToURL(UnifiedVirtualFile vfsRoot, String configFile) { URL configURL = null; try { configURL = vfsRoot.findChild(configFile).toURL(); } catch (IOException ex) { // ignore } // Try to get the URL as resource if (configURL == null) { try { configURL = new ResourceLoaderAdapter().findChild(configFile).toURL(); } catch (IOException ex) { // ignore } } if (configURL == null) throw new WSException("Cannot find configFile: " + configFile); return configURL; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/CommonConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/config/CommonConfig0000644000175000017500000000655510723247145031545 0ustar godgod/* * 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.metadata.config; //$Id: CommonConfig.java 5125 2007-11-28 11:17:57Z richard.opalka@jboss.com $ import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; import org.jboss.ws.extensions.wsrm.config.RMConfig; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * A common configuration * * @author Thomas.Diesler@jboss.org * @since 18-Dec-2005 */ public abstract class CommonConfig { private String configName; private RMConfig wsrmCfg; private List features = new ArrayList(); private List properties = new ArrayList(); public String getConfigName() { return configName; } public void setConfigName(String configName) { this.configName = configName; } public abstract List getHandlers(EndpointMetaData epMetaData, HandlerType type); public boolean hasFeature(URI type) { return features.contains(type); } public boolean hasFeature(String uri) { return hasFeature(nameToURI(uri)); } public void setFeature(String type, boolean enabled) { if(enabled) { features.add(nameToURI(type)); } else features.remove(nameToURI(type)); } public void setRMMetaData(RMConfig wsrmCfg) { this.wsrmCfg = wsrmCfg; } public RMConfig getRMMetaData() { return this.wsrmCfg; } public void addProperty(String name, String value) { EndpointProperty p = new EndpointProperty(); p.name = nameToURI(name); p.value = value; properties.add(p); } public String getProperty(String name) { String value = null; URI uri = nameToURI(name); for(EndpointProperty wsp : properties) { if(wsp.name.equals(uri)) { value = wsp.value; break; } } return value; } public List getProperties() { return properties; } private static URI nameToURI(String name) { URI uri = null; try { uri = new URI(name); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } return uri; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/0000755000175000017500000000000010755000261027401 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxrpc/0000755000175000017500000000000010755000261030670 5ustar godgod././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxrpc/JAXR0000644000175000017500000012130510650145103031360 0ustar godgod/* * 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.metadata.builder.jaxrpc; //$Id: JAXRPCMetaDataBuilder.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.rpc.encoding.TypeMappingRegistry; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxrpc.EncodedTypeMapping; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.core.jaxrpc.TypeMappingRegistryImpl; import org.jboss.ws.core.jaxrpc.UnqualifiedFaultException; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.soap.Use; import org.jboss.ws.extensions.xop.jaxrpc.XOPScanner; import org.jboss.ws.metadata.builder.MetaDataBuilder; import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping; import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping; import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping; import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.TypeMappingMetaData; import org.jboss.ws.metadata.umdm.TypesMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLBindingOperationInput; import org.jboss.ws.metadata.wsdl.WSDLBindingOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLMIMEPart; import org.jboss.ws.metadata.wsdl.WSDLProperty; import org.jboss.ws.metadata.wsdl.WSDLRPCPart; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem; import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader; import org.jboss.ws.metadata.wsdl.WSDLTypes; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.wsf.common.JavaUtils; /** * A meta data builder that is based on webservices.xml. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 19-Oct-2005 */ public abstract class JAXRPCMetaDataBuilder extends MetaDataBuilder { // provide logging final Logger log = Logger.getLogger(JAXRPCMetaDataBuilder.class); protected QName lookupSchemaType(WSDLInterfaceOperation operation, QName element) { WSDLDefinitions wsdlDefinitions = operation.getWsdlInterface().getWsdlDefinitions(); WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes(); return wsdlTypes.getXMLType(element); } protected void setupTypesMetaData(ServiceMetaData serviceMetaData) { WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions(); JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping(); TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData(); // Copy the schema locations to the types meta data if (wsdlDefinitions != null) { WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes(); typesMetaData.setSchemaModel(WSDLUtils.getSchemaModel(wsdlTypes)); } // Copy the type mappings to the types meta data if (javaWsdlMapping != null) { for (JavaXmlTypeMapping xmlTypeMapping : javaWsdlMapping.getJavaXmlTypeMappings()) { String javaTypeName = xmlTypeMapping.getJavaType(); String qnameScope = xmlTypeMapping.getQnameScope(); QName xmlType = xmlTypeMapping.getRootTypeQName(); QName anonymousXMLType = xmlTypeMapping.getAnonymousTypeQName(); if (xmlType == null && anonymousXMLType != null) xmlType = anonymousXMLType; String nsURI = xmlType.getNamespaceURI(); if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false) { TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName); tmMetaData.setQNameScope(qnameScope); typesMetaData.addTypeMapping(tmMetaData); } } for (ExceptionMapping exceptionMapping : javaWsdlMapping.getExceptionMappings()) { QName xmlType = exceptionMapping.getWsdlMessage(); String javaTypeName = exceptionMapping.getExceptionType(); TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName); typesMetaData.addTypeMapping(tmMetaData); } } } protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint wsdlEndpoint, ServiceEndpointInterfaceMapping seiMapping) { WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getInterface().getWsdlDefinitions(); // For every WSDL interface operation build the OperationMetaData WSDLInterface wsdlInterface = wsdlEndpoint.getInterface(); for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations()) { QName opQName = wsdlOperation.getName(); String opName = opQName.getLocalPart(); WSDLBindingOperation wsdlBindingOperation = wsdlOperation.getBindingOperation(); if (wsdlBindingOperation == null) log.warn("Could not locate binding operation for:" + opQName); // Change operation according namespace defined on binding // String namespaceURI = wsdlBindingOperation.getNamespaceURI(); if (namespaceURI != null) opQName = new QName(namespaceURI, opName); // Set java method name String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1); ServiceEndpointMethodMapping seiMethodMapping = null; if (seiMapping != null) { epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface()); seiMethodMapping = seiMapping.getServiceEndpointMethodMappingByWsdlOperation(opName); if (seiMethodMapping == null) throw new WSException("Cannot obtain method mapping for: " + opName); javaName = seiMethodMapping.getJavaMethodName(); } OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName, javaName); epMetaData.addOperation(opMetaData); // Set the operation style String style = wsdlOperation.getStyle(); epMetaData.setStyle((Constants.URI_STYLE_DOCUMENT.equals(style) ? Style.DOCUMENT : Style.RPC)); // Set the operation MEP if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern())) opMetaData.setOneWay(true); // Set the operation SOAPAction if (wsdlBindingOperation != null) opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction()); // Get the type mapping for the encoding style String encStyle = epMetaData.getEncodingStyle().toURI(); TypeMappingRegistry tmRegistry = new TypeMappingRegistryImpl(); TypeMappingImpl typeMapping = (TypeMappingImpl)tmRegistry.getTypeMapping(encStyle); // Build the parameter meta data if (opMetaData.getStyle() == Style.RPC) { buildParameterMetaDataRpc(opMetaData, wsdlOperation, seiMethodMapping, typeMapping); } else { buildParameterMetaDataDoc(opMetaData, wsdlOperation, seiMethodMapping, typeMapping); } // Build operation faults buildFaultMetaData(opMetaData, wsdlOperation); // process further operation extensions processOpMetaExtensions(opMetaData, wsdlOperation); } } private ParameterMetaData buildInputParameter(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, String partName, QName xmlName, QName xmlType, int pos, boolean optional) { WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName); if (item != null) pos = item.getPosition(); String javaTypeName = typeMapping.getJavaTypeName(xmlType); boolean mapped = false; if (seiMethodMapping != null) { MethodParamPartsMapping paramMapping = seiMethodMapping.getMethodParamPartsMappingByPartName(partName); if (paramMapping != null) { javaTypeName = paramMapping.getParamType(); pos = paramMapping.getParamPosition(); mapped = true; } else if (!optional) { throw new WSException("Cannot obtain method parameter mapping for message part '" + partName + "' in wsdl operation: " + seiMethodMapping.getWsdlOperation()); } } // For now we ignore unlisted headers with no mapping information if (!mapped && optional) return null; JavaWsdlMapping javaWsdlMapping = opMetaData.getEndpointMetaData().getServiceMetaData().getJavaWsdlMapping(); if (javaTypeName == null && javaWsdlMapping != null) { String packageName = javaWsdlMapping.getPackageNameForNamespaceURI(xmlType.getNamespaceURI()); if (packageName != null) { javaTypeName = packageName + "." + xmlType.getLocalPart(); log.warn("Guess java type from package mapping: [xmlType=" + xmlType + ",javaType=" + javaTypeName + "]"); } } if (javaTypeName == null) throw new WSException("Cannot obtain java type mapping for: " + xmlType); ParameterMetaData inMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName); inMetaData.setPartName(partName); inMetaData.setIndex(pos); opMetaData.addParameter(inMetaData); TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData(); // In arrays of user types, wscompile does not generate a mapping in jaxrpc-mapping.xml if (typesMetaData.getTypeMappingByXMLType(xmlType) == null) { String nsURI = xmlType.getNamespaceURI(); if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false) { TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName); typesMetaData.addTypeMapping(tmMetaData); } } return inMetaData; } private ParameterMetaData buildOutputParameter(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, int pos, String partName, QName xmlName, QName xmlType, TypeMappingImpl typeMapping, boolean optional) { // Default is first listed output boolean hasReturnMapping = opMetaData.getReturnParameter() == null; WSDLRPCSignatureItem item = wsdlOperation.getRpcSignatureitem(partName); if (item != null) { hasReturnMapping = item.getDirection() == Direction.RETURN; pos = item.getPosition(); } String javaTypeName = typeMapping.getJavaTypeName(xmlType); boolean mapped = false; if (seiMethodMapping != null) { MethodParamPartsMapping paramMapping = seiMethodMapping.getMethodParamPartsMappingByPartName(partName); if (paramMapping != null) { javaTypeName = paramMapping.getParamType(); pos = paramMapping.getParamPosition(); hasReturnMapping = false; mapped = true; } else { WsdlReturnValueMapping returnMapping = seiMethodMapping.getWsdlReturnValueMapping(); if (returnMapping != null) { String mappingPart = returnMapping.getWsdlMessagePartName(); if (mappingPart != null && partName.equals(mappingPart)) { javaTypeName = returnMapping.getMethodReturnValue(); hasReturnMapping = true; mapped = true; } } } } // For now we ignore unlisted headers with no mapping information if (!mapped && optional) return null; JavaWsdlMapping javaWsdlMapping = opMetaData.getEndpointMetaData().getServiceMetaData().getJavaWsdlMapping(); if (javaTypeName == null && javaWsdlMapping != null) { String packageName = javaWsdlMapping.getPackageNameForNamespaceURI(xmlType.getNamespaceURI()); if (packageName != null) { javaTypeName = packageName + "." + xmlType.getLocalPart(); log.warn("Guess java type from package mapping: [xmlType=" + xmlType + ",javaType=" + javaTypeName + "]"); } } if (javaTypeName == null) throw new WSException("Cannot obtain java type mapping for: " + xmlType); ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName); outMetaData.setPartName(partName); if (hasReturnMapping) { opMetaData.setReturnParameter(outMetaData); } else { outMetaData.setIndex(pos); outMetaData.setMode(ParameterMode.OUT); opMetaData.addParameter(outMetaData); } TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData(); // In arrays of user types, wscompile does not generate a mapping in jaxrpc-mapping.xml if (typesMetaData.getTypeMappingByXMLType(xmlType) == null) { String nsURI = xmlType.getNamespaceURI(); if (Constants.NS_SCHEMA_XSD.equals(nsURI) == false && Constants.URI_SOAP11_ENC.equals(nsURI) == false) { TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, javaTypeName); typesMetaData.addTypeMapping(tmMetaData); } } setupSOAPArrayParameter(outMetaData); return outMetaData; } private int processBindingParameters(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition) { WSDLBindingOperationInput bindingInput = bindingOperation.getInputs()[0]; for (WSDLSOAPHeader header : bindingInput.getSoapHeaders()) { QName xmlName = header.getElement(); QName xmlType = lookupSchemaType(wsdlOperation, xmlName); String partName = header.getPartName(); ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++, !header .isIncludeInSignature()); if (pmd != null) pmd.setInHeader(true); } for (WSDLMIMEPart mimePart : bindingInput.getMimeParts()) { String partName = mimePart.getPartName(); QName xmlName = new QName(partName); QName xmlType = mimePart.getXmlType(); ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++, false); pmd.setSwA(true); pmd.setMimeTypes(mimePart.getMimeTypes()); } return wsdlPosition; } private int processBindingOutputParameters(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, WSDLBindingOperation bindingOperation, int wsdlPosition) { WSDLBindingOperationOutput bindingOutput = bindingOperation.getOutputs()[0]; for (WSDLSOAPHeader header : bindingOutput.getSoapHeaders()) { String partName = header.getPartName(); QName xmlName = header.getElement(); ParameterMetaData outMetaData = opMetaData.getParameter(xmlName); if (outMetaData != null) { outMetaData.setMode(ParameterMode.INOUT); } else { QName xmlType = lookupSchemaType(wsdlOperation, xmlName); ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping, !header .isIncludeInSignature()); if (pmd != null) { pmd.setInHeader(true); if (opMetaData.getReturnParameter() != pmd) wsdlPosition++; } } } for (WSDLMIMEPart mimePart : bindingOutput.getMimeParts()) { String partName = mimePart.getPartName(); QName xmlName = new QName(partName); ParameterMetaData outMetaData = opMetaData.getParameter(xmlName); if (outMetaData != null) { outMetaData.setMode(ParameterMode.INOUT); } else { QName xmlType = mimePart.getXmlType(); ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping, false); pmd.setSwA(true); pmd.setMimeTypes(mimePart.getMimeTypes()); if (opMetaData.getReturnParameter() != pmd) wsdlPosition++; } } return wsdlPosition; } /* SOAP-ENC:Array * * FIXME: This hack should be removed as soon as we can reliably get the * soapenc:arrayType from wsdl + schema. */ private void setupSOAPArrayParameter(ParameterMetaData paramMetaData) { Use use = paramMetaData.getOperationMetaData().getUse(); String xmlTypeLocalPart = paramMetaData.getXmlType().getLocalPart(); if (use == Use.ENCODED && xmlTypeLocalPart.indexOf("ArrayOf") >= 0) { paramMetaData.setSOAPArrayParam(true); try { String javaTypeName = paramMetaData.getJavaTypeName(); // This approach determins the array component type from the javaTypeName. // It will not work for user defined types, nor will the array dimension be // initialized properly. Ideally the array parameter meta data should be initialized // from the XSModel or wherever it is defined in WSDL. Class javaType = JavaUtils.loadJavaType(javaTypeName); Class compJavaType = javaType.getComponentType(); if (xmlTypeLocalPart.indexOf("ArrayOfArrayOf") >= 0) compJavaType = compJavaType.getComponentType(); boolean isSoapEnc = xmlTypeLocalPart.toLowerCase().indexOf("soapenc") > 0; TypeMappingImpl typeMapping = isSoapEnc ? new EncodedTypeMapping() : new LiteralTypeMapping(); QName compXMLType = typeMapping.getXMLType(compJavaType); if (compXMLType != null) { boolean isBase64 = compXMLType.getLocalPart().startsWith("base64"); if (isBase64 && xmlTypeLocalPart.toLowerCase().indexOf("hex") > 0) compXMLType = isSoapEnc ? Constants.TYPE_SOAP11_HEXBINARY : Constants.TYPE_LITERAL_HEXBINARY; } paramMetaData.setSOAPArrayCompType(compXMLType); } catch (ClassNotFoundException e) { // ignore that user defined types cannot be loaded yet } } } private void setupXOPAttachmentParameter(WSDLInterfaceOperation operation, ParameterMetaData paramMetaData) { QName xmlType = paramMetaData.getXmlType(); // An XOP parameter is detected if it is a complex type that derives from xsd:base64Binary WSDLTypes wsdlTypes = operation.getWsdlInterface().getWsdlDefinitions().getWsdlTypes(); JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlTypes); String localPart = xmlType.getLocalPart() != null ? xmlType.getLocalPart() : ""; String ns = xmlType.getNamespaceURI() != null ? xmlType.getNamespaceURI() : ""; XSTypeDefinition xsType = schemaModel.getTypeDefinition(localPart, ns); XOPScanner scanner = new XOPScanner(); if (scanner.findXOPTypeDef(xsType) != null | (localPart.equals("base64Binary") && ns.equals(Constants.NS_SCHEMA_XSD))) { // FIXME: read the xmime:contentType from the element declaration // See SchemaUtils#findXOPTypeDef(XSTypeDefinition typeDef) for details /* FIXME: the classloader is not set yet paramMetaData.setXopContentType( MimeUtils.resolveMimeType(paramMetaData.getJavaType()) ); */ paramMetaData.setXOP(true); } } /* * Perhaps the JAX-RPC mapping model should be hash based. For now we optimize just this case. */ private Map createVariableMappingMap(VariableMapping[] mappings) { HashMap map = new HashMap(); if (mappings != null) for (VariableMapping mapping : mappings) map.put(mapping.getXmlElementName(), mapping.getJavaVariableName()); return map; } private void buildParameterMetaDataRpc(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping) { log.trace("buildParameterMetaDataRpc: " + opMetaData.getQName()); WSDLBindingOperation bindingOperation = wsdlOperation.getBindingOperation(); if (bindingOperation == null) throw new WSException("Could not locate binding operation for:" + opMetaData.getQName()); // RPC has one input WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0]; int wsdlPosition = 0; for (WSDLRPCPart part : input.getChildParts()) { QName xmlType = part.getType(); String partName = part.getName(); QName xmlName = new QName(partName); ParameterMetaData pmd = buildInputParameter(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, partName, xmlName, xmlType, wsdlPosition++, false); setupXOPAttachmentParameter(wsdlOperation, pmd); setupSOAPArrayParameter(pmd); } wsdlPosition = processBindingParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition); WSDLInterfaceOperationOutput[] outputs = wsdlOperation.getOutputs(); if (outputs.length > 0) { WSDLInterfaceOperationOutput output = outputs[0]; for (WSDLRPCPart part : output.getChildParts()) { String partName = part.getName(); ParameterMetaData outMetaData = opMetaData.getParameter(new QName(partName)); if (outMetaData != null) { outMetaData.setMode(ParameterMode.INOUT); } else { QName xmlName = new QName(partName); QName xmlType = part.getType(); ParameterMetaData pmd = buildOutputParameter(opMetaData, wsdlOperation, seiMethodMapping, wsdlPosition, partName, xmlName, xmlType, typeMapping, false); if (opMetaData.getReturnParameter() != pmd) wsdlPosition++; setupXOPAttachmentParameter(wsdlOperation, pmd); setupSOAPArrayParameter(pmd); } } processBindingOutputParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition); } else if (wsdlOperation.getPattern() != Constants.WSDL20_PATTERN_IN_ONLY) { throw new WSException("RPC style was missing an output, and was not an IN-ONLY MEP."); } } private int processDocElement(OperationMetaData operation, WSDLInterfaceOperation wsdlOperation, WSDLBindingOperation bindingOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, List wrappedParameters, List wrappedResponseParameters) { WSDLInterfaceOperationInput input = wsdlOperation.getInputs()[0]; WSDLBindingOperationInput bindingInput = bindingOperation.getInputs()[0]; int wsdlPosition; QName xmlName = input.getElement(); QName xmlType = input.getXMLType(); String javaTypeName = typeMapping.getJavaTypeName(xmlType); TypesMetaData typesMetaData = operation.getEndpointMetaData().getServiceMetaData().getTypesMetaData(); TypeMappingMetaData typeMetaData = typesMetaData.getTypeMappingByXMLType(xmlType); if (typeMetaData != null) javaTypeName = typeMetaData.getJavaTypeName(); if (javaTypeName == null) throw new WSException("Cannot obtain java type mapping for: " + xmlType); // Check if we need to wrap the parameters boolean isWrapped = isWrapped(seiMethodMapping, javaTypeName); operation.getEndpointMetaData().setParameterStyle(isWrapped ? ParameterStyle.WRAPPED : ParameterStyle.BARE); ParameterMetaData inMetaData = new ParameterMetaData(operation, xmlName, xmlType, javaTypeName); operation.addParameter(inMetaData); // Set the variable names if (inMetaData.getOperationMetaData().isDocumentWrapped()) { if (seiMethodMapping == null) throw new IllegalArgumentException("Cannot wrap parameters without SEI method mapping"); ServiceEndpointInterfaceMapping seiMapping = seiMethodMapping.getServiceEndpointInterfaceMapping(); JavaXmlTypeMapping javaXmlTypeMapping = seiMapping.getJavaWsdlMapping().getTypeMappingForQName(xmlType); if (javaXmlTypeMapping == null) throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType); Map variableMap = createVariableMappingMap(javaXmlTypeMapping.getVariableMappings()); for (MethodParamPartsMapping partMapping : seiMethodMapping.getMethodParamPartsMappings()) { WsdlMessageMapping wsdlMessageMapping = partMapping.getWsdlMessageMapping(); if (wsdlMessageMapping.isSoapHeader()) continue; if (wsdlMessageMapping == null) throw new IllegalArgumentException("wsdl-message-message mapping required for document/literal wrapped"); String elementName = wsdlMessageMapping.getWsdlMessagePartName(); // Skip attachments if (bindingInput.getMimePart(elementName) != null) continue; String variable = variableMap.get(elementName); if (variable == null) throw new IllegalArgumentException("Could not determine variable name for element: " + elementName); WrappedParameter wrapped = new WrappedParameter(new QName(elementName), partMapping.getParamType(), variable, partMapping.getParamPosition()); String parameterMode = wsdlMessageMapping.getParameterMode(); if (parameterMode == null || parameterMode.length() < 2) throw new IllegalArgumentException("Invalid parameter mode for element: " + elementName); if (!"OUT".equals(parameterMode)) wrappedParameters.add(wrapped); if (!"IN".equals(parameterMode)) { wrapped.setHolder(true); // wrapped parameters can not be shared between request/response objects (accessors) if ("INOUT".equals(parameterMode)) wrapped = new WrappedParameter(wrapped); wrappedResponseParameters.add(wrapped); } } inMetaData.setWrappedParameters(wrappedParameters); wsdlPosition = wrappedParameters.size(); } else { if (seiMethodMapping != null) { MethodParamPartsMapping part = seiMethodMapping.getMethodParamPartsMappingByPartName(input.getPartName()); if (part != null) { inMetaData.setJavaTypeName(part.getParamType()); inMetaData.setIndex(part.getParamPosition()); } } setupXOPAttachmentParameter(wsdlOperation, inMetaData); wsdlPosition = 1; } return wsdlPosition; } private boolean isWrapped(ServiceEndpointMethodMapping seiMethodMapping, String javaTypeName) { boolean isWrapParameters = (seiMethodMapping != null ? seiMethodMapping.isWrappedElement() : false); log.trace("isWrapParameters based on wrapped-element: " + isWrapParameters); if (isWrapParameters == false && seiMethodMapping != null) { MethodParamPartsMapping[] partsMappings = seiMethodMapping.getMethodParamPartsMappings(); if (partsMappings.length > 0) { List anyTypes = new ArrayList(); anyTypes.add("javax.xml.soap.SOAPElement"); anyTypes.add("org.w3c.dom.Element"); boolean matchingPartFound = false; for (MethodParamPartsMapping partsMapping : partsMappings) { String methodMappingTypeName = partsMapping.getParamType(); if (methodMappingTypeName.equals(javaTypeName)) { matchingPartFound = true; break; } // Check xsd:anyType else if (anyTypes.contains(javaTypeName) && anyTypes.contains(methodMappingTypeName)) { matchingPartFound = true; break; } // Check assignability, else { try { Class paramType = JavaUtils.loadJavaType(methodMappingTypeName); Class javaType = JavaUtils.loadJavaType(javaTypeName); if (JavaUtils.isAssignableFrom(javaType, paramType)) { matchingPartFound = true; break; } } catch (ClassNotFoundException e) { // Ignore. For simple types this should work, others should // be lexically equal if it is not wrapped. } } } // Do we really want to continue to handle invalid mappings? isWrapParameters = (matchingPartFound == false); log.trace("isWrapParameters based on matching parts: " + isWrapParameters); } } return isWrapParameters; } private int processOutputDocElement(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping, List wrappedResponseParameters, int wsdlPosition) { WSDLInterfaceOperationOutput opOutput = wsdlOperation.getOutputs()[0]; QName xmlName = opOutput.getElement(); QName xmlType = opOutput.getXMLType(); String javaTypeName = typeMapping.getJavaTypeName(xmlType); TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData(); if (typesMetaData.getTypeMappingByXMLType(xmlType) != null) javaTypeName = typesMetaData.getTypeMappingByXMLType(xmlType).getJavaTypeName(); if (javaTypeName == null) throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType); ParameterMetaData outMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName); boolean hasReturnMapping = true; if (opMetaData.isDocumentWrapped()) { if (seiMethodMapping == null) throw new IllegalArgumentException("Cannot wrap parameters without SEI method mapping"); WsdlReturnValueMapping returnValueMapping = seiMethodMapping.getWsdlReturnValueMapping(); if (returnValueMapping != null) { ServiceEndpointInterfaceMapping seiMapping = seiMethodMapping.getServiceEndpointInterfaceMapping(); JavaWsdlMapping javaWsdlMapping = seiMapping.getJavaWsdlMapping(); JavaXmlTypeMapping javaXmlTypeMapping = javaWsdlMapping.getTypeMappingForQName(xmlType); if (javaXmlTypeMapping == null) throw new WSException("Cannot obtain java/xml type mapping for: " + xmlType); Map map = createVariableMappingMap(javaXmlTypeMapping.getVariableMappings()); String elementName = returnValueMapping.getWsdlMessagePartName(); String variable = map.get(elementName); if (variable == null) throw new IllegalArgumentException("Could not determine variable name for element: " + elementName); String wrappedType = returnValueMapping.getMethodReturnValue(); QName element = new QName(elementName); WrappedParameter wrappedParameter = new WrappedParameter(element, wrappedType, variable, WrappedParameter.RETURN); wrappedResponseParameters.add(0, wrappedParameter); } outMetaData.setWrappedParameters(wrappedResponseParameters); } else { if (seiMethodMapping != null) { MethodParamPartsMapping part = seiMethodMapping.getMethodParamPartsMappingByPartName(opOutput.getPartName()); String mode = null; if (part != null) { WsdlMessageMapping wsdlMessageMapping = part.getWsdlMessageMapping(); mode = wsdlMessageMapping.getParameterMode(); } if ("INOUT".equals(mode)) { ParameterMetaData inMetaData = opMetaData.getParameter(xmlName); if (inMetaData != null) { inMetaData.setMode(ParameterMode.INOUT); return wsdlPosition; } throw new WSException("Could not update IN parameter to be INOUT, as indicated in the mapping: " + opOutput.getPartName()); } // It's potentialy possible that an input parameter could exist with the same part name else if ("OUT".equals(mode)) { hasReturnMapping = false; javaTypeName = part.getParamType(); outMetaData.setIndex(part.getParamPosition()); outMetaData.setJavaTypeName(javaTypeName); } else { WsdlReturnValueMapping returnValueMapping = seiMethodMapping.getWsdlReturnValueMapping(); if (returnValueMapping != null) { javaTypeName = returnValueMapping.getMethodReturnValue(); outMetaData.setJavaTypeName(javaTypeName); } } } setupXOPAttachmentParameter(wsdlOperation, outMetaData); setupSOAPArrayParameter(outMetaData); } if (hasReturnMapping) { opMetaData.setReturnParameter(outMetaData); } else { opMetaData.addParameter(outMetaData); outMetaData.setMode(ParameterMode.OUT); wsdlPosition++; } return wsdlPosition; } private void buildParameterMetaDataDoc(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation, ServiceEndpointMethodMapping seiMethodMapping, TypeMappingImpl typeMapping) { log.trace("buildParameterMetaDataDoc: " + opMetaData.getQName()); WSDLBindingOperation bindingOperation = wsdlOperation.getBindingOperation(); if (bindingOperation == null) throw new WSException("Could not locate binding operation for:" + bindingOperation); List wrappedParameters = new ArrayList(); List wrappedResponseParameters = new ArrayList(); int wsdlPosition = 0; // WS-I BP 1.0 allows document/literal bare to have zero message parts if (wsdlOperation.getInputs().length > 0) { wsdlPosition = processDocElement(opMetaData, wsdlOperation, bindingOperation, seiMethodMapping, typeMapping, wrappedParameters, wrappedResponseParameters); wsdlPosition = processBindingParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition); } else { // Set the default to bare in case there isn't an input object, revisit this opMetaData.getEndpointMetaData().setParameterStyle(ParameterStyle.BARE); } if (wsdlOperation.getOutputs().length > 0) { wsdlPosition = processOutputDocElement(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, wrappedResponseParameters, wsdlPosition); wsdlPosition = processBindingOutputParameters(opMetaData, wsdlOperation, seiMethodMapping, typeMapping, bindingOperation, wsdlPosition); } } /** * Build default action according to the pattern described in * http://www.w3.org/Submission/2004/SUBM-ws-addressing-20040810/ * Section 3.3.2 'Default Action Pattern'
      * [target namespace]/[port type name]/[input|output name] * * @param wsdlOperation * @return action value */ private String buildWsaActionValue(WSDLInterfaceOperation wsdlOperation) { WSDLProperty wsaAction = wsdlOperation.getProperty(Constants.WSDL_ATTRIBUTE_WSA_ACTION.toString()); String actionValue = null; if (null == wsaAction) { String tns = wsdlOperation.getName().getNamespaceURI(); String portTypeName = wsdlOperation.getName().getLocalPart(); WSDLProperty messageName = wsdlOperation.getProperty("http://www.jboss.org/jbossws/messagename/in"); actionValue = new String(tns + "/" + portTypeName + "/" + messageName.getValue()); } else { actionValue = wsaAction.getValue(); } return actionValue; } protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation) { TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData(); WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface(); for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults()) { QName ref = outFault.getRef(); WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(ref); QName xmlName = wsdlFault.getElement(); QName xmlType = wsdlFault.getXmlType(); String javaTypeName = null; if (xmlType == null) { log.warn("Cannot obtain fault type for element: " + xmlName); xmlType = xmlName; } TypeMappingMetaData tmMetaData = typesMetaData.getTypeMappingByXMLType(xmlType); if (tmMetaData != null) javaTypeName = tmMetaData.getJavaTypeName(); if (javaTypeName == null) { log.warn("Cannot obtain java type mapping for: " + xmlType); javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName(); } FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType, javaTypeName); opMetaData.addFault(faultMetaData); } } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCServerMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxrpc/JAXR0000644000175000017500000002753310656142514031401 0ustar godgod/* * 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. */ // $Id: JAXRPCServerMetaDataBuilder.java 4241 2007-08-07 19:17:32Z heiko.braun@jboss.com $ package org.jboss.ws.metadata.builder.jaxrpc; import java.util.Set; import javax.management.ObjectName; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.ws.metadata.wsse.WSSecurityOMFactory; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData; import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData; import org.jboss.wsf.spi.metadata.j2ee.EJBSecurityMetaData; import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData; import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData; import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData; /** * A server side meta data builder that is based on webservices.xml. * * @author Thomas.Diesler@jboss.org * @since 19-May-2005 */ public class JAXRPCServerMetaDataBuilder extends JAXRPCMetaDataBuilder { // provide logging final Logger log = Logger.getLogger(JAXRPCServerMetaDataBuilder.class); /** * Build from webservices.xml */ public UnifiedMetaData buildMetaData(ArchiveDeployment dep) { log.debug("START buildMetaData: [name=" + dep.getCanonicalName() + "]"); try { // For every webservice-description build the ServiceMetaData UnifiedMetaData wsMetaData = new UnifiedMetaData(dep.getRootFile()); wsMetaData.setDeploymentName(dep.getCanonicalName()); ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader(); if(null == runtimeClassLoader) throw new IllegalArgumentException("Runtime loader cannot be null"); wsMetaData.setClassLoader(runtimeClassLoader); WebservicesMetaData jaxrpcMapping = dep.getAttachment(WebservicesMetaData.class); WebserviceDescriptionMetaData[] wsDescriptionArr = jaxrpcMapping.getWebserviceDescriptions(); for (WebserviceDescriptionMetaData wsdMetaData : wsDescriptionArr) { ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, null); serviceMetaData.setWebserviceDescriptionName(wsdMetaData.getWebserviceDescriptionName()); wsMetaData.addService(serviceMetaData); // Set wsdl file String wsdlFile = wsdMetaData.getWsdlFile(); serviceMetaData.setWsdlFile(wsdlFile); // Unmarshall the WSDL WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions(); // Unmarshall the jaxrpc-mapping.xml String mappingFile = wsdMetaData.getJaxrpcMappingFile(); serviceMetaData.setMappingLocation(dep.getMetaDataFileURL(mappingFile)); JavaWsdlMapping javaWsdlMapping = serviceMetaData.getJavaWsdlMapping(); if (javaWsdlMapping == null) throw new WSException("jaxrpc-mapping-file not configured from webservices.xml"); // Build type mapping meta data setupTypesMetaData(serviceMetaData); // Assign the WS-Security configuration, WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance(); WSSecurityConfiguration securityConfiguration = wsseConfFactory.createConfiguration(wsMetaData.getRootFile(), WSSecurityOMFactory.SERVER_RESOURCE_NAME); serviceMetaData.setSecurityConfiguration(securityConfiguration); // For every port-component build the EndpointMetaData PortComponentMetaData[] pcMetaDataArr = wsdMetaData.getPortComponents(); for (PortComponentMetaData pcMetaData : pcMetaDataArr) { String linkName = pcMetaData.getEjbLink() != null ? pcMetaData.getEjbLink() : pcMetaData.getServletLink(); QName portName = pcMetaData.getWsdlPort(); // JBWS-722 // in webservices.xml should be qualified if (portName.getNamespaceURI().length() == 0) { String nsURI = wsdlDefinitions.getTargetNamespace(); portName = new QName(nsURI, portName.getLocalPart()); log.warn("Adding wsdl targetNamespace to: " + portName); pcMetaData.setWsdlPort(portName); } WSDLEndpoint wsdlEndpoint = getWsdlEndpoint(wsdlDefinitions, portName); if (wsdlEndpoint == null) throw new WSException("Cannot find port in wsdl: " + portName); // set service name serviceMetaData.setServiceName(wsdlEndpoint.getWsdlService().getName()); QName interfaceQName = wsdlEndpoint.getInterface().getName(); Endpoint ep = dep.getService().getEndpointByName(linkName); ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, ep, portName, interfaceQName, Type.JAXRPC); sepMetaData.setPortComponentName(pcMetaData.getPortComponentName()); sepMetaData.setLinkName(linkName); serviceMetaData.addEndpoint(sepMetaData); initEndpointEncodingStyle(sepMetaData); initEndpointAddress(dep, sepMetaData); EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class); JSEArchiveMetaData webMetaData = dep.getAttachment(JSEArchiveMetaData.class); if (apMetaData != null) { wsMetaData.setSecurityDomain(apMetaData.getSecurityDomain()); // Copy the wsdl publish location from jboss.xml String wsdName = serviceMetaData.getWebserviceDescriptionName(); String wsdlPublishLocation = apMetaData.getWsdlPublishLocationByName(wsdName); serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation); // Copy meta data EJBMetaData bmd = apMetaData.getBeanByEjbName(linkName); if (bmd == null) throw new WSException("Cannot obtain UnifiedBeanMetaData for: " + linkName); String configName = apMetaData.getConfigName(); String configFile = apMetaData.getConfigFile(); if (configName != null || configFile != null) sepMetaData.setConfigName(configName, configFile); EJBSecurityMetaData smd = bmd.getSecurityMetaData(); if (smd != null) { String authMethod = smd.getAuthMethod(); sepMetaData.setAuthMethod(authMethod); String transportGuarantee = smd.getTransportGuarantee(); sepMetaData.setTransportGuarantee(transportGuarantee); Boolean secureWSDLAccess = smd.getSecureWSDLAccess(); sepMetaData.setSecureWSDLAccess(secureWSDLAccess); } } else if (webMetaData != null) { wsMetaData.setSecurityDomain(webMetaData.getSecurityDomain()); String targetBean = webMetaData.getServletClassNames().get(linkName); sepMetaData.setServiceEndpointImplName(targetBean); // Copy the wsdl publish location from jboss-web.xml String wsdName = serviceMetaData.getWebserviceDescriptionName(); String wsdlPublishLocation = webMetaData.getWsdlPublishLocationByName(wsdName); serviceMetaData.setWsdlPublishLocation(wsdlPublishLocation); String configName = webMetaData.getConfigName(); String configFile = webMetaData.getConfigFile(); if (configName != null || configFile != null) sepMetaData.setConfigName(configName, configFile); initTransportGuaranteeJSE(dep, sepMetaData, linkName); } // init service endpoint id ObjectName sepID = createServiceEndpointID(dep, sepMetaData); sepMetaData.setServiceEndpointID(sepID); replaceAddressLocation(sepMetaData); String seiName = pcMetaData.getServiceEndpointInterface(); sepMetaData.setServiceEndpointInterfaceName(seiName); ServiceEndpointInterfaceMapping seiMapping = javaWsdlMapping.getServiceEndpointInterfaceMapping(seiName); if (seiMapping == null) log.warn("Cannot obtain SEI mapping for: " + seiName); // process endpoint meta extension processEndpointMetaDataExtensions(sepMetaData, wsdlDefinitions); // Setup the endpoint operations setupOperationsFromWSDL(sepMetaData, wsdlEndpoint, seiMapping); // Setup the endpoint handlers for (UnifiedHandlerMetaData uhmd : pcMetaData.getHandlers()) { Set portNames = uhmd.getPortNames(); if (portNames.size() == 0 || portNames.contains(portName.getLocalPart())) { HandlerMetaDataJAXRPC hmd = HandlerMetaDataJAXRPC.newInstance(uhmd, HandlerType.ENDPOINT); sepMetaData.addHandler(hmd); } } } } log.debug("END buildMetaData: " + wsMetaData); return wsMetaData; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot build meta data: " + ex.getMessage(), ex); } } private WSDLEndpoint getWsdlEndpoint(WSDLDefinitions wsdlDefinitions, QName portName) { WSDLEndpoint wsdlEndpoint = null; for (WSDLService wsdlService : wsdlDefinitions.getServices()) { WSDLEndpoint auxEndpoint = wsdlService.getEndpoint(portName); if (auxEndpoint != null) { wsdlEndpoint = auxEndpoint; break; } } return wsdlEndpoint; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCClientMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxrpc/JAXR0000644000175000017500000002432710703446353031400 0ustar godgod/* * 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.metadata.builder.jaxrpc; //$Id: JAXRPCClientMetaDataBuilder.java 4741 2007-10-11 16:18:51Z thomas.diesler@jboss.com $ import java.io.IOException; import java.net.URL; import java.util.Set; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping; import org.jboss.ws.metadata.umdm.ClientEndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.ws.metadata.wsse.WSSecurityOMFactory; import org.jboss.wsf.common.ResourceLoaderAdapter; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * A client side meta data builder. * * @author Thomas.Diesler@jboss.org * @since 19-May-2005 */ public class JAXRPCClientMetaDataBuilder extends JAXRPCMetaDataBuilder { // provide logging private final Logger log = Logger.getLogger(JAXRPCClientMetaDataBuilder.class); /** Build from WSDL and jaxrpc-mapping.xml */ public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, URL mappingURL, URL securityURL, UnifiedServiceRefMetaData serviceRefMetaData, ClassLoader loader) { try { JavaWsdlMapping javaWsdlMapping = null; if (mappingURL != null) { JavaWsdlMappingFactory mappingFactory = JavaWsdlMappingFactory.newInstance(); javaWsdlMapping = mappingFactory.parse(mappingURL); } WSSecurityConfiguration securityConfig = null; if (securityURL != null) { securityConfig = WSSecurityOMFactory.newInstance().parse(securityURL); } return buildMetaData(serviceQName, wsdlURL, javaWsdlMapping, securityConfig, serviceRefMetaData, loader); } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot build meta data: " + ex.getMessage(), ex); } } /** Build from WSDL and jaxrpc-mapping.xml */ public ServiceMetaData buildMetaData(QName serviceQName, URL wsdlURL, JavaWsdlMapping javaWsdlMapping, WSSecurityConfiguration securityConfig, UnifiedServiceRefMetaData usrMetaData, ClassLoader loader) { if(log.isDebugEnabled()) log.debug("START buildMetaData: [service=" + serviceQName + "]"); try { ResourceLoaderAdapter vfsRoot = new ResourceLoaderAdapter(loader); UnifiedMetaData wsMetaData = new UnifiedMetaData(vfsRoot); wsMetaData.setClassLoader(loader); ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceQName); wsMetaData.addService(serviceMetaData); serviceMetaData.setWsdlLocation(wsdlURL); WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions(); if (javaWsdlMapping != null) { URL mappingURL = new URL(Constants.NS_JBOSSWS_URI + "/dummy-mapping-file"); if (usrMetaData != null && usrMetaData.getMappingLocation() != null) { mappingURL = usrMetaData.getMappingLocation(); } wsMetaData.addMappingDefinition(mappingURL.toExternalForm(), javaWsdlMapping); serviceMetaData.setMappingLocation(mappingURL); } if (securityConfig != null) { serviceMetaData.setSecurityConfiguration(securityConfig); setupSecurity(securityConfig, wsMetaData.getRootFile()); } buildMetaDataInternal(serviceMetaData, wsdlDefinitions, javaWsdlMapping, usrMetaData); // eagerly initialize wsMetaData.eagerInitialize(); if(log.isDebugEnabled()) log.debug("END buildMetaData: " + wsMetaData); return serviceMetaData; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot build meta data: " + ex.getMessage(), ex); } } private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions wsdlDefinitions, JavaWsdlMapping javaWsdlMapping, UnifiedServiceRefMetaData serviceRefMetaData) throws IOException { QName serviceQName = serviceMetaData.getServiceName(); // Get the WSDL service WSDLService wsdlService = null; if (serviceQName == null) { if (wsdlDefinitions.getServices().length != 1) throw new IllegalArgumentException("Expected a single service element"); wsdlService = wsdlDefinitions.getServices()[0]; serviceMetaData.setServiceName(wsdlService.getName()); } else { wsdlService = wsdlDefinitions.getService(serviceQName); } if (wsdlService == null) throw new IllegalArgumentException("Cannot obtain wsdl service: " + serviceQName); // Build type mapping meta data setupTypesMetaData(serviceMetaData); // Build endpoint meta data for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints()) { QName bindingName = wsdlEndpoint.getBinding(); WSDLBinding wsdlBinding = wsdlEndpoint.getWsdlService().getWsdlDefinitions().getBinding(bindingName); String bindingType = wsdlBinding.getType(); if (Constants.NS_SOAP11.equals(bindingType) || Constants.NS_SOAP12.equals(bindingType)) { QName portName = wsdlEndpoint.getName(); QName interfaceQName = wsdlEndpoint.getInterface().getName(); ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXRPC); epMetaData.setEndpointAddress(wsdlEndpoint.getAddress()); serviceMetaData.addEndpoint(epMetaData); // config-name, config-file if (serviceRefMetaData != null) { String configName= serviceRefMetaData.getConfigName(); String configFile = serviceRefMetaData.getConfigFile(); if (configName != null || configFile != null) epMetaData.setConfigName(configName, configFile); } // Init the endpoint binding initEndpointBinding(wsdlEndpoint, epMetaData); // Init the service encoding style initEndpointEncodingStyle(epMetaData); ServiceEndpointInterfaceMapping seiMapping = null; if (javaWsdlMapping != null) { QName portType = wsdlEndpoint.getInterface().getName(); seiMapping = javaWsdlMapping.getServiceEndpointInterfaceMappingByPortType(portType); if (seiMapping != null) { epMetaData.setServiceEndpointInterfaceName(seiMapping.getServiceEndpointInterface()); } else { log.warn("Cannot obtain the SEI mapping for: " + portType); } } processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions); setupOperationsFromWSDL(epMetaData, wsdlEndpoint, seiMapping); setupHandlers(serviceRefMetaData, portName, epMetaData); } } } private void setupHandlers(UnifiedServiceRefMetaData serviceRefMetaData, QName portName, EndpointMetaData epMetaData) { // Setup the endpoint handlers if (serviceRefMetaData != null) { for (UnifiedHandlerMetaData uhmd : serviceRefMetaData.getHandlers()) { Set portNames = uhmd.getPortNames(); if (portNames.size() == 0 || portNames.contains(portName.getLocalPart())) { HandlerMetaDataJAXRPC hmd = HandlerMetaDataJAXRPC.newInstance(uhmd, HandlerType.ENDPOINT); epMetaData.addHandler(hmd); } } } } private void setupSecurity(WSSecurityConfiguration securityConfig, UnifiedVirtualFile vfsRoot) { if (securityConfig.getKeyStoreFile() != null) { try { UnifiedVirtualFile child = vfsRoot.findChild( securityConfig.getKeyStoreFile() ); securityConfig.setKeyStoreURL(child.toURL()); } catch (IOException e) { // ignore } } if (securityConfig.getTrustStoreFile() != null) { try { UnifiedVirtualFile child = vfsRoot.findChild( securityConfig.getTrustStoreFile() ); securityConfig.setTrustStoreURL(child.toURL()); } catch (IOException e) { // Ignore } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/0000755000175000017500000000000010755000261030535 5ustar godgod././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWS0000644000175000017500000004617710743173754031412 0ustar godgod/* * 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.metadata.builder.jaxws; // $Id: JAXWSWebServiceMetaDataBuilder.java 5471 2008-01-15 18:14:04Z alessio.soldano@jboss.com $ import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.io.Writer; import java.net.URL; import javax.jws.HandlerChain; import javax.jws.WebService; import javax.jws.soap.SOAPMessageHandlers; import javax.management.ObjectName; import javax.xml.namespace.QName; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.annotation.Documentation; import org.jboss.ws.extensions.policy.annotation.PolicyAttachment; import org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder; import org.jboss.ws.metadata.builder.MetaDataBuilder; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.ws.metadata.wsse.WSSecurityOMFactory; import org.jboss.ws.tools.ToolsUtils; import org.jboss.ws.tools.wsdl.JAXBWSDLGenerator; import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory; import org.jboss.ws.tools.wsdl.WSDLGenerator; import org.jboss.ws.tools.wsdl.WSDLWriter; import org.jboss.ws.tools.wsdl.WSDLWriterResolver; import org.jboss.wsf.common.IOUtils; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData; import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData; import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory; import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData; /** * An abstract annotation meta data builder. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @author Heiko.Braun@jboss.org * * @since 15-Oct-2005 */ @SuppressWarnings("deprecation") public class JAXWSWebServiceMetaDataBuilder extends JAXWSServerMetaDataBuilder { private boolean generateWsdl = true; private boolean toolMode = false; private File wsdlDirectory = null; private PrintStream messageStream = null; private static class EndpointResult { private Class epClass; private ServerEndpointMetaData sepMetaData; private ServiceMetaData serviceMetaData; private URL wsdlLocation; private URL policyLocation; } public void setGenerateWsdl(boolean generateWsdl) { this.generateWsdl = generateWsdl; } public ServerEndpointMetaData buildWebServiceMetaData(Deployment dep, UnifiedMetaData wsMetaData, Class sepClass, String linkName) { try { EndpointResult result = processWebService(dep, wsMetaData, sepClass, linkName); // Clear the java types, etc. ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader(); if(null == runtimeClassLoader) throw new IllegalArgumentException("Runtime loader cannot be null"); resetMetaDataBuilder(runtimeClassLoader); ServerEndpointMetaData sepMetaData = result.sepMetaData; ServiceMetaData serviceMetaData = result.serviceMetaData; serviceMetaData.setWsdlLocation(result.wsdlLocation); Class seiClass = result.epClass; sepMetaData.setLinkName(linkName); sepMetaData.setServiceEndpointImplName(sepClass.getName()); sepMetaData.setServiceEndpointInterfaceName(seiClass.getName()); // Assign the WS-Security configuration, WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance(); WSSecurityConfiguration securityConfiguration = wsseConfFactory.createConfiguration(wsMetaData.getRootFile(), WSSecurityOMFactory.SERVER_RESOURCE_NAME); serviceMetaData.setSecurityConfiguration(securityConfiguration); // Process an optional @SOAPBinding annotation processSOAPBinding(sepMetaData, seiClass); // Process an optional @BindingType annotation processBindingType(sepMetaData, sepClass); // process config processEndpointConfig(dep, sepMetaData, sepClass, linkName); // Process endpoint documentation if (seiClass.isAnnotationPresent(Documentation.class)) sepMetaData.setDocumentation(seiClass.getAnnotation(Documentation.class).content()); // Process web methods processWebMethods(sepMetaData, seiClass); // Init the transport guarantee initTransportGuaranteeJSE(dep, sepMetaData, linkName); // Initialize types createJAXBContext(sepMetaData); populateXmlTypes(sepMetaData); //Process an optional @PolicyAttachment annotation if (sepClass.isAnnotationPresent(PolicyAttachment.class)) { PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getServerSidePolicyMetaDataBuilder(toolMode); policyBuilder.processPolicyAnnotations(sepMetaData, sepClass); } // The server must always generate WSDL if (generateWsdl || !toolMode) processOrGenerateWSDL(seiClass, serviceMetaData, result.wsdlLocation, sepMetaData); // No need to process endpoint items if we are in tool mode if (toolMode) return sepMetaData; // Sanity check: read the generated WSDL and initialize the schema model // Note, this should no longer be needed, look into removing it WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions(); JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes()); serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel); // Note, that @WebContext needs to be defined on the endpoint not the SEI processWebContext(dep, sepClass, linkName, sepMetaData); // setup handler chain from config sepMetaData.initEndpointConfig(); // Process an optional @HandlerChain annotation if (sepClass.isAnnotationPresent(HandlerChain.class)) processHandlerChain(sepMetaData, sepClass); else if (seiClass.isAnnotationPresent(HandlerChain.class)) processHandlerChain(sepMetaData, seiClass); // process webservices.xml contributions processWSDDContribution(sepMetaData); // Init the endpoint address initEndpointAddress(dep, sepMetaData); // Process an optional @SOAPMessageHandlers annotation if (sepClass.isAnnotationPresent(SOAPMessageHandlers.class) || seiClass.isAnnotationPresent(SOAPMessageHandlers.class)) log.warn("@SOAPMessageHandlers is deprecated as of JAX-WS 2.0 with no replacement."); MetaDataBuilder.replaceAddressLocation(sepMetaData); processEndpointMetaDataExtensions(sepMetaData, wsdlDefinitions); // init service endpoint id ObjectName sepID = MetaDataBuilder.createServiceEndpointID(dep, sepMetaData); sepMetaData.setServiceEndpointID(sepID); return sepMetaData; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot build meta data: " + ex.getMessage(), ex); } } /** * With JAX-WS the use of webservices.xml is optional since the annotations can be used * to specify most of the information specified in this deployment descriptor file. * The deployment descriptors are only used to override or augment the annotation member attributes. * @param sepMetaData */ private void processWSDDContribution(ServerEndpointMetaData sepMetaData) { WebservicesMetaData webservices = WebservicesFactory.loadFromVFSRoot(sepMetaData.getRootFile()); if (webservices != null) { for (WebserviceDescriptionMetaData wsDesc : webservices.getWebserviceDescriptions()) { for (PortComponentMetaData portComp : wsDesc.getPortComponents()) { // We match portComp's by SEI first and portQName second // In the first case the portComp may override the portQName that derives from the annotation String portCompSEI = portComp.getServiceEndpointInterface(); boolean doesMatch = portCompSEI != null ? portCompSEI.equals(sepMetaData.getServiceEndpointInterfaceName()) : false; if (!doesMatch) { doesMatch = portComp.getWsdlPort().equals(sepMetaData.getPortName()); } if (doesMatch) { log.debug("Processing 'webservices.xml' contributions on EndpointMetaData"); // PortQName overrides if (portComp.getWsdlPort() != null) { log.debug("Override EndpointMetaData portName " + sepMetaData.getPortName() + " with " + portComp.getWsdlPort()); sepMetaData.setPortName(portComp.getWsdlPort()); } // HandlerChain contributions UnifiedHandlerChainsMetaData chainWrapper = portComp.getHandlerChains(); if (chainWrapper != null) { for (UnifiedHandlerChainMetaData handlerChain : chainWrapper.getHandlerChains()) { for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers()) { log.debug("Contribute handler from webservices.xml: " + uhmd.getHandlerName()); HandlerMetaDataJAXWS hmd = HandlerMetaDataJAXWS.newInstance(uhmd, HandlerType.ENDPOINT); sepMetaData.addHandler(hmd); } } } // MTOM settings if (portComp.isEnableMtom()) { log.debug("Enabling MTOM"); String bindingId = sepMetaData.getBindingId(); if (bindingId.equals(Constants.SOAP11HTTP_BINDING)) sepMetaData.setBindingId(Constants.SOAP11HTTP_MTOM_BINDING); else if (bindingId.equals(Constants.SOAP12HTTP_BINDING)) sepMetaData.setBindingId(Constants.SOAP12HTTP_MTOM_BINDING); } } } } } } private EndpointResult processWebService(Deployment dep, UnifiedMetaData wsMetaData, Class sepClass, String linkName) throws ClassNotFoundException, IOException { WebService anWebService = sepClass.getAnnotation(WebService.class); if (anWebService == null) throw new WSException("Cannot obtain @WebService annotation from: " + sepClass.getName()); Endpoint ep = dep.getService().getEndpointByName(linkName); Class seiClass = null; String seiName; WSDLUtils wsdlUtils = WSDLUtils.getInstance(); String name = anWebService.name(); if (name.length() == 0) name = WSDLUtils.getJustClassName(sepClass); String serviceName = anWebService.serviceName(); if (serviceName.length() == 0) serviceName = WSDLUtils.getJustClassName(sepClass) + "Service"; String serviceNS = anWebService.targetNamespace(); if (serviceNS.length() == 0) serviceNS = wsdlUtils.getTypeNamespace(sepClass); String portName = anWebService.portName(); if (portName.length() == 0) portName = name + "Port"; String wsdlLocation = anWebService.wsdlLocation(); String interfaceNS = serviceNS; // the default, but a SEI annotation may override this if (anWebService.endpointInterface().length() > 0) { seiName = anWebService.endpointInterface(); ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader(); if(null == runtimeClassLoader) throw new IllegalArgumentException("Runtime loader cannot be null"); seiClass = runtimeClassLoader.loadClass(seiName); WebService seiAnnotation = seiClass.getAnnotation(WebService.class); if (seiAnnotation == null) throw new WSException("Interface does not have a @WebService annotation: " + seiName); if (seiAnnotation.portName().length() > 0 || seiAnnotation.serviceName().length() > 0 || seiAnnotation.endpointInterface().length() > 0) throw new WSException("@WebService[portName,serviceName,endpointInterface] MUST NOT be defined on: " + seiName); // Redefine the interface or "PortType" name name = seiAnnotation.name(); if (name.length() == 0) name = WSDLUtils.getJustClassName(seiClass); interfaceNS = seiAnnotation.targetNamespace(); if (interfaceNS.length() == 0) interfaceNS = wsdlUtils.getTypeNamespace(seiClass); // The spec states that WSDL location should be allowed on an SEI, although it // makes far more sense on the implementation bean, so we ALWAYS override the SEI // when wsdlLocation is defined on the bean if (wsdlLocation.length() == 0) wsdlLocation = seiAnnotation.wsdlLocation(); } // Setup the ServerEndpointMetaData QName portQName = new QName(serviceNS, portName); QName portTypeQName = new QName(interfaceNS, name); EndpointResult result = new EndpointResult(); result.serviceMetaData = new ServiceMetaData(wsMetaData, new QName(serviceNS, serviceName)); result.sepMetaData = new ServerEndpointMetaData(result.serviceMetaData, ep, portQName, portTypeQName, EndpointMetaData.Type.JAXWS); result.epClass = (seiClass != null ? seiClass : sepClass); result.serviceMetaData.addEndpoint(result.sepMetaData); wsMetaData.addService(result.serviceMetaData); if (dep instanceof ArchiveDeployment) result.wsdlLocation = ((ArchiveDeployment)dep).getMetaDataFileURL(wsdlLocation); return result; } private void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, URL wsdlLocation, EndpointMetaData epMetaData) { PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getServerSidePolicyMetaDataBuilder(toolMode); try { WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx); WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance(); if (wsdlLocation != null) { //we can no longer use the user provided wsdl without parsing it right now, since we //need to look for policies and eventually choose the supported policy alternatives WSDLDefinitions wsdlDefinitions = factory.parse(wsdlLocation); policyBuilder.processPolicyExtensions(epMetaData, wsdlDefinitions); //now we have the UMDM containing policy data; anyway we can't write a new wsdl file with //the supported alternatives and so on, since we need to publish the file the user provided serviceMetaData.setWsdlLocation(wsdlLocation); } else { WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData); writeWsdl(serviceMetaData, wsdlDefinitions, epMetaData); } } catch (RuntimeException rte) { throw rte; } catch (IOException e) { throw new WSException("Cannot write generated wsdl", e); } } private void writeWsdl(ServiceMetaData serviceMetaData, WSDLDefinitions wsdlDefinitions, EndpointMetaData epMetaData) throws IOException { // The RI uses upper case, and the TCK expects it, so we just mimic this even though we don't really have to String wsdlName = ToolsUtils.firstLetterUpperCase(serviceMetaData.getServiceName().getLocalPart()); // Ensure that types are only in the interface qname wsdlDefinitions.getWsdlTypes().setNamespace(epMetaData.getPortTypeName().getNamespaceURI()); final File dir, wsdlFile; if (wsdlDirectory != null) { dir = wsdlDirectory; wsdlFile = new File(dir, wsdlName + ".wsdl"); } else { dir = IOUtils.createTempDirectory(); wsdlFile = File.createTempFile(wsdlName, ".wsdl", dir); wsdlFile.deleteOnExit(); } message(wsdlFile.getName()); Writer writer = IOUtils.getCharsetFileWriter(wsdlFile, Constants.DEFAULT_XML_CHARSET); new WSDLWriter(wsdlDefinitions).write(writer, Constants.DEFAULT_XML_CHARSET, new WSDLWriterResolver() { public WSDLWriterResolver resolve(String suggestedFile) throws IOException { File file; if (wsdlDirectory != null) { file = new File(dir, suggestedFile + ".wsdl"); } else { file = File.createTempFile(suggestedFile, ".wsdl", dir); file.deleteOnExit(); } actualFile = file.getName(); message(actualFile); charset = Constants.DEFAULT_XML_CHARSET; writer = IOUtils.getCharsetFileWriter(file, Constants.DEFAULT_XML_CHARSET); return this; } }); writer.close(); serviceMetaData.setWsdlLocation(wsdlFile.toURL()); } private void message(String msg) { if (messageStream != null) messageStream.println(msg); } public void setToolMode(boolean toolMode) { this.toolMode = toolMode; } public void setWsdlDirectory(File wsdlDirectory) { this.wsdlDirectory = wsdlDirectory; } public void setMessageStream(PrintStream messageStream) { this.messageStream = messageStream; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWS0000644000175000017500000001641110705403612031361 0ustar godgod/* * 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. */ // $Id: JAXWSProviderMetaDataBuilder.java 4784 2007-10-17 13:00:58Z thomas.diesler@jboss.com $ package org.jboss.ws.metadata.builder.jaxws; import java.io.IOException; import java.net.URL; import javax.jws.WebService; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.management.ObjectName; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.ws.Provider; import javax.xml.ws.ServiceMode; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceProvider; import javax.xml.ws.Service.Mode; import org.jboss.ws.Constants; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.soap.Style; import org.jboss.ws.metadata.builder.MetaDataBuilder; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.wsf.common.JavaUtils; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.deployment.Endpoint; /** * A server side meta data builder that is based on JSR-181 annotations * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 23-Jul-2005 */ public class JAXWSProviderMetaDataBuilder extends JAXWSServerMetaDataBuilder { public ServerEndpointMetaData buildProviderMetaData(ArchiveDeployment dep, UnifiedMetaData wsMetaData, Class sepClass, String linkName) throws IOException { // 5.3 Conformance (Provider implementation): A Provider based service endpoint implementation MUST // implement a typed Provider interface. if (JavaUtils.isAssignableFrom(Provider.class, sepClass) == false) throw new WebServiceException("Endpoint implementation does not implement javax.xml.ws.Provider: " + sepClass.getName()); // 5.4 Conformance (WebServiceProvider annotation): A Provider based service endpoint implementation // MUST carry a WebServiceProvider annotation WebServiceProvider anWebServiceProvider = (WebServiceProvider)sepClass.getAnnotation(WebServiceProvider.class); if (anWebServiceProvider == null) throw new WebServiceException("Cannot obtain @WebServiceProvider annotation from: " + sepClass.getName()); // 7.3 Conformance (WebServiceProvider and WebService): A class annotated with the WebServiceProvider // annotation MUST NOT carry a WebService annotation if (sepClass.isAnnotationPresent(WebService.class)) throw new WebServiceException("Provider cannot carry @WebService annotation: " + sepClass.getName()); WSDLUtils wsdlUtils = WSDLUtils.getInstance(); String name = wsdlUtils.getJustClassName(sepClass); String serviceName = anWebServiceProvider.serviceName(); if (serviceName.length() == 0) serviceName = name + "Service"; String targetNS = anWebServiceProvider.targetNamespace(); if (targetNS.length() == 0) targetNS = wsdlUtils.getTypeNamespace(sepClass); String portName = anWebServiceProvider.portName(); if (portName.length() == 0) portName = name + "Port"; ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(targetNS, serviceName)); wsMetaData.addService(serviceMetaData); // Setup the ServerEndpointMetaData QName portQName = new QName(targetNS, portName); QName portTypeQName = new QName(targetNS, name); Endpoint ep = dep.getService().getEndpointByName(linkName); ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, ep, portQName, portTypeQName, Type.JAXWS); sepMetaData.setLinkName(linkName); sepMetaData.setStyle(Style.DOCUMENT); sepMetaData.setParameterStyle(ParameterStyle.BARE); sepMetaData.setServiceEndpointImplName(sepClass.getName()); sepMetaData.setServiceEndpointInterfaceName(sepClass.getName()); ServiceMode anServiceMode = sepClass.getAnnotation(ServiceMode.class); sepMetaData.setServiceMode(anServiceMode != null ? anServiceMode.value() : Mode.PAYLOAD); serviceMetaData.addEndpoint(sepMetaData); // Process invoke method processInvokeMethod(sepMetaData); // Process WSDL String wsdlLocation = anWebServiceProvider.wsdlLocation(); if (wsdlLocation.length() > 0) { URL wsdlURL = dep.getMetaDataFileURL(wsdlLocation); serviceMetaData.setWsdlLocation(wsdlURL); } // process binding type processBindingType(sepMetaData, sepClass); // process handler chain processHandlerChain(sepMetaData, sepClass); // process config processEndpointConfig(dep, sepMetaData, sepClass, linkName); // Set the endpoint address processWebContext(dep, sepClass, linkName, sepMetaData); // Init the endpoint address initEndpointAddress(dep, sepMetaData); // A provider may not have a WSDL file if (sepMetaData.getServiceMetaData().getWsdlLocation() != null) MetaDataBuilder.replaceAddressLocation(sepMetaData); // init service endpoint id ObjectName sepID = MetaDataBuilder.createServiceEndpointID(dep, sepMetaData); sepMetaData.setServiceEndpointID(sepID); return sepMetaData; } private void processInvokeMethod(ServerEndpointMetaData epMetaData) { String javaName = "invoke"; String targetNS = epMetaData.getPortName().getNamespaceURI(); OperationMetaData opMetaData = new OperationMetaData(epMetaData, new QName(targetNS, javaName), javaName); epMetaData.addOperation(opMetaData); // Setup invoke param Class paramType = Source.class; QName xmlName = SOAPContentElement.GENERIC_PARAM_NAME; QName xmlType = Constants.TYPE_LITERAL_ANYTYPE; ParameterMetaData pmd = new ParameterMetaData(opMetaData, xmlName, xmlType, paramType.getName()); opMetaData.addParameter(pmd); // Setup invoke return xmlName = SOAPContentElement.GENERIC_RETURN_NAME; ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, paramType.getName()); opMetaData.setReturnParameter(retMetaData); } }././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWS0000644000175000017500000003135310730542057031370 0ustar godgod/* * 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.metadata.builder.jaxws; //$Id: JAXWSClientMetaDataBuilder.java 5322 2007-12-14 17:58:07Z richard.opalka@jboss.com $ import java.io.IOException; import java.net.URL; import java.util.*; import javax.jws.soap.SOAPBinding; import javax.xml.namespace.QName; import javax.xml.ws.BindingType; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxws.client.ServiceObjectFactoryJAXWS; import org.jboss.ws.core.soap.Style; import org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder; import org.jboss.ws.extensions.wsrm.common.RMHelper; import org.jboss.ws.metadata.umdm.ClientEndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.wsf.common.ResourceLoaderAdapter; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData; import org.jboss.ws.annotation.EndpointConfig; /** * A client side meta data builder. * * @author Thomas.Diesler@jboss.org * @since 19-May-2005 */ public class JAXWSClientMetaDataBuilder extends JAXWSMetaDataBuilder { public ServiceMetaData buildMetaData(QName serviceName, URL wsdlURL, UnifiedVirtualFile vfsRoot) { if (wsdlURL == null) throw new IllegalArgumentException("Invalid wsdlURL: " + wsdlURL); log.debug("START buildMetaData: [service=" + serviceName + "]"); try { UnifiedMetaData wsMetaData = new UnifiedMetaData(vfsRoot); ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceName); wsMetaData.addService(serviceMetaData); serviceMetaData.setWsdlLocation(wsdlURL); WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions(); buildMetaDataInternal(serviceMetaData, wsdlDefinitions); //Setup policies for each endpoint //Policy processing disable in order to attend the WSCF Interoperability plug-fest (that requires WS-Security Policy and we don't have it yet) for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints()) { PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getClientSidePolicyMetaDataBuilder(); policyBuilder.processPolicyExtensions(epMetaData, wsdlDefinitions); } // Read the WSDL and initialize the schema model // This should only be needed for debuging purposes of the UMDM JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes()); serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel); log.debug("END buildMetaData: " + wsMetaData); return serviceMetaData; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot build meta data: " + ex.getMessage(), ex); } } /** Build from WSDL and service name */ public ServiceMetaData buildMetaData(QName serviceName, URL wsdlURL) { return buildMetaData(serviceName, wsdlURL, new ResourceLoaderAdapter()); } private void buildMetaDataInternal(ServiceMetaData serviceMetaData, WSDLDefinitions wsdlDefinitions) throws IOException { QName serviceName = serviceMetaData.getServiceName(); // Get the WSDL service WSDLService wsdlService = null; if (serviceName == null) { if (wsdlDefinitions.getServices().length != 1) throw new IllegalArgumentException("Expected a single service element"); wsdlService = wsdlDefinitions.getServices()[0]; serviceMetaData.setServiceName(wsdlService.getName()); } else { wsdlService = wsdlDefinitions.getService(serviceName); } if (wsdlService == null) { List serviceNames = new ArrayList(); for (WSDLService wsdls : wsdlDefinitions.getServices()) serviceNames.add(wsdls.getName()); throw new IllegalArgumentException("Cannot obtain wsdl service: " + serviceName + " we have " + serviceNames); } // Build endpoint meta data for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints()) { QName bindingName = wsdlEndpoint.getBinding(); WSDLBinding wsdlBinding = wsdlEndpoint.getWsdlService().getWsdlDefinitions().getBinding(bindingName); String bindingType = wsdlBinding.getType(); if (Constants.NS_SOAP11.equals(bindingType) || Constants.NS_SOAP12.equals(bindingType)) { QName portName = wsdlEndpoint.getName(); QName interfaceQName = wsdlEndpoint.getInterface().getName(); ClientEndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, interfaceQName, Type.JAXWS); epMetaData.setEndpointAddress(wsdlEndpoint.getAddress()); serviceMetaData.addEndpoint(epMetaData); // Init the endpoint binding initEndpointBinding(wsdlEndpoint, epMetaData); // Init the service encoding style initEndpointEncodingStyle(epMetaData); setupOperationsFromWSDL(epMetaData, wsdlEndpoint); // service-ref contributions bufferServiceRefContributions(epMetaData); } } } /** * Buffer portComponent information that it can be reused * when rebuild is called (actually getPort(...)) * @param epMetaData */ private void bufferServiceRefContributions(EndpointMetaData epMetaData) { UnifiedServiceRefMetaData serviceRefMetaData = ServiceObjectFactoryJAXWS.getServiceRefAssociation(); if(serviceRefMetaData!=null) { for(UnifiedPortComponentRefMetaData portComp : serviceRefMetaData.getPortComponentRefs()) { epMetaData.getServiceRefContrib().add(portComp); } } } /** * ServiceRef deployment descriptor elements may override the endpoint metadata. * @param epMetaData */ private void processServiceRefContributions(EndpointMetaData epMetaData) { Iterator it = epMetaData.getServiceRefContrib().iterator(); while(it.hasNext()) { UnifiedPortComponentRefMetaData portComp = it.next(); if(epMetaData.matches(portComp)) { log.debug("Processing service-ref contribution on portType: "+epMetaData.getPortTypeName()); // process MTOM overrides if(portComp.getEnableMTOM()) { String bindingId = epMetaData.getBindingId(); if(bindingId.equals(Constants.SOAP11HTTP_BINDING)) epMetaData.setBindingId(Constants.SOAP11HTTP_MTOM_BINDING); else if(bindingId.equals(Constants.SOAP12HTTP_BINDING)) epMetaData.setBindingId(Constants.SOAP12HTTP_MTOM_BINDING); } // process stub properties for(UnifiedStubPropertyMetaData stubProp: portComp.getStubProperties()) { epMetaData.getProperties().put(stubProp.getPropName(), stubProp.getPropValue()); } // process call properties for(UnifiedCallPropertyMetaData callProp: portComp.getCallProperties()) { epMetaData.getProperties().put(callProp.getPropName(), callProp.getPropValue()); } } } } protected void setupOperationsFromWSDL(EndpointMetaData epMetaData, WSDLEndpoint wsdlEndpoint) { WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getInterface().getWsdlDefinitions(); // For every WSDL interface operation build the OperationMetaData WSDLInterface wsdlInterface = wsdlEndpoint.getInterface(); for (WSDLInterfaceOperation wsdlOperation : wsdlInterface.getOperations()) { String opName = wsdlOperation.getName().toString(); QName opQName = wsdlOperation.getName(); // Set java method name String javaName = opName.substring(0, 1).toLowerCase() + opName.substring(1); OperationMetaData opMetaData = new OperationMetaData(epMetaData, opQName, javaName); epMetaData.addOperation(opMetaData); // Set the operation style String style = wsdlOperation.getStyle(); epMetaData.setStyle((Constants.URI_STYLE_DOCUMENT.equals(style) ? Style.DOCUMENT : Style.RPC)); // Set the operation MEP if (Constants.WSDL20_PATTERN_IN_ONLY.equals(wsdlOperation.getPattern())) opMetaData.setOneWay(true); // Set the operation SOAPAction WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getName()); WSDLBindingOperation wsdlBindingOperation = wsdlBinding.getOperationByRef(opQName); if (wsdlBindingOperation != null) opMetaData.setSOAPAction(wsdlBindingOperation.getSOAPAction()); } } public void rebuildEndpointMetaData(EndpointMetaData epMetaData, Class wsClass) { if(log.isDebugEnabled()) log.debug("START: rebuildMetaData"); // Clear the java types, etc. resetMetaDataBuilder(epMetaData.getClassLoader()); // Nuke parameterStyle epMetaData.setParameterStyle(null); // Process an optional @BindingType annotation if (wsClass.isAnnotationPresent(BindingType.class)) processBindingType(epMetaData, wsClass); // Process @SOAPBinding if (wsClass.isAnnotationPresent(SOAPBinding.class)) processSOAPBinding(epMetaData, wsClass); // process config, this will as well setup the handler processEndpointConfig(epMetaData, wsClass); epMetaData.initEndpointConfig(); // Process an optional @HandlerChain annotation processHandlerChain(epMetaData, wsClass); // Process @WebMethod processWebMethods(epMetaData, wsClass); // Initialize types createJAXBContext(epMetaData); populateXmlTypes(epMetaData); // Set SEI name epMetaData.setServiceEndpointInterfaceName(wsClass.getName()); // service-ref contributions processServiceRefContributions(epMetaData); //epMetaData.getServiceRefContrib().clear(); // Eager initialization epMetaData.eagerInitialize(); // wsrm initialization if (epMetaData.getConfig().getRMMetaData() != null) { RMHelper.setupRMOperations(epMetaData); } if(log.isDebugEnabled()) log.debug("END: rebuildMetaData\n" + epMetaData.getServiceMetaData()); } /** * Process config contribution through service endpoint interfaces * @param epMetaData * @param wsClass - the service endpoint interface */ private void processEndpointConfig(EndpointMetaData epMetaData, Class wsClass) { if (wsClass.isAnnotationPresent(EndpointConfig.class)) { EndpointConfig anConfig = wsClass.getAnnotation(EndpointConfig.class); epMetaData.setConfigName(anConfig.configName(), anConfig.configFile()); } } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWS0000644000175000017500000000565510656142514031377 0ustar godgod/* * 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. */ // $Id: JAXWSMetaDataBuilderJSE.java 4241 2007-08-07 19:17:32Z heiko.braun@jboss.com $ package org.jboss.ws.metadata.builder.jaxws; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.Endpoint; /** * A server side meta data builder that is based on JSR-181 annotations * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 23-Jul-2005 */ public class JAXWSMetaDataBuilderJSE { // provide logging private final Logger log = Logger.getLogger(JAXWSMetaDataBuilderJSE.class); /** Build from annotations */ public UnifiedMetaData buildMetaData(ArchiveDeployment dep) { log.debug("START buildMetaData: [name=" + dep.getCanonicalName() + "]"); try { UnifiedMetaData wsMetaData = new UnifiedMetaData(dep.getRootFile()); wsMetaData.setDeploymentName(dep.getCanonicalName()); ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader(); if(null == runtimeClassLoader) throw new IllegalArgumentException("Runtime classloader cannot be null"); wsMetaData.setClassLoader(runtimeClassLoader); // For every bean for (Endpoint ep : dep.getService().getEndpoints()) { String shortName = ep.getShortName(); Class beanClass = ep.getTargetBeanClass(); JAXWSServerMetaDataBuilder.setupProviderOrWebService(dep, wsMetaData, beanClass, shortName); } log.debug("END buildMetaData: " + wsMetaData); return wsMetaData; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot build meta data: " + ex.getMessage(), ex); } } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWS0000644000175000017500000011661310743173754031403 0ustar godgod/* * 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.metadata.builder.jaxws; // $Id: JAXWSMetaDataBuilder.java 5471 2008-01-15 18:14:04Z alessio.soldano@jboss.com $ import java.io.File; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import javax.jws.HandlerChain; import javax.jws.Oneway; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPMessageHandlers; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.ws.BindingType; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; import javax.xml.ws.WebFault; import javax.xml.ws.addressing.Action; import javax.xml.ws.addressing.AddressingProperties; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.annotation.Documentation; import org.jboss.ws.core.jaxws.DynamicWrapperGenerator; import org.jboss.ws.core.jaxws.JAXBContextFactory; import org.jboss.ws.core.jaxws.WrapperGenerator; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.soap.Use; import org.jboss.ws.core.utils.HolderUtils; import org.jboss.ws.core.utils.JBossWSEntityResolver; import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl; import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt; import org.jboss.ws.extensions.xop.jaxws.AttachmentScanResult; import org.jboss.ws.extensions.xop.jaxws.ReflectiveAttachmentRefScanner; import org.jboss.ws.metadata.acessor.JAXBAccessor; import org.jboss.ws.metadata.builder.MetaDataBuilder; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.TypeMappingMetaData; import org.jboss.ws.metadata.umdm.TypesMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLMIMEPart; import org.jboss.wsf.common.JavaUtils; import org.jboss.wsf.spi.binding.BindingCustomization; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.metadata.j2ee.serviceref.HandlerChainsObjectFactory; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import com.sun.xml.bind.api.JAXBRIContext; import com.sun.xml.bind.api.TypeReference; /** * Abstract class that represents a JAX-WS metadata builder. * * @author Jason T. Greene * @author Thomas.Diesler@jboss.com */ @SuppressWarnings("deprecation") public class JAXWSMetaDataBuilder extends MetaDataBuilder { protected static final Logger log = Logger.getLogger(JAXWSWebServiceMetaDataBuilder.class); protected List> javaTypes = new ArrayList>(); protected JAXBRIContext jaxbCtx; protected List typeRefs = new ArrayList(); protected WrapperGenerator wrapperGenerator; protected void processBindingType(EndpointMetaData epMetaData, Class wsClass) { if (wsClass.isAnnotationPresent(BindingType.class)) { log.debug("processBindingType on: " + wsClass.getName()); BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class); epMetaData.setBindingId(anBindingType.value()); } } protected void processSOAPBinding(EndpointMetaData epMetaData, Class wsClass) { if (wsClass.isAnnotationPresent(SOAPBinding.class)) { log.debug("processSOAPBinding on: " + wsClass.getName()); SOAPBinding anSoapBinding = wsClass.getAnnotation(SOAPBinding.class); SOAPBinding.Style attrStyle = anSoapBinding.style(); Style style = (attrStyle == SOAPBinding.Style.RPC ? Style.RPC : Style.DOCUMENT); epMetaData.setStyle(style); SOAPBinding.Use attrUse = anSoapBinding.use(); if (attrUse == SOAPBinding.Use.ENCODED) throw new WSException("SOAP encoding is not supported for JSR-181 deployments"); epMetaData.setEncodingStyle(Use.LITERAL); ParameterStyle paramStyle = anSoapBinding.parameterStyle(); epMetaData.setParameterStyle(paramStyle); } } /** * Process an optional @HandlerChain annotation * * Location of the handler chain file. The location supports 2 formats. * * 1. An absolute java.net.URL in externalForm. * (ex: http://myhandlers.foo.com/handlerfile1.xml) * * 2. A relative path from the source file or class file. * (ex: bar/handlerfile1.xml) */ protected void processHandlerChain(EndpointMetaData epMetaData, Class wsClass) { if (wsClass.isAnnotationPresent(SOAPMessageHandlers.class)) throw new WSException("Cannot combine @HandlerChain with @SOAPMessageHandlers"); if (wsClass.isAnnotationPresent(HandlerChain.class)) { HandlerChain anHandlerChain = wsClass.getAnnotation(HandlerChain.class); String filename = anHandlerChain.file(); // Setup the endpoint handlers UnifiedHandlerChainsMetaData handlerChainsMetaData = getHandlerChainsMetaData(wsClass, filename); for (UnifiedHandlerChainMetaData UnifiedHandlerChainMetaData : handlerChainsMetaData.getHandlerChains()) { for (UnifiedHandlerMetaData uhmd : UnifiedHandlerChainMetaData.getHandlers()) { HandlerMetaDataJAXWS hmd = HandlerMetaDataJAXWS.newInstance(uhmd, HandlerType.ENDPOINT); epMetaData.addHandler(hmd); } } } } public static UnifiedHandlerChainsMetaData getHandlerChainsMetaData(Class wsClass, String filename) { URL fileURL = null; log.debug("processHandlerChain [" + filename + "] on: " + wsClass.getName()); // Try the filename as URL try { fileURL = new URL(filename); } catch (MalformedURLException ex) { // ignore } // Try the filename as File if (fileURL == null) { try { File file = new File(filename); if (file.exists()) fileURL = file.toURL(); } catch (MalformedURLException e) { // ignore } } // Try the filename as Resource if (fileURL == null) { log.debug(wsClass.getProtectionDomain().getCodeSource()); log.debug(wsClass.getClassLoader()); fileURL = wsClass.getClassLoader().getResource(filename); } // Try the filename relative to class if (fileURL == null) { String filepath = filename; String packagePath = wsClass.getPackage().getName().replace('.', '/'); String resourcePath = packagePath + "/" + filepath; while (filepath.startsWith("../")) { packagePath = packagePath.substring(0, packagePath.lastIndexOf("/")); filepath = filepath.substring(3); resourcePath = packagePath + "/" + filepath; } fileURL = wsClass.getClassLoader().getResource(resourcePath); } if (fileURL == null) throw new WSException("Cannot resolve handler file '" + filename + "' on " + wsClass.getName()); log.debug("Loading handler chain: " + fileURL); UnifiedHandlerChainsMetaData handlerChainsMetaData = null; try { InputStream is = fileURL.openStream(); try { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.setValidation(true); unmarshaller.setSchemaValidation(true); unmarshaller.setEntityResolver(new JBossWSEntityResolver()); ObjectModelFactory factory = new HandlerChainsObjectFactory(); handlerChainsMetaData = (UnifiedHandlerChainsMetaData)unmarshaller.unmarshal(is, factory, null); } finally { is.close(); } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot process handler chain: " + filename, ex); } return handlerChainsMetaData; } private void addFault(OperationMetaData opMetaData, Class exception) { if (opMetaData.isOneWay()) throw new IllegalStateException("JSR-181 4.3.1 - A JSR-181 processor is REQUIRED to report an error if an operation marked " + "@Oneway has a return value, declares any checked exceptions or has any INOUT or OUT parameters."); WebFault anWebFault = exception.getAnnotation(WebFault.class); // Only the element name is effected by @WebFault, the type uses the same convention QName xmlType = new QName(opMetaData.getQName().getNamespaceURI(), exception.getSimpleName()); String name = xmlType.getLocalPart(); String namespace = xmlType.getNamespaceURI(); String faultBean = null; Class faultBeanClass = getFaultInfo(exception); if (faultBeanClass != null) faultBean = faultBeanClass.getName(); /* * If @WebFault is present, and the exception contains getFaultInfo, the * return value should be used. Otherwise we need to generate the bean. */ if (anWebFault != null) { if (anWebFault.name().length() > 0) name = anWebFault.name(); if (anWebFault.targetNamespace().length() > 0) { namespace = anWebFault.targetNamespace(); XmlType anXmlType = exception.getAnnotation(XmlType.class); if (anXmlType != null) xmlType = new QName(anXmlType.namespace(), exception.getSimpleName()); } if (anWebFault.faultBean().length() > 0) faultBean = anWebFault.faultBean(); } if (faultBean == null) faultBean = JavaUtils.getPackageName(opMetaData.getEndpointMetaData().getServiceEndpointInterface()) + ".jaxws." + exception.getSimpleName() + "Bean"; QName xmlName = new QName(namespace, name); FaultMetaData fmd = new FaultMetaData(opMetaData, xmlName, xmlType, exception.getName()); fmd.setFaultBeanName(faultBean); if (fmd.loadFaultBean() == null) wrapperGenerator.generate(fmd); javaTypes.add(fmd.getFaultBean()); typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean())); opMetaData.addFault(fmd); } private String convertToVariable(String localName) { return JAXBRIContext.mangleNameToVariableName(localName.intern()); } private String[] convertTypeArguments(Class rawType, Type type) { if (!Collection.class.isAssignableFrom(rawType) && !Map.class.isAssignableFrom(rawType)) return null; if (!(type instanceof ParameterizedType)) return null; ParameterizedType paramType = (ParameterizedType)type; Type[] arguments = paramType.getActualTypeArguments(); String[] ret = new String[arguments.length]; for (int i = 0; i < arguments.length; i++) ret[i] = JavaUtils.erasure(arguments[i]).getName(); return ret; } private ParameterMetaData createRequestWrapper(OperationMetaData operation, Method method) { String requestWrapperType = null; QName xmlName = operation.getQName(); QName xmlType = xmlName; if (method.isAnnotationPresent(RequestWrapper.class)) { RequestWrapper anReqWrapper = method.getAnnotation(RequestWrapper.class); String localName = anReqWrapper.localName().length() > 0 ? anReqWrapper.localName() : xmlName.getLocalPart(); String targetNamespace = anReqWrapper.targetNamespace().length() > 0 ? anReqWrapper.targetNamespace() : xmlName.getNamespaceURI(); xmlName = new QName(targetNamespace, localName); if (anReqWrapper.className().length() > 0) requestWrapperType = anReqWrapper.className(); } // Conformance 3.18, the default value must be the same as the method name if (requestWrapperType == null) { String packageName = JavaUtils.getPackageName(method.getDeclaringClass()); requestWrapperType = packageName + ".jaxws." + JavaUtils.capitalize(method.getName()); } // JAX-WS p.37 pg.1, the annotation only affects the element name, not the type name ParameterMetaData wrapperParameter = new ParameterMetaData(operation, xmlName, xmlType, requestWrapperType); wrapperParameter.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR); operation.addParameter(wrapperParameter); return wrapperParameter; } private ParameterMetaData createResponseWrapper(OperationMetaData operation, Method method) { QName operationQName = operation.getQName(); QName xmlName = new QName(operationQName.getNamespaceURI(), operationQName.getLocalPart() + "Response"); QName xmlType = xmlName; String responseWrapperType = null; if (method.isAnnotationPresent(ResponseWrapper.class)) { ResponseWrapper anResWrapper = method.getAnnotation(ResponseWrapper.class); String localName = anResWrapper.localName().length() > 0 ? anResWrapper.localName() : xmlName.getLocalPart(); String targetNamespace = anResWrapper.targetNamespace().length() > 0 ? anResWrapper.targetNamespace() : xmlName.getNamespaceURI(); xmlName = new QName(targetNamespace, localName); if (anResWrapper.className().length() > 0) responseWrapperType = anResWrapper.className(); } if (responseWrapperType == null) { String packageName = JavaUtils.getPackageName(method.getDeclaringClass()); responseWrapperType = packageName + ".jaxws." + JavaUtils.capitalize(method.getName()) + "Response"; } ParameterMetaData retMetaData = new ParameterMetaData(operation, xmlName, xmlType, responseWrapperType); retMetaData.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR); operation.setReturnParameter(retMetaData); return retMetaData; } private Class getFaultInfo(Class exception) { try { Method method = exception.getMethod("getFaultInfo"); Class returnType = method.getReturnType(); if (returnType == void.class) return null; return returnType; } catch (SecurityException e) { throw new WSException("Unexpected security exception: " + e.getMessage(), e); } catch (NoSuchMethodException e) { return null; } } private ParameterMode getParameterMode(WebParam anWebParam, Class javaType) { if (anWebParam != null) { if (anWebParam.mode() == WebParam.Mode.INOUT) return ParameterMode.INOUT; if (anWebParam.mode() == WebParam.Mode.OUT) return ParameterMode.OUT; } return HolderUtils.isHolderType(javaType) ? ParameterMode.INOUT : ParameterMode.IN; } private WebParam getWebParamAnnotation(Method method, int pos) { for (Annotation annotation : method.getParameterAnnotations()[pos]) if (annotation instanceof WebParam) return (WebParam)annotation; return null; } private QName getWebParamName(OperationMetaData opMetaData, int index, WebParam webParam) { String namespace = null; String name = null; boolean header = false; if (webParam != null) { if (webParam.targetNamespace().length() > 0) namespace = webParam.targetNamespace(); // RPC types use the partName for their XML name if (webParam.partName().length() > 0 && opMetaData.isRPCLiteral()) name = webParam.partName(); else if (webParam.name().length() > 0) name = webParam.name(); header = webParam.header(); } // Bare and headers must be qualified if (namespace == null && (opMetaData.isDocumentBare() || header)) namespace = opMetaData.getQName().getNamespaceURI(); // RPC body parts must have no namespace else if (opMetaData.isRPCLiteral() && !header) namespace = null; // Bare uses the operation name as the default, everything else is generated if (name == null) name = opMetaData.isDocumentBare() && !header ? opMetaData.getQName().getLocalPart() : "arg" + index; return (namespace != null) ? new QName(namespace, name) : new QName(name); } private QName getWebResultName(OperationMetaData opMetaData, WebResult anWebResult) { String name = null; String namespace = null; boolean header = false; if (anWebResult != null) { if (anWebResult.targetNamespace().length() > 0) namespace = anWebResult.targetNamespace(); // RPC types use the partName for their XML name if (anWebResult.partName().length() > 0 && opMetaData.isRPCLiteral()) name = anWebResult.partName(); else if (anWebResult.name().length() > 0) name = anWebResult.name(); header = anWebResult.header(); } // Bare and headers must be qualified if (namespace == null && (opMetaData.isDocumentBare() || header)) namespace = opMetaData.getQName().getNamespaceURI(); // RPC body parts must have no namespace else if (opMetaData.isRPCLiteral() && !header) namespace = null; // Bare uses the operation name as the default, everything else is generated if (name == null) name = opMetaData.isDocumentBare() && !header ? opMetaData.getResponseName().getLocalPart() : "return"; return (namespace != null) ? new QName(namespace, name) : new QName(name); } /** * Process operation meta data extensions. */ private void processMetaExtensions(Method method, EndpointMetaData epMetaData, OperationMetaData opMetaData) { AddressingProperties ADDR = new AddressingPropertiesImpl(); AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI()); Action anAction = method.getAnnotation(Action.class); if (anAction != null) { addrExt.setInboundAction(anAction.input()); addrExt.setOutboundAction(anAction.output()); } else // default action values { // TODO: figure out a way to assign message name instead of IN and OUT String tns = epMetaData.getPortName().getNamespaceURI(); String portTypeName = epMetaData.getPortName().getLocalPart(); addrExt.setInboundAction(tns + "/" + portTypeName + "/IN"); if (!opMetaData.isOneWay()) addrExt.setOutboundAction(tns + "/" + portTypeName + "/OUT"); } opMetaData.addExtension(addrExt); } private void processWebMethod(EndpointMetaData epMetaData, Method method) { String javaName = method.getName(); // skip asnyc methods, they dont need meta data representation if (method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX)) return; // reflection defaults String soapAction = ""; String operationName = method.getName(); // annotation values that override defaults if (method.isAnnotationPresent(WebMethod.class)) { WebMethod anWebMethod = method.getAnnotation(WebMethod.class); soapAction = anWebMethod.action(); if (anWebMethod.operationName().length() > 0) { operationName = anWebMethod.operationName(); } } String targetNS = epMetaData.getPortTypeName().getNamespaceURI(); OperationMetaData opMetaData = new OperationMetaData(epMetaData, new QName(targetNS, operationName), javaName); opMetaData.setOneWay(method.isAnnotationPresent(Oneway.class)); opMetaData.setSOAPAction(soapAction); if (method.isAnnotationPresent(SOAPBinding.class)) { SOAPBinding anBinding = method.getAnnotation(SOAPBinding.class); if (anBinding.style() != SOAPBinding.Style.DOCUMENT || epMetaData.getStyle() != Style.DOCUMENT) throw new IllegalArgumentException("@SOAPBinding must be specified using DOCUMENT style when placed on a method"); opMetaData.setParameterStyle(anBinding.parameterStyle()); } if (method.isAnnotationPresent(Documentation.class)) { opMetaData.setDocumentation(method.getAnnotation(Documentation.class).content()); } epMetaData.addOperation(opMetaData); // Build parameter meta data // Attachment annotations on SEI parameters List scanResult = ReflectiveAttachmentRefScanner.scanMethod(method); Class[] parameterTypes = method.getParameterTypes(); Type[] genericTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); ParameterMetaData wrapperParameter = null, wrapperOutputParameter = null; List wrappedParameters = null, wrappedOutputParameters = null; // Force paramter style to wrapped if (method.isAnnotationPresent(RequestWrapper.class) || method.isAnnotationPresent(ResponseWrapper.class)) { epMetaData.setParameterStyle(ParameterStyle.WRAPPED); } if (opMetaData.isDocumentWrapped()) { wrapperParameter = createRequestWrapper(opMetaData, method); wrappedParameters = new ArrayList(parameterTypes.length); wrapperParameter.setWrappedParameters(wrappedParameters); if (!opMetaData.isOneWay()) { wrapperOutputParameter = createResponseWrapper(opMetaData, method); wrappedOutputParameters = new ArrayList(parameterTypes.length + 1); wrapperOutputParameter.setWrappedParameters(wrappedOutputParameters); } } for (int i = 0; i < parameterTypes.length; i++) { Class javaType = parameterTypes[i]; Type genericType = genericTypes[i]; String javaTypeName = javaType.getName(); WebParam anWebParam = getWebParamAnnotation(method, i); boolean isHeader = anWebParam != null && anWebParam.header(); boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader; ParameterMode mode = getParameterMode(anWebParam, javaType); // Assert one-way if (opMetaData.isOneWay() && mode != ParameterMode.IN) throw new IllegalArgumentException("A one-way operation can not have output parameters [" + "method = " + method.getName() + ", parameter = " + i + "]"); if (HolderUtils.isHolderType(javaType)) { genericType = HolderUtils.getGenericValueType(genericType); javaType = JavaUtils.erasure(genericType); javaTypeName = javaType.getName(); } if (isWrapped) { QName wrappedElementName = getWebParamName(opMetaData, i, anWebParam); String variable = convertToVariable(wrappedElementName.getLocalPart()); WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName, javaTypeName, variable, i); wrappedParameter.setTypeArguments(convertTypeArguments(javaType, genericType)); if (mode != ParameterMode.OUT) wrappedParameters.add(wrappedParameter); if (mode != ParameterMode.IN) { wrappedParameter.setHolder(true); // WrappedParameters can not be shared between request/response objects (accessors) if (mode == ParameterMode.INOUT) wrappedParameter = new WrappedParameter(wrappedParameter); wrappedOutputParameters.add(wrappedParameter); } processAttachmentAnnotationsWrapped(scanResult, i, wrappedParameter); } else { QName xmlName = getWebParamName(opMetaData, i, anWebParam); ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, javaTypeName); paramMetaData.setInHeader(isHeader); paramMetaData.setIndex(i); paramMetaData.setMode(mode); /* * Note: The TCK enforces the following rule in the spec regarding * partName: "This is only used if the operation is rpc style or if * the operation is document style and the parameter style is BARE." * * This seems to be a flaw in the spec, because the intention is * obviously to prevent the ambiguity of wrapped parameters that * specify different partName values. There is, however, no reason * that this limitation should apply to header parameters since they * are never wrapped. In order to comply we adhere to this confusing * rule, although I will ask for clarification. */ if (anWebParam != null && !opMetaData.isDocumentWrapped() && anWebParam.partName().length() > 0) paramMetaData.setPartName(anWebParam.partName()); opMetaData.addParameter(paramMetaData); javaTypes.add(javaType); typeRefs.add(new TypeReference(xmlName, genericType, parameterAnnotations[i])); processAttachmentAnnotations(scanResult, i, paramMetaData); processMIMEBinding(epMetaData, opMetaData, paramMetaData); } } // Build result meta data Class returnType = method.getReturnType(); Type genericReturnType = method.getGenericReturnType(); String returnTypeName = returnType.getName(); if (!(returnType == void.class)) { if (opMetaData.isOneWay()) throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay"); WebResult anWebResult = method.getAnnotation(WebResult.class); boolean isHeader = anWebResult != null && anWebResult.header(); boolean isWrappedBody = opMetaData.isDocumentWrapped() && !isHeader; QName xmlName = getWebResultName(opMetaData, anWebResult); if (isWrappedBody) { WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName, convertToVariable(xmlName.getLocalPart()), -1); wrapped.setTypeArguments(convertTypeArguments(returnType, genericReturnType)); // insert at the beginning just for prettiness wrappedOutputParameters.add(0, wrapped); processAttachmentAnnotationsWrapped(scanResult, -1, wrapped); } else { ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, returnTypeName); retMetaData.setInHeader(isHeader); retMetaData.setIndex(-1); retMetaData.setMode(ParameterMode.OUT); // Special case: If we have a document/literal wrapped message, then // the return metadata must be the wrapper type that is sent in the // body. So, in order to handle headers that are mapped to the java // return value, we have to add them to a parameter with an index of // -1 to signify the return value. All other binding styles use the // expected return value mechanism. if (opMetaData.isDocumentWrapped()) { opMetaData.addParameter(retMetaData); } else { // See above comment in the parameter for loop section as to why // we prevent customization of part names on document wrapped // header parameters. if (anWebResult != null && anWebResult.partName().length() > 0) retMetaData.setPartName(anWebResult.partName()); opMetaData.setReturnParameter(retMetaData); } javaTypes.add(returnType); typeRefs.add(new TypeReference(xmlName, genericReturnType, method.getAnnotations())); processAttachmentAnnotations(scanResult, -1, retMetaData); processMIMEBinding(epMetaData, opMetaData, retMetaData); } } // Generate wrapper beans if (opMetaData.isDocumentWrapped()) { if (wrapperParameter.loadWrapperBean() == null) wrapperGenerator.generate(wrapperParameter); Class wrapperClass = wrapperParameter.getJavaType(); javaTypes.add(wrapperClass); // In case there is no @XmlRootElement typeRefs.add(new TypeReference(wrapperParameter.getXmlName(), wrapperClass)); if (!opMetaData.isOneWay()) { if (wrapperOutputParameter.loadWrapperBean() == null) wrapperGenerator.generate(wrapperOutputParameter); wrapperClass = wrapperOutputParameter.getJavaType(); javaTypes.add(wrapperClass); // In case there is no @XmlRootElement typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(), wrapperClass)); } } // Add faults for (Class exClass : method.getExceptionTypes()) if (!RemoteException.class.isAssignableFrom(exClass)) addFault(opMetaData, exClass); // process operation meta data extension processMetaExtensions(method, epMetaData, opMetaData); } /** * @see org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder#processAttachmentAnnotations(java.util.List, int, org.jboss.ws.metadata.umdm.ParameterMetaData) * @param scanResult * @param i * @param wrappedParameter */ private void processAttachmentAnnotationsWrapped(List scanResult, int i, WrappedParameter wrappedParameter) { AttachmentScanResult asr = ReflectiveAttachmentRefScanner.getResultByIndex(scanResult, i); if (asr != null) { if (AttachmentScanResult.Type.SWA_REF == asr.getType()) wrappedParameter.setSwaRef(true); else wrappedParameter.setXOP(true); } } /** * Update PMD according to attachment annotations that might be in place * @param scanResult * @param i * @param parameter */ private void processAttachmentAnnotations(List scanResult, int i, ParameterMetaData parameter) { AttachmentScanResult asr = ReflectiveAttachmentRefScanner.getResultByIndex(scanResult, i); if (asr != null) { if (AttachmentScanResult.Type.SWA_REF == asr.getType()) parameter.setSwaRef(true); else parameter.setXOP(true); } } private void processMIMEBinding(EndpointMetaData epMetaData, OperationMetaData opMetaData, ParameterMetaData paramMetaData) { // process SWA metadata WSDLDefinitions wsdlDef = epMetaData.getServiceMetaData().getWsdlDefinitions(); if (wsdlDef != null) { for (WSDLBinding binding : wsdlDef.getBindings()) { for (WSDLBindingOperation bindingOp : binding.getOperations()) { // it might an input or output parameter WSDLBindingMessageReference[] inOrOutPut = (paramMetaData.getMode().equals(ParameterMode.IN) || paramMetaData.getMode().equals(ParameterMode.INOUT)) ? (WSDLBindingMessageReference[])bindingOp .getInputs() : (WSDLBindingMessageReference[])bindingOp.getOutputs(); if (inOrOutPut.length > 0) { // find matching operation if (bindingOp.getRef().equals(opMetaData.getQName())) { WSDLBindingMessageReference bindingInput = inOrOutPut[0]; for (WSDLMIMEPart mimePart : bindingInput.getMimeParts()) { String partName = mimePart.getPartName(); if (paramMetaData.getPartName().equals(partName)) { log.debug("Identified 'mime:content' binding: " + partName + ", mimeTypes=" + mimePart.getMimeTypes()); paramMetaData.setSwA(true); paramMetaData.setMimeTypes(mimePart.getMimeTypes()); break; } } } } } } } } protected void processWebMethods(EndpointMetaData epMetaData, Class wsClass) { epMetaData.clearOperations(); // Process @WebMethod annotations int webMethodCount = 0; for (Method method : wsClass.getMethods()) { WebMethod annotation = method.getAnnotation(WebMethod.class); boolean exclude = annotation != null && annotation.exclude(); if (!exclude && (annotation != null || wsClass.isInterface())) { processWebMethod(epMetaData, method); webMethodCount++; } } // @WebService should expose all inherited methods if @WebMethod is never specified if (webMethodCount == 0 && !wsClass.isInterface()) { for (Method method : wsClass.getMethods()) { WebMethod annotation = method.getAnnotation(WebMethod.class); boolean exclude = annotation != null && annotation.exclude(); if (!exclude && method.getDeclaringClass() != Object.class) { processWebMethod(epMetaData, method); webMethodCount++; } } } if (webMethodCount == 0) throw new WSException("No exposable methods found"); } protected void initWrapperGenerator(ClassLoader loader) { // Use the dynamic generator by default. Otherwise reset the last if (wrapperGenerator == null) wrapperGenerator = new DynamicWrapperGenerator(loader); else wrapperGenerator.reset(loader); } protected void resetMetaDataBuilder(ClassLoader loader) { initWrapperGenerator(loader); javaTypes.clear(); typeRefs.clear(); jaxbCtx = null; } protected void createJAXBContext(EndpointMetaData epMetaData) { try { String targetNS = epMetaData.getPortTypeName().getNamespaceURI().intern(); if (log.isDebugEnabled()) log.debug("JAXBContext [types=" + javaTypes + ",tns=" + targetNS + "]"); JAXBContextFactory factory = JAXBContextFactory.newInstance(); // JAXBIntros may mofiy the WSDL being generated // only true for server side invocation, tooling (WSProvide) doesnt support this BindingCustomization bindingCustomization = null; if (epMetaData instanceof ServerEndpointMetaData) { Endpoint endpoint = ((ServerEndpointMetaData)epMetaData).getEndpoint(); bindingCustomization = endpoint != null ? endpoint.getAttachment(BindingCustomization.class) : null; } jaxbCtx = factory.createContext(javaTypes.toArray(new Class[0]), typeRefs, targetNS, false, bindingCustomization); } catch (WSException ex) { throw new IllegalStateException("Cannot build JAXB context", ex); } } private void populateXmlType(FaultMetaData faultMetaData) { EndpointMetaData epMetaData = faultMetaData.getOperationMetaData().getEndpointMetaData(); TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData(); QName xmlType = faultMetaData.getXmlType(); String faultBeanName = faultMetaData.getFaultBeanName(); types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName)); } private void populateXmlType(ParameterMetaData paramMetaData) { EndpointMetaData epMetaData = paramMetaData.getOperationMetaData().getEndpointMetaData(); TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData(); QName xmlName = paramMetaData.getXmlName(); QName xmlType = paramMetaData.getXmlType(); Class javaType = paramMetaData.getJavaType(); String javaName = paramMetaData.getJavaTypeName(); if (xmlType == null) { try { xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType)); } catch (IllegalArgumentException e) { throw new IllegalStateException("Cannot obtain xml type for: [xmlName=" + xmlName + ",javaName=" + javaName + "]"); } /* Anonymous type. * * Currently the design of our stack is based on the * notion of their always being a unique type. In order to lookup the * appropriate (de)serializer you must have a type. So we use a fake * name. This is an illegal NCName, so it shouldn't collide. */ if (xmlType == null) xmlType = new QName(xmlName.getNamespaceURI(), ">" + xmlName.getLocalPart()); paramMetaData.setXmlType(xmlType); } types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName)); } protected void populateXmlTypes(EndpointMetaData epMetaData) { for (OperationMetaData operation : epMetaData.getOperations()) { // parameters for (ParameterMetaData paramMetaData : operation.getParameters()) { populateXmlType(paramMetaData); } // return value ParameterMetaData returnParameter = operation.getReturnParameter(); if (returnParameter != null) populateXmlType(returnParameter); // faults for (FaultMetaData faultMetaData : operation.getFaults()) { populateXmlType(faultMetaData); } } } /** * Set the wrapper generator for this builder. */ public void setWrapperGenerator(WrapperGenerator wrapperGenerator) { this.wrapperGenerator = wrapperGenerator; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWS0000644000175000017500000001414310705403612031361 0ustar godgod/* * 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.metadata.builder.jaxws; // $Id: JAXWSServerMetaDataBuilder.java 4784 2007-10-17 13:00:58Z thomas.diesler@jboss.com $ import javax.jws.WebService; import javax.xml.ws.WebServiceProvider; import org.jboss.ws.annotation.EndpointConfig; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.wsf.spi.annotation.WebContext; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.Deployment.DeploymentType; import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData; import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData; /** * Builds ServiceEndpointMetaData for a JAX-WS endpoint. * * @author Jason T. Greene * @author Thomas.Diesler@jboss.com */ public abstract class JAXWSServerMetaDataBuilder extends JAXWSMetaDataBuilder { static void setupProviderOrWebService(ArchiveDeployment dep, UnifiedMetaData umd, Class beanClass, String beanName) throws Exception { if (beanClass.isAnnotationPresent(WebService.class)) { JAXWSWebServiceMetaDataBuilder builder = new JAXWSWebServiceMetaDataBuilder(); builder.buildWebServiceMetaData(dep, umd, beanClass, beanName); } else if (beanClass.isAnnotationPresent(WebServiceProvider.class)) { JAXWSProviderMetaDataBuilder builder = new JAXWSProviderMetaDataBuilder(); builder.buildProviderMetaData(dep, umd, beanClass, beanName); } } protected void processEndpointConfig(Deployment dep, ServerEndpointMetaData sepMetaData, Class wsClass, String linkName) { String configName = null; String configFile = null; EndpointConfig anEndpointConfig = wsClass.getAnnotation(EndpointConfig.class); if (anEndpointConfig != null) { if (anEndpointConfig.configName().length() > 0) configName = anEndpointConfig.configName(); if (anEndpointConfig.configFile().length() > 0) configFile = anEndpointConfig.configFile(); } JSEArchiveMetaData jseMetaData = dep.getAttachment(JSEArchiveMetaData.class); if (jseMetaData != null) { if (jseMetaData.getConfigName() != null) configName = jseMetaData.getConfigName(); if (jseMetaData.getConfigFile() != null) configFile = jseMetaData.getConfigFile(); } EJBArchiveMetaData ejbMetaData = dep.getAttachment(EJBArchiveMetaData.class); if (ejbMetaData != null) { if (ejbMetaData.getConfigName() != null) configName = ejbMetaData.getConfigName(); if (ejbMetaData.getConfigFile() != null) configFile = ejbMetaData.getConfigFile(); } if (configName != null || configFile != null) sepMetaData.setConfigName(configName, configFile); } protected void processWebContext(Deployment dep, Class wsClass, String linkName, ServerEndpointMetaData sepMetaData) { WebContext anWebContext = wsClass.getAnnotation(WebContext.class); if (anWebContext == null) return; boolean isJSEEndpoint = (dep.getType() == DeploymentType.JAXWS_JSE); // context-root if (anWebContext.contextRoot().length() > 0) { if (isJSEEndpoint) { log.warn("@WebContext.contextRoot is only valid on EJB endpoints"); } else { String contextRoot = anWebContext.contextRoot(); if (contextRoot.startsWith("/") == false) contextRoot = "/" + contextRoot; sepMetaData.setContextRoot(contextRoot); } } // url-pattern if (anWebContext.urlPattern().length() > 0) { if (isJSEEndpoint) { log.warn("@WebContext.urlPattern is only valid on EJB endpoints"); } else { String urlPattern = anWebContext.urlPattern(); sepMetaData.setURLPattern(urlPattern); } } // auth-method if (anWebContext.authMethod().length() > 0) { if (isJSEEndpoint) { log.warn("@WebContext.authMethod is only valid on EJB endpoints"); } else { String authMethod = anWebContext.authMethod(); sepMetaData.setAuthMethod(authMethod); } } // transport-guarantee if (anWebContext.transportGuarantee().length() > 0) { if (isJSEEndpoint) { log.warn("@WebContext.transportGuarantee is only valid on EJB endpoints"); } else { String transportGuarantee = anWebContext.transportGuarantee(); sepMetaData.setTransportGuarantee(transportGuarantee); } } // secure wsdl access sepMetaData.setSecureWSDLAccess(anWebContext.secureWSDLAccess()); // virtual hosts String[] virtualHosts = anWebContext.virtualHosts(); if (virtualHosts != null & virtualHosts.length > 0) { sepMetaData.setVirtualHosts(virtualHosts); } } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/jaxws/JAXWS0000644000175000017500000001037010656142514031365 0ustar godgod/* * 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. */ // $Id: JAXWSMetaDataBuilderEJB3.java 4241 2007-08-07 19:17:32Z heiko.braun@jboss.com $ package org.jboss.ws.metadata.builder.jaxws; import java.util.Iterator; import javax.jws.WebService; import javax.xml.ws.WebServiceProvider; import org.jboss.annotation.security.SecurityDomain; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData; import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData; /** * A server side meta data builder that is based on JSR-181 annotations * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 19-May-2005 */ public class JAXWSMetaDataBuilderEJB3 { // provide logging private final Logger log = Logger.getLogger(JAXWSMetaDataBuilderEJB3.class); protected Class annotatedClass; /** Build from webservices.xml */ public UnifiedMetaData buildMetaData(ArchiveDeployment dep) { log.debug("START buildMetaData: [name=" + dep.getCanonicalName() + "]"); try { UnifiedMetaData wsMetaData = new UnifiedMetaData(dep.getRootFile()); wsMetaData.setDeploymentName(dep.getCanonicalName()); ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader(); if(null == runtimeClassLoader) throw new IllegalArgumentException("Runtime loader cannot be null"); wsMetaData.setClassLoader(runtimeClassLoader); // The container objects below provide access to all of the ejb metadata EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class); Iterator it = apMetaData.getEnterpriseBeans(); while (it.hasNext()) { EJBMetaData beanMetaData = it.next(); String ejbClassName = beanMetaData.getEjbClass(); Class beanClass = wsMetaData.getClassLoader().loadClass(ejbClassName); if (beanClass.isAnnotationPresent(WebService.class) || beanClass.isAnnotationPresent(WebServiceProvider.class)) { String ejbLink = beanMetaData.getEjbName(); JAXWSServerMetaDataBuilder.setupProviderOrWebService(dep, wsMetaData, beanClass, ejbLink); // setup the security domain if (beanClass.isAnnotationPresent(SecurityDomain.class)) { SecurityDomain anSecurityDomain = (SecurityDomain)beanClass.getAnnotation(SecurityDomain.class); String lastDomain = wsMetaData.getSecurityDomain(); String securityDomain = anSecurityDomain.value(); if (lastDomain != null && lastDomain.equals(securityDomain) == false) throw new IllegalStateException("Multiple security domains not supported: " + securityDomain); wsMetaData.setSecurityDomain(securityDomain); } } } log.debug("END buildMetaData: " + wsMetaData); return wsMetaData; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot build meta data: " + ex.getMessage(), ex); } } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/MetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/builder/MetaDataBui0000644000175000017500000005071010730236743031460 0ustar godgod/* * 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.metadata.builder; // $Id: $ import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.management.ObjectName; import javax.wsdl.Definition; import javax.wsdl.Import; import javax.wsdl.Port; import javax.wsdl.extensions.http.HTTPAddress; import javax.wsdl.extensions.soap.SOAPAddress; import javax.wsdl.extensions.soap12.SOAP12Address; import javax.xml.namespace.QName; import javax.xml.ws.addressing.AddressingProperties; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.Use; import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl; import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt; import org.jboss.ws.extensions.eventing.EventingConstants; import org.jboss.ws.extensions.eventing.EventingUtils; import org.jboss.ws.extensions.eventing.metadata.EventingEpMetaExt; import org.jboss.ws.metadata.umdm.ClientEndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLProperty; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.wsf.common.ObjectNameFactory; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.deployment.ArchiveDeployment; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.management.ServerConfig; import org.jboss.wsf.spi.management.ServerConfigFactory; import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData; import org.jboss.wsf.spi.metadata.j2ee.EJBMetaData; import org.jboss.wsf.spi.metadata.j2ee.MDBMetaData; import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData; import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData; import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData.JSEResourceCollection; /** An abstract meta data builder. * * @author Thomas.Diesler@jboss.org * @since 19-May-2005 */ public abstract class MetaDataBuilder { // provide logging private final static Logger log = Logger.getLogger(MetaDataBuilder.class); /** Inititialize the endpoint binding */ protected void initEndpointBinding(WSDLEndpoint wsdlEndpoint, ClientEndpointMetaData epMetaData) { WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getWsdlService().getWsdlDefinitions(); WSDLInterface wsdlInterface = wsdlEndpoint.getInterface(); WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getName()); String bindingType = wsdlBinding.getType(); if (Constants.NS_SOAP11.equals(bindingType)) epMetaData.setBindingId(Constants.SOAP11HTTP_BINDING); else if (Constants.NS_SOAP12.equals(bindingType)) epMetaData.setBindingId(Constants.SOAP12HTTP_BINDING); } /** Initialize the endpoint encoding style from the binding operations */ protected void initEndpointEncodingStyle(EndpointMetaData epMetaData) { WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions(); for (WSDLService wsdlService : wsdlDefinitions.getServices()) { for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints()) { if (epMetaData.getPortName().equals(wsdlEndpoint.getName())) { QName bindQName = wsdlEndpoint.getBinding(); WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(bindQName); if (wsdlBinding == null) throw new WSException("Cannot obtain binding: " + bindQName); for (WSDLBindingOperation wsdlBindingOperation : wsdlBinding.getOperations()) { String encStyle = wsdlBindingOperation.getEncodingStyle(); epMetaData.setEncodingStyle(Use.valueOf(encStyle)); } } } } } protected void initEndpointAddress(Deployment dep, ServerEndpointMetaData sepMetaData) { String contextRoot = dep.getService().getContextRoot(); String urlPattern = null; // Get the URL pattern from the endpoint String linkName = sepMetaData.getLinkName(); if (linkName != null) { Endpoint endpoint = dep.getService().getEndpointByName(linkName); if (endpoint != null) urlPattern = endpoint.getURLPattern(); } // If not, derive the context root from the deployment if (contextRoot == null) { String simpleName = dep.getSimpleName(); contextRoot = simpleName.substring(0, simpleName.indexOf('.')); if (dep instanceof ArchiveDeployment) { if (((ArchiveDeployment)dep).getParent() != null) { simpleName = ((ArchiveDeployment)dep).getParent().getSimpleName(); simpleName = simpleName.substring(0, simpleName.indexOf('.')); contextRoot = simpleName + "-" + contextRoot; } } } // Default to "/*" if (urlPattern == null) urlPattern = "/*"; if (contextRoot.startsWith("/") == false) contextRoot = "/" + contextRoot; if (urlPattern.startsWith("/") == false) urlPattern = "/" + urlPattern; sepMetaData.setContextRoot(contextRoot); sepMetaData.setURLPattern(urlPattern); String servicePath = contextRoot + urlPattern; sepMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath)); } public static ObjectName createServiceEndpointID(Deployment dep, ServerEndpointMetaData sepMetaData) { String linkName = sepMetaData.getLinkName(); String context = sepMetaData.getContextRoot(); if (context.startsWith("/")) context = context.substring(1); StringBuilder idstr = new StringBuilder(ServerEndpointMetaData.SEPID_DOMAIN + ":"); idstr.append(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" + context); idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT + "=" + linkName); // Add JMS destination JNDI name for MDB endpoints EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class); if (apMetaData != null) { String ejbName = sepMetaData.getLinkName(); if (ejbName == null) throw new WSException("Cannot obtain ejb-link from port component"); EJBMetaData beanMetaData = (EJBMetaData)apMetaData.getBeanByEjbName(ejbName); if (beanMetaData == null) throw new WSException("Cannot obtain ejb meta data for: " + ejbName); if (beanMetaData instanceof MDBMetaData) { MDBMetaData mdMetaData = (MDBMetaData)beanMetaData; String jndiName = mdMetaData.getDestinationJndiName(); idstr.append(",jms=" + jndiName); } } return ObjectNameFactory.create(idstr.toString()); } /** Get the web service address for a given path */ public static String getServiceEndpointAddress(String uriScheme, String servicePath) { if (servicePath == null || servicePath.length() == 0) throw new WSException("Service path cannot be null"); if (servicePath.endsWith("/*")) servicePath = servicePath.substring(0, servicePath.length() - 2); if (uriScheme == null) uriScheme = "http"; SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); ServerConfig config = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig(); String host = config.getWebServiceHost(); int port = config.getWebServicePort(); if ("https".equals(uriScheme)) port = config.getWebServiceSecurePort(); String urlStr = uriScheme + "://" + host + ":" + port + servicePath; try { return new URL(urlStr).toExternalForm(); } catch (MalformedURLException e) { throw new WSException("Malformed URL: " + urlStr); } } /** * Read the transport guarantee from web.xml */ protected void initTransportGuaranteeJSE(Deployment dep, ServerEndpointMetaData sepMetaData, String servletLink) throws IOException { String transportGuarantee = null; JSEArchiveMetaData webMetaData = dep.getAttachment(JSEArchiveMetaData.class); if (webMetaData != null) { Map servletMappings = webMetaData.getServletMappings(); String urlPattern = servletMappings.get(servletLink); if (urlPattern == null) throw new WSException("Cannot find for servlet-name: " + servletLink); List securityList = webMetaData.getSecurityMetaData(); for (JSESecurityMetaData currentSecurity : securityList) { if (currentSecurity.getTransportGuarantee() != null && currentSecurity.getTransportGuarantee().length() > 0) { for (JSEResourceCollection currentCollection : currentSecurity.getWebResources()) { for (String currentUrlPattern : currentCollection.getUrlPatterns()) { if (urlPattern.equals(currentUrlPattern)) { transportGuarantee = currentSecurity.getTransportGuarantee(); } } } } } } sepMetaData.setTransportGuarantee(transportGuarantee); } /** Replace the address locations for a given port component. */ public static void replaceAddressLocation(ServerEndpointMetaData sepMetaData) { WSDLDefinitions wsdlDefinitions = sepMetaData.getServiceMetaData().getWsdlDefinitions(); QName portName = sepMetaData.getPortName(); boolean endpointFound = false; for (WSDLService wsdlService : wsdlDefinitions.getServices()) { for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints()) { QName wsdlPortName = wsdlEndpoint.getName(); if (wsdlPortName.equals(portName)) { endpointFound = true; String orgAddress = wsdlEndpoint.getAddress(); String uriScheme = getUriScheme(orgAddress); String transportGuarantee = sepMetaData.getTransportGuarantee(); if ("CONFIDENTIAL".equals(transportGuarantee)) uriScheme = "https"; String servicePath = sepMetaData.getContextRoot() + sepMetaData.getURLPattern(); String serviceEndpointURL = getServiceEndpointAddress(uriScheme, servicePath); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); ServerConfig config = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig(); boolean alwaysModify = config.isModifySOAPAddress(); if (alwaysModify || uriScheme == null || orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0) { log.debug("Replace service endpoint address '" + orgAddress + "' with '" + serviceEndpointURL + "'"); wsdlEndpoint.setAddress(serviceEndpointURL); sepMetaData.setEndpointAddress(serviceEndpointURL); // modify the wsdl-1.1 definition if (wsdlDefinitions.getWsdlOneOneDefinition() != null) replaceWSDL11PortAddress(wsdlDefinitions, portName, serviceEndpointURL); } else { log.debug("Don't replace service endpoint address '" + orgAddress + "'"); try { sepMetaData.setEndpointAddress(new URL(orgAddress).toExternalForm()); } catch (MalformedURLException e) { throw new WSException("Malformed URL: " + orgAddress); } } } } } if (endpointFound == false) throw new WSException("Cannot find port in wsdl: " + portName); } private static void replaceWSDL11PortAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL) { Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition(); String tnsURI = wsdlOneOneDefinition.getTargetNamespace(); // search for matching portElement and replace the address URI Port wsdlOneOnePort = modifyPortAddress(tnsURI, portQName, serviceEndpointURL, wsdlOneOneDefinition.getServices()); // recursivly process imports if none can be found if (wsdlOneOnePort == null && !wsdlOneOneDefinition.getImports().isEmpty()) { Iterator imports = wsdlOneOneDefinition.getImports().values().iterator(); while (imports.hasNext()) { List l = (List)imports.next(); Iterator importsByNS = l.iterator(); while (importsByNS.hasNext()) { Import anImport = (Import)importsByNS.next(); wsdlOneOnePort = modifyPortAddress(anImport.getNamespaceURI(), portQName, serviceEndpointURL, anImport.getDefinition().getServices()); } } } // if it still doesn't exist something is wrong if (wsdlOneOnePort == null) throw new IllegalArgumentException("Cannot find port with name '" + portQName + "' in wsdl document"); } private static Port modifyPortAddress(String tnsURI, QName portQName, String serviceEndpointURL, Map services) { Port wsdlOneOnePort = null; Iterator itServices = services.values().iterator(); while (itServices.hasNext()) { javax.wsdl.Service wsdlOneOneService = (javax.wsdl.Service)itServices.next(); Map wsdlOneOnePorts = wsdlOneOneService.getPorts(); Iterator itPorts = wsdlOneOnePorts.keySet().iterator(); while (itPorts.hasNext()) { String portLocalName = (String)itPorts.next(); if (portQName.equals(new QName(tnsURI, portLocalName))) { wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName); List extElements = wsdlOneOnePort.getExtensibilityElements(); for (Object extElement : extElements) { if (extElement instanceof SOAPAddress) { SOAPAddress address = (SOAPAddress)extElement; address.setLocationURI(serviceEndpointURL); } else if (extElement instanceof SOAP12Address) { SOAP12Address address = (SOAP12Address)extElement; address.setLocationURI(serviceEndpointURL); } else if (extElement instanceof HTTPAddress) { HTTPAddress address = (HTTPAddress)extElement; address.setLocationURI(serviceEndpointURL); } } } } } return wsdlOneOnePort; } private static String getUriScheme(String addrStr) { try { URI addrURI = new URI(addrStr); String scheme = addrURI.getScheme(); return scheme; } catch (URISyntaxException e) { return null; } } protected void processEndpointMetaDataExtensions(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions) { for (WSDLInterface wsdlInterface : wsdlDefinitions.getInterfaces()) { WSDLProperty eventSourceProp = wsdlInterface.getProperty(Constants.WSDL_PROPERTY_EVENTSOURCE); if (eventSourceProp != null && epMetaData instanceof ServerEndpointMetaData) { ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData; String eventSourceNS = wsdlInterface.getName().getNamespaceURI() + "/" + wsdlInterface.getName().getLocalPart(); // extract the schema model JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes()); String[] notificationSchema = EventingUtils.extractNotificationSchema(schemaModel); // extract the root element NS String notificationRootElementNS = null; WSDLInterfaceOperation wsdlInterfaceOperation = wsdlInterface.getOperations()[0]; if (wsdlInterfaceOperation.getOutputs().length > 0) { WSDLInterfaceOperationOutput wsdlInterfaceOperationOutput = wsdlInterfaceOperation.getOutputs()[0]; notificationRootElementNS = wsdlInterfaceOperationOutput.getElement().getNamespaceURI(); } else { // WSDL operation of an WSDL interface that is marked as an event source // requires to carry an output message. throw new WSException("Unable to resolve eventing root element NS. No operation output found at " + wsdlInterfaceOperation.getName()); } EventingEpMetaExt ext = new EventingEpMetaExt(EventingConstants.NS_EVENTING); ext.setEventSourceNS(eventSourceNS); ext.setNotificationSchema(notificationSchema); ext.setNotificationRootElementNS(notificationRootElementNS); sepMetaData.addExtension(ext); } } } /** Process operation meta data extensions. */ protected void processOpMetaExtensions(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation) { String tns = wsdlOperation.getName().getNamespaceURI(); String portTypeName = wsdlOperation.getName().getLocalPart(); AddressingProperties ADDR = new AddressingPropertiesImpl(); AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI()); // inbound action WSDLProperty wsaInAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_IN); if (wsaInAction != null) { addrExt.setInboundAction(wsaInAction.getValue()); } else { WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN); if (messageName != null) { addrExt.setInboundAction(tns + "/" + portTypeName + "/" + messageName.getValue()); } else { addrExt.setInboundAction(tns + "/" + portTypeName + "/IN"); } } // outbound action WSDLProperty wsaOutAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_OUT); if (wsaOutAction != null) { addrExt.setOutboundAction(wsaOutAction.getValue()); } else { WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT); if (messageName != null) { addrExt.setOutboundAction(tns + "/" + portTypeName + "/" + messageName.getValue()); } else { addrExt.setOutboundAction(tns + "/" + portTypeName + "/OUT"); } } opMetaData.addExtension(addrExt); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/0000755000175000017500000000000010755000262026725 5ustar godgod././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutput.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceO0000644000175000017500000000313310542776150031373 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLInterfaceOperationOutput.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A Message Reference component associates a defined type with a message exchanged in an operation. By * default, the type system is based upon the XML Infoset * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLInterfaceOperationOutput extends WSDLInterfaceMessageReference { private static final long serialVersionUID = 5096501821825901473L; public WSDLInterfaceOperationOutput(WSDLInterfaceOperation wsdlOperation) { super(wsdlOperation); } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLExtensibilityElement.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLExtensibil0000644000175000017500000000416210625052352031456 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; import org.w3c.dom.Element; /** * Common metadata for (unknown) wsdl extensibility elements * * @author Alessio Soldano, * @since 24-Apr-2007 * */ public class WSDLExtensibilityElement implements Serializable { private static final long serialVersionUID = -7528676719881753461L; /** A REQUIRED uri attribute information item */ private String uri; /** An OPTIONAL required attribute information item */ private boolean required; private Element element; public WSDLExtensibilityElement(String uri, Element element) { this.element = element; this.uri = uri; } public Element getElement() { return element; } public void setElement(Element element) { this.element = element; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xsd/0000755000175000017500000000000010755000262027523 5ustar godgod././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xsd/SchemaUtils.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xsd/SchemaUtil0000644000175000017500000004462010652310447031517 0ustar godgod/* * 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.metadata.wsdl.xsd; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl; import org.apache.xerces.impl.xs.XMLSchemaLoader; import org.apache.xerces.util.XMLGrammarPoolImpl; import org.apache.xerces.xni.parser.XMLEntityResolver; import org.apache.xerces.xni.parser.XMLErrorHandler; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSLoader; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSComplexTypeDefinition; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSElementDeclaration; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSErrorHandler; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSSimpleTypeDefinition; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSStringList; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSTypeDefinition; import org.jboss.wsf.spi.management.ServerConfig; import org.jboss.wsf.spi.management.ServerConfigFactory; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; /** * Util class that deals with XML Schema * @author Anil Saldhana * @since Apr 12, 2005 */ public class SchemaUtils { private static SchemaUtils ourInstance = new SchemaUtils(); protected static String xsNS = Constants.NS_SCHEMA_XSD; private static Map toolsTypeMappingOverride = new HashMap(); static { toolsTypeMappingOverride.put(byte[].class, Constants.TYPE_LITERAL_BASE64BINARY); } public static SchemaUtils getInstance() { return ourInstance; } private SchemaUtils() { } /** * Checks if the XS Particle is of array type * @param xsparticle * @return */ public boolean isArrayType(XSParticle xsparticle) { //Determine if it is an arrayType int maxOccurs = xsparticle.getMaxOccurs(); return xsparticle.getMaxOccursUnbounded() || maxOccurs > 1; } public static boolean isWrapperArrayType(XSTypeDefinition xst) { return unwrapArrayType(xst) != null; } public static XSElementDeclaration unwrapArrayType(XSTypeDefinition xst) { if (xst instanceof XSComplexTypeDefinition == false) return null; XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xst; if (xc.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_EMPTY) return null; XSParticle xsp = xc.getParticle(); if (xsp == null) return null; XSTerm xsterm = xsp.getTerm(); if (xsterm instanceof XSModelGroup == false) return null; XSModelGroup xm = (XSModelGroup)xsterm; XSObjectList xo = xm.getParticles(); if (xo.getLength() != 1) return null; XSParticle xp = (XSParticle)xo.item(0); XSTerm term = xp.getTerm(); if ((xp.getMaxOccursUnbounded() || xp.getMaxOccurs() > 1) == false || term instanceof XSElementDeclaration == false) return null; return (XSElementDeclaration)term; } /** * Generate a QName for a simple type * @param simple * @return */ public static QName handleSimpleType(XSSimpleTypeDefinition simple) { if (simple == null) throw new IllegalArgumentException("XSSimpleTypeDefinition passed is null"); //Check if the type of SimpleType is a plain xsd type if (Constants.NS_SCHEMA_XSD.equals(simple.getNamespace())) return createQNameFromXSSimpleType(simple); switch (simple.getVariety()) { case XSSimpleTypeDefinition.VARIETY_LIST: return handleSimpleType(simple.getItemType()); case XSSimpleTypeDefinition.VARIETY_UNION: XSObjectList list = simple.getMemberTypes(); if (list.getLength() > 0) return handleSimpleType((XSSimpleTypeDefinition)list.item(0)); throw new WSException("Empty union type not expected"); case XSSimpleTypeDefinition.VARIETY_ABSENT: throw new WSException("Absent variety is not supported in simple types"); } XSTypeDefinition base = simple.getBaseType(); while (!Constants.NS_SCHEMA_XSD.equals(base.getNamespace())) base = base.getBaseType(); if (!(base instanceof XSSimpleTypeDefinition)) throw new WSException("Expected base type to be a simple type"); return new QName(base.getNamespace(), base.getName()); } /** * For the basic xsd types, patch prefix and ns uri * @param qname * @return */ public QName patchXSDQName(QName qname) { if (qname == null) return null; return new QName(Constants.NS_SCHEMA_XSD, qname.getLocalPart(), Constants.PREFIX_XSD); } /** * Given a XSTypeDefinition and the QName for the element, * create a XSElementDeclaration object * @param xmlName Name of the element * @param xst Type of the element * @return XSElementDeclaration */ public XSElementDeclaration createXSElementDeclaration(QName xmlName, XSTypeDefinition xst) { String name = xmlName.getLocalPart(); String ns = xmlName.getNamespaceURI(); JBossXSElementDeclaration jbel = new JBossXSElementDeclaration(name, ns); jbel.setTypeDefinition(xst); jbel.setScope(XSConstants.SCOPE_GLOBAL); return jbel; } /** * Create a QName given a Simple Type * @param xs * @return qname */ public static QName createQNameFromXSSimpleType(XSSimpleTypeDefinition xs) { String nsuri = xs.getNamespace(); String localpart = xs.getName(); if (xsNS.equals(nsuri)) return new QName(nsuri, localpart, Constants.PREFIX_XSD); else return new QName(nsuri, localpart); } /** * Return typemapping override for tools if any * * @param javaType * @return */ public QName getToolsOverrideInTypeMapping(Class javaType) { return toolsTypeMappingOverride.get(javaType); } /** * Check if a global element exists * @param xmlName QName of the element that needs to be checked * @param xsmodel Schema model that is passed * @return */ public boolean hasGlobalElement(QName xmlName, XSModel xsmodel) { if (xmlName == null) throw new IllegalArgumentException("xmlName is null"); if (xsmodel == null) throw new IllegalArgumentException("XSModel is null"); boolean bool = false; String name = xmlName.getLocalPart(); if (name == null) throw new IllegalArgumentException("xmlName has a null name"); String ns = xmlName.getNamespaceURI(); if (ns == null) throw new IllegalArgumentException("xmlName has a null namespace"); if (xsmodel.getElementDeclaration(name, ns) != null) bool = true; return bool; } /** * Check if a Complex Type exists * @param xmlType QName of the Complex Type that needs to be checked * @param xsmodel Schema model that is passed * @return */ public boolean hasComplexTypeDefinition(QName xmlType, URL xsdLocation) { if (xsdLocation == null) throw new IllegalArgumentException("xsdLocation is null"); XSModel xsmodel = parseSchema(xsdLocation); return this.hasComplexTypeDefinition(xmlType, xsmodel); } /** * Check if a Global Element exists * @param xmlType QName of the global element that needs to be checked * @param xsmodel Schema model that is passed * @return */ public boolean hasGlobalElement(QName xmlName, URL xsdLocation) { if (xmlName == null) throw new IllegalArgumentException("xmlName is null"); if (xsdLocation == null) throw new IllegalArgumentException("xsdLocation is null"); XSModel xsmodel = parseSchema(xsdLocation); boolean bool = false; String name = xmlName.getLocalPart(); if (name == null) throw new IllegalArgumentException("xmlName has a null name"); String ns = xmlName.getNamespaceURI(); if (ns == null) throw new IllegalArgumentException("xmlName has a null namespace"); if (xsmodel.getElementDeclaration(name, ns) != null) bool = true; return bool; } /** * Check if a Complex Type exists * @param xmlType QName of the Complex Type that needs to be checked * @param xsmodel Schema model that is passed * @return */ public boolean hasComplexTypeDefinition(QName xmlType, XSModel xsmodel) { if (xmlType == null) throw new IllegalArgumentException("xmlType is null"); if (xsmodel == null) throw new IllegalArgumentException("XSModel is null"); boolean bool = false; String name = xmlType.getLocalPart(); if (name == null) throw new IllegalArgumentException("xmlName has a null name"); String ns = xmlType.getNamespaceURI(); if (ns == null) throw new IllegalArgumentException("xmlName has a null namespace"); if (xsmodel.getTypeDefinition(name, ns) != null) bool = true; return bool; } /** * Get formatted string for the qname representing the xstype * @param xstype * @return */ public String getFormattedString(XSTypeDefinition xstype) { String ns = xstype.getNamespace(); String name = xstype.getName(); if (!ns.equals(xsNS)) name = getPrefix(ns) + ":" + name; return name; } /** * Get a QName for a xs type * @param xstype * @return */ public QName getQName(XSTypeDefinition xstype) { String prefix = null; String ns = xstype.getNamespace(); String name = xstype.getName(); if (!ns.equals(xsNS)) prefix = Constants.PREFIX_TNS; else prefix = Constants.PREFIX_XSD; return new QName(ns, name, prefix); } /** * Get a schema basic type * TODO: Migrate this off of the Xerces Impl * @param localpart * @return */ public JBossXSTypeDefinition getSchemaBasicType(String localpart) { JBossXSTypeDefinition xt = null; /** * Special case: xs:anyType */ if ("anyType".equals(localpart)) { JBossXSComplexTypeDefinition ct = new JBossXSComplexTypeDefinition(localpart, Constants.NS_SCHEMA_XSD); ct.setContentType(XSComplexTypeDefinition.CONTENTTYPE_EMPTY); xt = ct; } else { XSSimpleTypeDefinition xstype = (new SchemaDVFactoryImpl()).getBuiltInType(localpart); xt = new JBossXSSimpleTypeDefinition(xstype); } return xt; } /** * Get an instance of XSLoader that is capable of * parsing schema files * * @return */ public XSLoader getXSLoader() { XMLSchemaLoader xsloader = new XMLSchemaLoader(); JBossXSErrorHandler eh = new JBossXSErrorHandler(); xsloader.setErrorHandler(eh); xsloader.setProperty("http://apache.org/xml/properties/internal/grammar-pool", new XMLGrammarPoolImpl()); return xsloader; } /** * Get an instance of XSLoader that is capable of * parsing schema files * @param xeh XML Error handler * @param xer XML Entity Resolver * @return */ public XSLoader getXSLoader(XMLErrorHandler xeh, XMLEntityResolver xer) { XMLSchemaLoader xsloader = new XMLSchemaLoader(); xsloader.setEntityResolver(xer); xsloader.setErrorHandler(xeh); xsloader.setProperty("http://apache.org/xml/properties/internal/grammar-pool", new XMLGrammarPoolImpl()); return xsloader; } /** * Given a schema file, generate a schema model * @param schemaLoc java.net.URL object to the schema file * @return schema model */ public XSModel parseSchema(URL schemaLoc) { return parseSchema(schemaLoc.toExternalForm()); } /** * Given a schema file, generate a schema model * @param schemaLoc string representation to the location of schema * @return schema model */ public XSModel parseSchema(String schemaLoc) { XSLoader xsloader = getXSLoader(); XSModel xsModel = xsloader.loadURI(schemaLoc); if (xsModel == null) throw new WSException("Cannot parse schema: " + schemaLoc); return xsModel; } /** * Given a list of schema locations, parse and * provide a Xerces XSModel * * @param locations * @return */ public XSModel parseSchema(List locations) { JBossXSStringList slist = new JBossXSStringList(locations); XSLoader xsloader = getXSLoader(); return xsloader.loadURIList(slist); } /** * Checks if the XSModel is empty * @param xsmodel * @return true (if empty) and false (if not empty) */ public boolean isEmptySchema(XSModel xsmodel) { if (xsmodel == null) return true; String targetNS = getTargetNamespace(xsmodel); if (targetNS == null) throw new WSException("Target Namespace of xsmodel is null"); XSNamedMap tmap = xsmodel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION, targetNS); XSNamedMap emap = xsmodel.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION, targetNS); if (tmap != null && tmap.getLength() > 0) return false; if (emap != null && emap.getLength() > 0) return false; return true; } /** * Checks if the XSModel is empty given a namespace * @param xsmodel Schema Model to check * @param namespace namespace to check components for * @return true (if empty) and false (if not empty) */ public boolean isEmptySchema(XSModel xsmodel, String namespace) { if (xsmodel == null) return true; if (namespace == null) throw new WSException("Target Namespace of xsmodel is null"); XSNamedMap tmap = xsmodel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION, namespace); XSNamedMap emap = xsmodel.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION, namespace); if (tmap != null && tmap.getLength() > 0) return false; if (emap != null && emap.getLength() > 0) return false; return true; } /** * Get the schema definitions as a String * @param targetNS The Target Namespace * @return */ public static String getSchemaDefinitions(String targetNS) { StringBuilder buffer = new StringBuilder(); buffer.append(" targetNamespace='" + targetNS + "'"); buffer.append(" xmlns='" + Constants.NS_SCHEMA_XSD + "'"); buffer.append(" xmlns:" + Constants.PREFIX_SOAP11_ENC + "='" + Constants.URI_SOAP11_ENC + "'"); buffer.append(" xmlns:" + Constants.PREFIX_TNS + "='" + targetNS + "'"); //buffer.append(" xmlns:" + WSDLConstants.PREFIX_XSD + "='" + WSDLConstants.NS_SCHEMA_XSD + "'"); buffer.append(" xmlns:" + Constants.PREFIX_XSI + "='" + Constants.NS_SCHEMA_XSI + "'"); buffer.append(">"); return buffer.toString(); } /** Get the temp file for a given namespace */ public static File getSchemaTempFile(String targetNS) throws IOException { if (targetNS.length() == 0) throw new IllegalArgumentException("Invalid null target namespace"); String fname = targetNS; if (fname.indexOf("://") > 0) fname = fname.substring(fname.indexOf("://") + 3); File tmpdir = null; try { SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); ServerConfig serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();File tmpDir = serverConfig.getServerTempDir(); tmpdir = serverConfig.getServerTempDir(); tmpdir = new File(tmpdir.getCanonicalPath() + "/jbossws"); tmpdir.mkdirs(); } catch (Throwable th) { // ignore if the server config cannot be found // this would be the case if we are on the client side } fname = fname.replace('/', '_'); fname = fname.replace(':', '_'); File file = File.createTempFile("JBossWS_" + fname, ".xsd", tmpdir); return file; } /** * Get the TargetNamespace from the schema model */ public static String getTargetNamespace(XSModel xsmodel) { if (xsmodel == null) throw new IllegalArgumentException("Illegal Null Argument: xsmodel"); String targetNS = null; StringList slist = xsmodel.getNamespaces(); int len = slist != null ? slist.getLength() : 0; for (int i = 0; i < len; i++) { String ns = slist.item(i); if (Constants.NS_SCHEMA_XSD.equals(ns)) continue; targetNS = ns; break; } return targetNS; } private String getPrefix(String namespace) { if (Constants.URI_SOAP11_ENC.equals(namespace)) return Constants.PREFIX_SOAP11_ENC; else if (Constants.NS_SOAP11_ENV.equals(namespace) || Constants.NS_SOAP12_ENV.equals(namespace)) return Constants.PREFIX_ENV; // Fall back to target namespace even though this is incorrect return Constants.PREFIX_TNS; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xsd/XSDWriter.0000644000175000017500000000725110542776150031376 0ustar godgod/* * 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.metadata.wsdl.xsd; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStream; import java.io.StringWriter; import java.io.Writer; import java.net.URL; import org.apache.xerces.xs.XSModel; import org.jboss.logging.Logger; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils; /** * XML Schema File Writer * @author Anil Saldhana */ public class XSDWriter { // provide logging protected static final Logger log = Logger.getLogger(XSDWriter.class); protected WSDLDefinitions wsdl = null; protected SchemaUtils schemautils = SchemaUtils.getInstance(); protected WSSchemaUtils sutils = WSSchemaUtils.getInstance(null, null); public void writeXSD(Writer writer, XSModel xsmodel, WSDLDefinitions wsdl) { if (xsmodel == null) throw new IllegalArgumentException("xsmodel is NULL"); this.wsdl = wsdl; if (schemautils.isEmptySchema(xsmodel)) return; } /** * Serialize the schema into a temp file * @param xsmodel Schema model * @param ns Target Namespace * @return URL of the temp file where the schema exists * @throws IOException */ public URL serialize( XSModel xsmodel, String ns) throws IOException { if(ns == null) throw new IllegalArgumentException("Illegal Null Argument:ns"); String xsdString = ""; if(xsmodel instanceof JBossXSModel) { JBossXSModel jbxs = (JBossXSModel)xsmodel; xsdString = jbxs.serialize(); } else { // Serialize XSD model StringWriter strwr = new StringWriter(); sutils.serialize(xsmodel, strwr); xsdString = strwr.toString(); } log.trace("serialize:\n" + xsdString); // Write updated xsd file File xsdFile = SchemaUtils.getSchemaTempFile(ns); FileWriter writer = new FileWriter(xsdFile); writer.write(xsdString); writer.close(); return xsdFile.toURL(); } /** * Serialize the schema into a output stream * @param xsmodel Schema model * @param ns Target Namespace * @param os OutputStream to write into * @throws IOException */ public void serialize( XSModel xsmodel, String ns, OutputStream os) throws IOException { // Serialize XSD model StringWriter strwr = new StringWriter(); sutils.serialize(xsmodel, strwr); String xsdString = strwr.toString(); log.trace("serialize:" + xsdString); os.write(xsdString.getBytes()); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationOutfault.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceO0000644000175000017500000000545210573471351031400 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLInterfaceOperationOutfault.java 2539 2007-03-07 08:08:09Z jason.greene@jboss.com $ import javax.xml.namespace.QName; /** * A Fault Reference component associates a defined type, specified by an Interface Fault component, to a * fault message exchanged in an operation. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLInterfaceOperationOutfault extends Extendable { private static final long serialVersionUID = 1365062002410904728L; // The parent interface operation private WSDLInterfaceOperation wsdlInterfaceOperation; /** A REQUIRED reference to an Interface Fault component in the {faults} property of the parent * Interface Operation component's parent Interface component. Identifying the Interface Fault * component therefore indirectly defines the actual content or payload of the fault message. */ private QName ref; /** An OPTIONAL identifier of the message this fault relates to among those defined in the {message exchange * pattern} property of the Interface Operation component it is contained within. The value of this * property MUST match the name of a placeholder message defined by the message exchange pattern. */ private String messageLabel; public WSDLInterfaceOperationOutfault(WSDLInterfaceOperation wsdlInterfaceOperation) { this.wsdlInterfaceOperation = wsdlInterfaceOperation; } public WSDLInterfaceOperation getWsdlInterfaceOperation() { return wsdlInterfaceOperation; } public QName getRef() { return ref; } public void setRef(QName ref) { this.ref = ref; } public String getMessageLabel() { return messageLabel; } public void setMessageLabel(String messageLabel) { this.messageLabel = messageLabel; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLDocumentation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLDocumentat0000644000175000017500000000303210542776150031455 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; /** * Represents a WSDL Document element that can be embedded in other WSDL elements * such as Fault * @author Anil Saldhana */ public class WSDLDocumentation implements Serializable { private static final long serialVersionUID = -5931204963635014975L; protected String documentContent = ""; public WSDLDocumentation(String str) { this.documentContent = str; } public String getContent() { return this.documentContent; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/XSModelTypes.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/XSModelTypes.j0000755000175000017500000000673610542776150031471 0ustar godgod/* * 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.metadata.wsdl; import javax.xml.namespace.QName; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; /** * A JBossXSModel based type definition. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class XSModelTypes extends WSDLTypes { private static final Logger log = Logger.getLogger(XSModelTypes.class); private JBossXSModel schemaModel; public XSModelTypes() { this.schemaModel = new JBossXSModel(); } /** * Add a schema model for a given namespaceURI * @param nsURI the namespaceURI under which the model has been generated * @param schema the Schema Model that needs to be added to existing schema * model in WSDLTypes *
      Warning: *

      Passing a null nsURI will replace the internal schema model * held by WSDLTypes by the model passed as an argument.

      */ public void addSchemaModel(String nsURI, JBossXSModel schema) { if(nsURI == null) { log.trace("nsURI passed to addSchemaModel is null. Replacing Schema Model"); schemaModel = schema; } else schemaModel.merge(schema); } /** * Return the global Schema Model * @return */ public JBossXSModel getSchemaModel() { return schemaModel; } /** Get the xmlType from a given element xmlName */ public QName getXMLType(QName xmlName) { QName xmlType = null; String nsURI = xmlName.getNamespaceURI(); String localPart = xmlName.getLocalPart(); XSElementDeclaration xsel = schemaModel.getElementDeclaration(localPart, nsURI); if (xsel != null) { XSTypeDefinition xstype = xsel.getTypeDefinition(); if (xstype == null) throw new WSException("Cannot obtain XSTypeDefinition for: " + xmlName); if (xstype.getAnonymous() == false) { xmlType = new QName(xstype.getNamespace(), xstype.getName()); } else { xmlType = new QName(xstype.getNamespace(), ">" + localPart); } } return xmlType; } public String toString() { StringBuilder buffer = new StringBuilder("WSDLTypes:\n"); buffer.append(schemaModel != null ? schemaModel.serialize() : ""); return buffer.toString(); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLMIMEPart.j0000755000175000017500000000432210542776150031166 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; import javax.xml.namespace.QName; /** * Represents a WSDL 1.1 MIME Multipart attachment. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class WSDLMIMEPart implements Serializable { private static final long serialVersionUID = -3102495235178249853L; private final String partName; private final QName xmlType; private final String mimeTypes; public WSDLMIMEPart(String partName, QName xmlType, String mimeTypes) { this.mimeTypes = mimeTypes; this.partName = partName; this.xmlType = xmlType; } /** * Returns the xml type of this attachment. Typically xsd:hexBinary * * @return the name of the header schema element */ public QName getXmlType() { return xmlType; } /** * Returns the name of the WSDL 1.1 part, if the output is WSDL 1.1 * * @return the name of the part */ public String getPartName() { return partName; } /** * Returns a comma seperated list of allowed mime types. * * @return the mime types */ public String getMimeTypes() { return mimeTypes; } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/DOMTypes.java0000755000175000017500000000362210542776150031254 0ustar godgod/* * 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.metadata.wsdl; import javax.xml.namespace.QName; import org.jboss.util.NotImplementedException; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * A DOM Element based schema representation. Care should be taken to ensure * thread safety. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class DOMTypes extends WSDLTypes { /* * Perhaps we should consider moving this to JDOM, or some other DOM * framework that supports concurrent readers. For now callers must * synchronize properly. * * Also could use a cached StAX pool. */ private Element element; public DOMTypes(Document doc) { this.element = doc.createElementNS(null, "types"); } public Element getElement() { return element; } public QName getXMLType(QName name) { throw new NotImplementedException(); } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceFault.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceF0000644000175000017500000000640410573471351031365 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLInterfaceFault.java 2539 2007-03-07 08:08:09Z jason.greene@jboss.com $ import java.io.Serializable; import javax.xml.namespace.QName; /** * An Interface Fault component describes a fault that MAY occur during invocation of an operation of the * interface. The Interface Fault component declares an abstract fault by naming it and indicating the * contents of the fault message. When and how the fault message flows is indicated by the Interface * Operation component 2.4 Interface Operation [p.22] . * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLInterfaceFault implements Serializable { private static final long serialVersionUID = 7820459380133521551L; // The parent interface. private WSDLInterface wsdlInterface; /** The REQUIRED name attribute information item identifies a given fault element information item inside a given * interface element information item. */ private QName name; /** The OPTIONAL element attribute information item refers, by QName, to a schema element declaration component. */ private QName element; protected WSDLDocumentation documentationElement = null; public WSDLInterfaceFault(WSDLInterface wsdlInterface, QName name) { this.wsdlInterface = wsdlInterface; this.name = name; } public WSDLInterfaceFault(WSDLInterface wsdlInterface, String localName) { this.wsdlInterface = wsdlInterface; name = new QName(wsdlInterface.getName().getNamespaceURI(), localName); } public WSDLInterface getWsdlInterface() { return wsdlInterface; } public QName getName() { return name; } public QName getElement() { return element; } public void setElement(QName element) { this.element = element; } public WSDLDocumentation getDocumentation() { return this.documentationElement; } public void setDocumentation(WSDLDocumentation doc) { this.documentationElement = doc; } /** Get the xmlType for this interface fault. */ public QName getXmlType() { WSDLDefinitions wsdlDefinitions = wsdlInterface.getWsdlDefinitions(); WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes(); return wsdlTypes.getXMLType(element); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLEndpoint.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLEndpoint.j0000644000175000017500000000726510573471351031375 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLEndpoint.java 2539 2007-03-07 08:08:09Z jason.greene@jboss.com $ import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; /** * An Endpoint component defines the particulars of a specific endpoint at which a given service is available. * Endpoint components are local to a given Service component; they cannot be referred to by QName. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 10-Oct-2004 */ public class WSDLEndpoint extends Extendable { private static final long serialVersionUID = 4991302339046047865L; // provide logging private static final Logger log = Logger.getLogger(WSDLEndpoint.class); // The parent service private final WSDLService wsdlService; private final QName name; /** The REQUIRED binding attribute information item refers, by QName, to a Binding component */ private QName binding; /** The OPTIONAL address attribute information item specifies the address of the endpoint. */ private String address; public WSDLEndpoint(WSDLService wsdlService, QName name) { this.wsdlService = wsdlService; this.name = name; } public WSDLService getWsdlService() { return wsdlService; } /** Get the WSDLInteraface associated to this endpoint * * @return A WSDLInterface or null */ public WSDLInterface getInterface() { WSDLInterface wsdlInterface = null; WSDLDefinitions wsdlDefinitions = wsdlService.getWsdlDefinitions(); if (wsdlService.getInterfaceName() != null) { QName qname = wsdlService.getInterfaceName(); wsdlInterface = wsdlDefinitions.getInterface(qname); } else { WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(binding); if (wsdlBinding == null) throw new WSException("Cannot obtain the binding: " + binding); if (wsdlBinding.getInterfaceName() != null) { QName qname = wsdlBinding.getInterfaceName(); wsdlInterface = wsdlDefinitions.getInterface(qname); } } if (wsdlInterface == null) throw new WSException("Cannot obtain the interface associated with this endpoint: " + name); return wsdlInterface; } public QName getName() { return name; } public QName getBinding() { return binding; } public void setBinding(QName binding) { log.trace("setBinding: " + binding); this.binding = binding; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/Extendable.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/Extendable.jav0000644000175000017500000000722210625052352031510 0ustar godgod/* * 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.metadata.wsdl; // $Id: Extendable.java 3217 2007-05-23 14:51:22Z palin $ import java.io.Serializable; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.jboss.logging.Logger; /** * An abstract base class of a WSDL extendable element. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public abstract class Extendable implements Serializable { // provide logging private Logger log = Logger.getLogger(getClass()); private Map features = new LinkedHashMap(); private Map properties = new LinkedHashMap(); private Map> extElements = new LinkedHashMap>(); public WSDLFeature[] getFeatures() { WSDLFeature[] arr = new WSDLFeature[features.size()]; new ArrayList(features.values()).toArray(arr); return arr; } public void addFeature(WSDLFeature feature) { log.trace("addFeature: " + feature); String uri = feature.getURI(); features.put(uri, feature); } public WSDLFeature getFeature(String uri) { WSDLFeature feature = (WSDLFeature)features.get(uri); return feature; } public WSDLProperty[] getProperties() { WSDLProperty[] arr = new WSDLProperty[properties.size()]; new ArrayList(properties.values()).toArray(arr); return arr; } public void addProperty(WSDLProperty property) { log.trace("addProperty: " + property); String uri = property.getURI(); properties.put(uri, property); } public WSDLProperty getProperty(String uri) { WSDLProperty property = (WSDLProperty)properties.get(uri); return property; } public void addExtensibilityElement(WSDLExtensibilityElement extElement) { log.trace("addExtensibilityElement: " + extElement); String uri = extElement.getUri(); List list = extElements.get(uri); if (list == null) { list = new LinkedList(); extElements.put(uri,list); } list.add(extElement); } public List getExtensibilityElements(String uri) { List list = extElements.get(uri); return list == null ? new ArrayList() : list; } public List getAllExtensibilityElements() { List list = new LinkedList(); for (String k : extElements.keySet()) { list.addAll(extElements.get(k)); } return list; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLFeature.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLFeature.ja0000644000175000017500000000521710542776150031345 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; // $Id: WSDLFeature.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A feature component describes an abstract piece of functionality typically associated with the exchange of * messages between communicating parties. Although WSDL poses no constraints on the potential scope of * such features, examples might include "reliability", "security", "correlation", and "routing". The presence * of a feature component in a WSDL description indicates that the service supports the feature and may * require a requester agent that interacts with the service to use that feature. Each Feature is identified by its * URI. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLFeature implements Serializable { private static final long serialVersionUID = 8096857958254222743L; /** A REQUIRED uri attribute information item */ private String uri; /** An OPTIONAL required attribute information item */ private boolean required; public WSDLFeature(String uri) { if (uri == null) throw new IllegalArgumentException("Illegal feature URI: " + uri); this.uri = uri; } public WSDLFeature(String uri, boolean required) { if (uri == null) throw new IllegalArgumentException("Illegal feature URI: " + uri); this.uri = uri; this.required = required; } public String getURI() { return uri; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public String toString() { return uri; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLRPCSignatureItem.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLRPCSignatu0000755000175000017500000000370710542776150031345 0ustar godgod/* * 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.metadata.wsdl; /** * Represents an individual item of a wrpc:signature * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class WSDLRPCSignatureItem { public enum Direction {IN, OUT, INOUT, RETURN}; private Direction direction; private final String name; private int position; public WSDLRPCSignatureItem(String name) { this.name = name; this.direction = Direction.IN; } public WSDLRPCSignatureItem(String name, Direction direction) { this.direction = direction; this.name = name; } public String getName() { return name; } public Direction getDirection() { return direction; } public void setDirection(Direction direction) { this.direction = direction; } public void setPosition(int position) { this.position = position; } public int getPosition() { return position; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLService.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLService.ja0000644000175000017500000000640110573471351031345 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLService.java 2539 2007-03-07 08:08:09Z jason.greene@jboss.com $ import java.util.ArrayList; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.logging.Logger; /** * A Service component describes a set of endpoints (see 2.14 Endpoint [p.62] ) at which a particular * deployed implementation of the service is provided. The endpoints thus are in effect alternate places at * which the service is provided. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 10-Oct-2004 */ public class WSDLService extends Extendable { private static final long serialVersionUID = 1274166611190648479L; // provide logging private static final Logger log = Logger.getLogger(WSDLService.class); // The parent WSDL definitions element. private final WSDLDefinitions wsdlDefinitions; private final QName name; /** The interface attribute information item identifies the interface that the service is an instance of. */ private QName interfaceName; /** One or more endpoint element information items */ private ArrayList endpoints = new ArrayList(); public WSDLService(WSDLDefinitions wsdlDefinitions, QName name) { this.wsdlDefinitions = wsdlDefinitions; this.name = name; } public WSDLDefinitions getWsdlDefinitions() { return wsdlDefinitions; } public QName getName() { return name; } public QName getInterfaceName() { return interfaceName; } public void setInterfaceName(QName interfaceName) { this.interfaceName = interfaceName; } public WSDLEndpoint[] getEndpoints() { WSDLEndpoint[] arr = new WSDLEndpoint[endpoints.size()]; endpoints.toArray(arr); return arr; } public void addEndpoint(WSDLEndpoint endpoint) { endpoints.add(endpoint); } /** Get an endpoint for the given name */ public WSDLEndpoint getEndpoint(QName portName) { Iterator it = endpoints.iterator(); while (it.hasNext()) { WSDLEndpoint wsdlEndpoint = (WSDLEndpoint)it.next(); if (portName.equals(wsdlEndpoint.getName())) return wsdlEndpoint; } return null; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLUtils.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLUtils.java0000644000175000017500000006533110650145103031370 0ustar godgod/* * 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.metadata.wsdl; import java.io.File; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Stack; import java.util.StringTokenizer; import javax.ejb.SessionBean; import javax.jws.WebMethod; import javax.jws.WebService; import javax.xml.namespace.QName; import javax.xml.rpc.holders.BigDecimalHolder; import javax.xml.rpc.holders.BigIntegerHolder; import javax.xml.rpc.holders.BooleanHolder; import javax.xml.rpc.holders.BooleanWrapperHolder; import javax.xml.rpc.holders.ByteArrayHolder; import javax.xml.rpc.holders.ByteHolder; import javax.xml.rpc.holders.ByteWrapperHolder; import javax.xml.rpc.holders.CalendarHolder; import javax.xml.rpc.holders.DoubleHolder; import javax.xml.rpc.holders.DoubleWrapperHolder; import javax.xml.rpc.holders.FloatHolder; import javax.xml.rpc.holders.FloatWrapperHolder; import javax.xml.rpc.holders.Holder; import javax.xml.rpc.holders.IntHolder; import javax.xml.rpc.holders.IntegerWrapperHolder; import javax.xml.rpc.holders.LongHolder; import javax.xml.rpc.holders.LongWrapperHolder; import javax.xml.rpc.holders.ObjectHolder; import javax.xml.rpc.holders.QNameHolder; import javax.xml.rpc.holders.ShortHolder; import javax.xml.rpc.holders.ShortWrapperHolder; import javax.xml.rpc.holders.StringHolder; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.ParameterWrapping; import org.jboss.ws.core.utils.HolderUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.wsf.common.JavaUtils; import org.jboss.xb.binding.Util; /** * Singleton utils class used for Java2WSDL and WSDL2Java operations * * @author Anil Saldhana * @since Nov 3, 2004 */ public class WSDLUtils { private String newline = "\n"; private static WSDLUtils instance = new WSDLUtils(); private List wrapperlist = null; private List primlist = null; private final Map primitiveMap = new HashMap(); private final static Map schemaBasicTypes = new HashMap(); private final static Map holderTypes = new HashMap(); private final static Map reverseHolderTypes = new HashMap(); // Skip these methods when generating wsdl operations private List ignoredMethods; static { schemaBasicTypes.put("anyURI", java.net.URI.class); schemaBasicTypes.put("boolean", Boolean.TYPE); schemaBasicTypes.put("byte", Byte.TYPE); schemaBasicTypes.put("decimal", java.math.BigDecimal.class); schemaBasicTypes.put("double", Double.TYPE); schemaBasicTypes.put("dateTime", Calendar.class); schemaBasicTypes.put("float", Float.TYPE); schemaBasicTypes.put("int", Integer.TYPE); schemaBasicTypes.put("integer", BigInteger.class); schemaBasicTypes.put("long", Long.TYPE); schemaBasicTypes.put("QName", QName.class); schemaBasicTypes.put("short", Short.TYPE); schemaBasicTypes.put("String", String.class); } static { holderTypes.put(BigDecimal.class, BigDecimalHolder.class); holderTypes.put(BigInteger.class, BigIntegerHolder.class); holderTypes.put(boolean.class, BooleanHolder.class); holderTypes.put(Boolean.class, BooleanWrapperHolder.class); holderTypes.put(byte.class, ByteHolder.class); holderTypes.put(Byte.class, ByteWrapperHolder.class); holderTypes.put(Byte[].class, ByteArrayHolder.class); holderTypes.put(Calendar.class, CalendarHolder.class); holderTypes.put(double.class, DoubleHolder.class); holderTypes.put(Double.class, DoubleWrapperHolder.class); holderTypes.put(float.class, FloatHolder.class); holderTypes.put(Float.class, FloatWrapperHolder.class); holderTypes.put(int.class, IntHolder.class); holderTypes.put(Integer.class, IntegerWrapperHolder.class); holderTypes.put(long.class, LongHolder.class); holderTypes.put(Long.class, LongWrapperHolder.class); holderTypes.put(Object.class, ObjectHolder.class); holderTypes.put(QName.class, QNameHolder.class); holderTypes.put(short.class, ShortHolder.class); holderTypes.put(Short.class, ShortWrapperHolder.class); holderTypes.put(String.class, StringHolder.class); } static { reverseHolderTypes.put(BigDecimalHolder.class, BigDecimal.class); reverseHolderTypes.put(BigIntegerHolder.class, BigInteger.class); reverseHolderTypes.put(BooleanHolder.class, boolean.class); reverseHolderTypes.put(BooleanWrapperHolder.class, Boolean.class); reverseHolderTypes.put(ByteArrayHolder.class, Byte[].class); reverseHolderTypes.put(ByteHolder.class, byte.class); reverseHolderTypes.put(ByteWrapperHolder.class, Byte.class); reverseHolderTypes.put(CalendarHolder.class, Calendar.class); reverseHolderTypes.put(DoubleHolder.class, double.class); reverseHolderTypes.put(DoubleWrapperHolder.class, Double.class); reverseHolderTypes.put(FloatHolder.class, float.class); reverseHolderTypes.put(FloatWrapperHolder.class, Float.class); reverseHolderTypes.put(IntHolder.class, int.class); reverseHolderTypes.put(IntegerWrapperHolder.class, Integer.class); reverseHolderTypes.put(LongHolder.class, long.class); reverseHolderTypes.put(LongWrapperHolder.class, Long.class); reverseHolderTypes.put(ObjectHolder.class, Object.class); reverseHolderTypes.put(QNameHolder.class, QName.class); reverseHolderTypes.put(ShortHolder.class, short.class); reverseHolderTypes.put(ShortWrapperHolder.class, Short.class); reverseHolderTypes.put(StringHolder.class, String.class); } /** * Singleton - Only way to get an instance * @return */ public static WSDLUtils getInstance() { return instance; } private WSDLUtils() { wrapperlist = new ArrayList(); primlist = new ArrayList(); populatePrimList(); populateWrapperList(); createPrimitiveMap(); } /** * Check if it is of Primitive Type * @param str * @return */ public boolean isPrimitive(String str) { return primlist.contains(str); } /** * Check if it is of Wrapper Type * @param str * @return */ public boolean isWrapper(String str) { return wrapperlist.contains(str); } /** * For the given complex type, check if its base type is the regular xsd type (xsd:anyType) * which can be ignored * @param baseType * @param t ComplexTypeDefinition * @return true:ignorable, false-otherwise(user defined base type) */ public boolean isBaseTypeIgnorable(XSTypeDefinition baseType, XSComplexTypeDefinition t) { boolean bool = false; //Check baseType is xsd:anyType if (baseType != null) { if (baseType.getNamespace() == Constants.NS_SCHEMA_XSD && baseType.getName().equals("anyType")) bool = true; //Ignore this baseType } if (XSComplexTypeDefinition.CONTENTTYPE_SIMPLE == t.getContentType()) { bool = true; //ComplexType has a simplecontent } return bool; } /** * Check if the class is a Java standard class * @param cls * @return true if class belongs to java.* or javax.* package */ public boolean checkIgnoreClass(Class cls) { if (cls == null) throw new IllegalArgumentException("Illegal null argument:cls"); //if (cls.isArray()) cls = cls.getComponentType(); if (!cls.isArray()) { String pkgname = cls.getPackage() != null ? cls.getPackage().getName() : null; if (pkgname != null && pkgname.startsWith("java")) return true; if (ParameterWrapping.WrapperType.class.isAssignableFrom(cls)) return true; } return false; } /** Check if this method should be ignored */ public boolean checkIgnoreMethod(Method method) { String methodname = method.getName(); if (ignoredMethods == null) { ignoredMethods = new ArrayList(); Method[] objMethods = Object.class.getMethods(); for (int i = 0; i < objMethods.length; i++) { ignoredMethods.add(objMethods[i].getName()); } //Add the SessionBean Methods to the ignore list Method[] sbMethods = SessionBean.class.getMethods(); for (int i = 0; i < sbMethods.length; i++) { ignoredMethods.add(sbMethods[i].getName()); } } boolean ignoreMethod = ignoredMethods.contains(methodname); // FIXME: This code is a duplicate, it should read from the UMDM if (method.getDeclaringClass().isAnnotationPresent(WebService.class) && method.isAnnotationPresent(WebMethod.class) == false) ignoreMethod = true; return ignoreMethod; } /** * Chop "PortType" at the end of the String * @param name * @return */ public String chopPortType(String name) { int index = name.lastIndexOf("PortType"); if (index > 0) return name.substring(0, index); return name; } /** * Chop chopstr at the end of the String * @param name * @param chopstr the string that is the key Eg: Fault * @return */ public String chop(String name, String chopstr) { int index = name.lastIndexOf(chopstr); if (index > 0) return name.substring(0, index); return name; } /** * Given a packageName, start creating the package structure * @param packageName */ public File createPackage(String path, String packageName) { if (packageName == null) throw new IllegalArgumentException("Illegal Null Argument: packageName"); if (path == null) throw new IllegalArgumentException("Illegal Null Argument: path"); String pac = packageName.replace('.', '/'); File dir = new File(path + "/" + pac); dir.mkdirs(); return dir; } /** * Create a file on the disk * @param loc Location where the file has to be created * @param fname File Name to which '.java' will be appended * @return * @throws IOException Problem creating the file */ public File createPhysicalFile(File loc, String fname) throws IOException { if (loc == null) throw new IllegalArgumentException("Illegal Null Argument: loc"); if (fname == null) throw new IllegalArgumentException("Illegal Null Argument: fname"); File javaFile = new File(loc.getAbsolutePath() + "/" + fname + ".java"); //Delete the javaFile if already exists if (javaFile.exists()) javaFile.delete(); boolean boolCreate = javaFile.createNewFile(); if (!boolCreate) throw new WSException(fname + ".java cannot be created"); return javaFile; } /** * Create the basic template of a class * @param pkgname Package Name * @param fname File Name to which '.java' will be appended * @param type XSDType to obtain base class info (if Complex Type) * @param importList Strings representing imports * @return */ public StringBuilder createClassBasicStructure(String pkgname, String fname, XSTypeDefinition type, List importList, String baseName) { StringBuilder buf = new StringBuilder(); writeJbossHeader(buf); buf.append(newline); buf.append("package " + pkgname + ";"); buf.append(newline); buf.append(newline); if (importList != null) { Iterator iter = importList.iterator(); while (iter.hasNext()) { buf.append("import " + (String)iter.next() + ";"); buf.append(newline); } } buf.append(newline); XSTypeDefinition baseType = null; if (type instanceof XSComplexTypeDefinition) { XSComplexTypeDefinition t = (XSComplexTypeDefinition)type; baseType = t.getBaseType(); //Check baseType is xsd:anyType if (baseType != null) { if (baseType.getNamespace() == Constants.NS_SCHEMA_XSD && baseType.getName().equals("anyType")) baseType = null; //Ignore this baseType } if (XSComplexTypeDefinition.CONTENTTYPE_SIMPLE == t.getContentType()) { baseType = null; //ComplexType has a simplecontent } } buf.append("public class " + fname); if (baseName == null && baseType != null) baseName = baseType.getName(); if (baseName != null) buf.append(" extends " + baseName); buf.append(newline); buf.append("{"); buf.append(newline); return buf; } /** * Checks whether there exists a public field with the given name * @param javaType Class Object * @param name Field name to check * @return true - if public field exists, false-otherwise */ public boolean doesPublicFieldExist(Class javaType, String name) { Field fld = null; try { fld = javaType.getField(name); } catch (SecurityException e) { throw e; } catch (NoSuchFieldException e) { return false; } int mod = fld.getModifiers(); if ((mod == Modifier.PUBLIC)) return true; return false; } /** * Ensure that the first alphabet is uppercase * @param fname * @return */ public String firstLetterUpperCase(String fname) { if (fname == "" || fname == null) throw new WSException("String passed is null"); //Ensure that the first character is uppercase if (Character.isLowerCase(fname.charAt(0))) { char[] chars = fname.toCharArray(); char f = Character.toUpperCase(chars[0]); chars[0] = f; fname = new String(chars); } return fname; } /** * Get the dimension of an array * @param arr * @return dimension of an array */ public int getArrayDimension(Class arr) { if (arr == null || arr.isArray() == false) throw new IllegalArgumentException("Illegal null or array arg:arr"); int counter = 0; while (arr.isArray()) { counter += 1; arr = arr.getComponentType(); } return counter; } /** * Return the Jaxrpc holder that * represents the class * @param cls * @return Jaxrpc Holder object if exists */ public Class getHolder(Class cls) { return holderTypes.get(cls); } /** * Return the Java class that is represented by * the Jaxrpc holder * @param cls The jaxrpc holder type * @return Jaxrpc Holder object if exists */ public Class getJavaTypeForHolder(Class cls) { if (Holder.class.isAssignableFrom(cls)) return HolderUtils.getValueType(cls); else return cls; //return reverseHolderTypes.get(cls); } /** * An input of "HelloObjArray" is converted into arrayOfHelloObj * Applied in the input part for WSDL 1.1 Messages * @param arrayStr * @return */ public String getMessagePartForArray(Class javaType) { StringBuilder sb = new StringBuilder(); while (javaType.isArray()) { sb.append("arrayOf"); javaType = javaType.getComponentType(); } sb.append(getJustClassName(javaType)); return sb.toString(); } /** * Given a class, strip out the package name * * @param cls * @return just the classname */ public static String getJustClassName(Class cls) { if (cls == null) return null; if (cls.isArray()) { Class c = cls.getComponentType(); return getJustClassName(c.getName()); } return getJustClassName(cls.getName()); } /** * Given a FQN of a class, strip out the package name * * @param classname * @return just the classname */ public static String getJustClassName(String classname) { int index = classname.lastIndexOf("."); if (index < 0) index = 0; else index = index + 1; return classname.substring(index); } /** * From the list of fields defined by this class (not superclasses) * get the fields that are relevant (public) */ public Field[] getPublicFields(Class cls) { ArrayList list = new ArrayList(); Field[] fld = cls.getDeclaredFields(); for (int i = 0; i < fld.length; i++) { Field field = fld[i]; int mod = field.getModifiers(); if ((mod == Modifier.PUBLIC)) list.add(field); }//end for Field[] retarr = new Field[list.size()]; list.toArray(retarr); return retarr; } /** * From the list of fields defined by this class (not superclasses) * get the fields that are relevant (public/protected) * * @param methods * @return */ public Method[] getPublicProtectedMethods(Method[] methods) { ArrayList list = new ArrayList(); int len = methods.length; for (int i = 0; i < len; i++) { Method method = methods[i]; int mod = method.getModifiers(); if ((mod == Modifier.PUBLIC || mod == Modifier.PROTECTED)) list.add(method); }//end for Method[] retarr = new Method[list.size()]; list.toArray(retarr); return retarr; } /** * Given the XMLType, we will check if it is of basic schema * types that are mapped to Java primitives and wrappers * Jaxrpc 1.1 Section 5.3 * @param xmlType * @return */ public Class getJavaType(QName xmlType) { if (xmlType == null) return null; String localPart = xmlType.getLocalPart(); return (Class)schemaBasicTypes.get(localPart); } /** * Change the first character to uppercase * @param str * @return */ public String getMixedCase(String str) { if (str == null || str.length() == 0) throw new IllegalArgumentException("String passed to WSDLUtils.getMixedCase is null"); if (str.length() == 1) return str.toUpperCase(); char[] charr = str.toCharArray(); charr[0] = Character.toUpperCase(charr[0]); return new String(charr); } /** * Given a QName, provide a string that is prefix:localpart * @param qn * @return formatted string */ public String getFormattedString(QName qn) { if (qn == null) throw new IllegalArgumentException(" QName passed is null"); StringBuilder sb = new StringBuilder(); String prefix = qn.getPrefix(); String localpart = qn.getLocalPart(); if (prefix == null || prefix == "") prefix = Constants.PREFIX_TNS; sb.append(prefix + ":"); sb.append(localpart); return sb.toString(); } /** * Return a QName given a formatted string * @param formattedStr string that is prefix:localpart * @return QName */ public QName getQName(String formattedStr) { QName qn = null; int ind = formattedStr.lastIndexOf(":"); if (ind < 0) throw new IllegalArgumentException("Formatted String is not of format prefix:localpart"); String prefix = formattedStr.substring(0, ind); String nsuri = null; if (Constants.PREFIX_XSD.equals(prefix)) nsuri = Constants.NS_SCHEMA_XSD; if (nsuri == null) qn = new QName(formattedStr.substring(ind + 1)); else qn = new QName(nsuri, formattedStr.substring(ind + 1), prefix); return qn; } /** * Return the primitive for a wrapper equivalent (Integer -> int) * @param str * @return */ public String getPrimitive(String str) { return (String)primitiveMap.get(str); } /** * Extracts the package name from the typeNS * @param typeNS * @return */ public String getPackageName(String typeNS) { String pkgname = Util.xmlNamespaceToJavaPackage(typeNS); return pkgname; } public static String getTypeNamespace(Class javaType) { return getTypeNamespace(JavaUtils.getPackageName(javaType)); } /** * Extracts the typeNS given the package name * Algorithm is based on the one specified in JAWS v2.0 spec */ public static String getTypeNamespace(String packageName) { StringBuilder sb = new StringBuilder("http://"); //Generate tokens with '.' as delimiter StringTokenizer st = new StringTokenizer(packageName, "."); //Have a LIFO queue for the tokens Stack stk = new Stack(); while (st != null && st.hasMoreTokens()) { stk.push(st.nextToken()); } String next; while (!stk.isEmpty() && (next = stk.pop()) != null) { if (sb.toString().equals("http://") == false) sb.append("."); sb.append(next); } // trailing slash sb.append("/"); return sb.toString(); } /** * Given WSDLDefinitions, detect the wsdl style * * @param wsdl * @return Constants.RPC_LITERAL or Constants.DOCUMENT_LITERAL */ public String getWSDLStyle(WSDLDefinitions wsdl) { WSDLInterface wi = wsdl.getInterfaces()[0]; WSDLInterfaceOperation wio = wi.getOperations()[0]; String style = wio.getStyle(); if (style == null || style.equals(Constants.URI_STYLE_RPC) || "rpc".equalsIgnoreCase(style)) return Constants.RPC_LITERAL; else return Constants.DOCUMENT_LITERAL; } public static JBossXSModel getSchemaModel(WSDLTypes types) { if (types instanceof XSModelTypes) return ((XSModelTypes)types).getSchemaModel(); throw new WSException("WSDLTypes is not an XSModelTypes"); } public static void addSchemaModel(WSDLTypes types, String namespace, JBossXSModel model) { if (!(types instanceof XSModelTypes)) throw new WSException("WSDLTypes is not an XSModelTypes"); XSModelTypes modelTypes = (XSModelTypes)types; modelTypes.addSchemaModel(namespace, model); } /** * Checks whether the class is a standard jaxrpc holder * * @param cls a Class object * @return true: A Standard jaxrpc holder */ public boolean isStandardHolder(Class cls) { if (Holder.class.isAssignableFrom(cls) == false) return false; //Not even a holder //It is a holder. Is it a standard holder? if (cls.getPackage().getName().startsWith("javax.xml.rpc")) return true; return false; } /** * Write the JBoss License Header at the top of generated class source files * @param buf */ public void writeJbossHeader(StringBuilder buf) { buf.append("/*").append(newline); buf.append(" * JBossWS WS-Tools Generated Source").append(newline); buf.append(" *").append(newline); buf.append(" * Generation Date: " + new Date() + newline); buf.append(" *").append(newline); buf.append(" * This generated source code represents a derivative work of the input to").append(newline); buf.append(" * the generator that produced it. Consult the input for the copyright and").append(newline); buf.append(" * terms of use that apply to this source code.").append(newline); buf.append(" */").append(newline); } protected void populatePrimList() { primlist.add("int"); primlist.add("boolean"); primlist.add("short"); primlist.add("byte"); primlist.add("long"); primlist.add("float"); primlist.add("double"); } protected void populateWrapperList() { wrapperlist.add("java.lang.Integer"); wrapperlist.add("java.lang.Boolean"); wrapperlist.add("java.lang.Short"); wrapperlist.add("java.lang.Byte"); wrapperlist.add("java.lang.Long"); wrapperlist.add("java.lang.Float"); wrapperlist.add("java.lang.Double"); wrapperlist.add("java.lang.String"); wrapperlist.add("java.math.BigInteger"); wrapperlist.add("java.math.BigDecimal"); wrapperlist.add("java.util.Calendar"); wrapperlist.add("javax.xml.namespace.QName"); } private void createPrimitiveMap() { primitiveMap.put("Integer", "int"); primitiveMap.put("Float", "float"); primitiveMap.put("Long", "long"); primitiveMap.put("Double", "double"); primitiveMap.put("Short", "short"); primitiveMap.put("Boolean", "boolean"); primitiveMap.put("Byte", "byte"); primitiveMap.put("java.lang.Integer", "int"); primitiveMap.put("java.lang.Float", "float"); primitiveMap.put("java.lang.Long", "long"); primitiveMap.put("java.lang.Double", "double"); primitiveMap.put("java.lang.Short", "short"); primitiveMap.put("java.lang.Boolean", "boolean"); primitiveMap.put("java.lang.Byte", "byte"); } public static WSDLInterfaceOperationOutput getWsdl11Output(WSDLInterfaceOperation operation) { WSDLInterfaceOperationOutput[] outputs = operation.getOutputs(); if (outputs == null) return null; switch (outputs.length) { case 0: return null; case 1: return outputs[0]; } throw new WSException("Only Request-Only and Request-Response MEPs are allowed"); } public static WSDLInterfaceOperationInput getWsdl11Input(WSDLInterfaceOperation operation) { WSDLInterfaceOperationInput[] inputs = operation.getInputs(); if (inputs == null) return null; switch (inputs.length) { case 0: return null; case 1: return inputs[0]; } throw new WSException("Only Request-Only and Request-Response MEPs are allowed"); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingFault.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingFau0000644000175000017500000000443210542776150031365 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLBindingFault.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import javax.xml.namespace.QName; /** * A Binding Fault component describes a concrete binding of a particular fault within an interface to a * particular concrete message format. A particular fault of an interface is uniquely identified by the target * namespace of the interface and the name of the fault within that interface. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLBindingFault implements Serializable { private static final long serialVersionUID = 6306975072558524200L; // The parent WSDL binding private WSDLBinding wsdlBinding; /** An REQUIRED Interface Fault component in the {faults} property of the Interface * component identified by the {interface} property of the parent Binding component. This is the * Interface Fault component for which binding information is being specified.*/ private QName ref; public WSDLBindingFault(WSDLBinding wsdlBinding) { this.wsdlBinding = wsdlBinding; } public WSDLBinding getWsdlBinding() { return wsdlBinding; } public QName getRef() { return ref; } public void setRef(QName ref) { this.ref = ref; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterface.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterface.0000644000175000017500000001240110743173754031334 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLInterface.java 5471 2008-01-15 18:14:04Z alessio.soldano@jboss.com $ import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.logging.Logger; /** * An Interface component describes sequences of messages that a service sends and/or receives. It does this * by grouping related messages into operations. An operation is a sequence of input and output messages, * and an interface is a set of operations. Thus, an interface defines the design of the application. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 10-Oct-2004 */ public class WSDLInterface extends Extendable { // provide logging private static final Logger log = Logger.getLogger(WSDLInterface.class); private static final long serialVersionUID = 2453454924501233964L; // The parent WSDL definitions element. private WSDLDefinitions wsdlDefinitions; private QName name; /** The OPTIONAL extends attribute information item lists the interfaces that this interface derives from. */ private QName[] extendList; /** The OPTIONAL styleDefault attribute information item indicates the default style used to construct the * {element} properties of {message references} of all operations contained within the [owner] interface */ private String styleDefault; /** Zero or more operation element information items */ private Map operations = new LinkedHashMap(); /** Zero or more fault element information items */ private Map faults = new LinkedHashMap(); private WSDLDocumentation documentationElement; /** Construct a WSDL interface for a given WSDL definition */ public WSDLInterface(WSDLDefinitions wsdlDefinitions, QName name) { this.wsdlDefinitions = wsdlDefinitions; this.name = name; } public WSDLDefinitions getWsdlDefinitions() { return wsdlDefinitions; } public QName getName() { return name; } public QName[] getExtendList() { return extendList; } public void setExtendList(QName[] extendList) { this.extendList = extendList; } public String getStyleDefault() { return styleDefault; } public void setStyleDefault(String styleDefault) { this.styleDefault = styleDefault; } public WSDLInterfaceOperation[] getOperations() { WSDLInterfaceOperation[] arr = new WSDLInterfaceOperation[operations.size()]; new ArrayList(operations.values()).toArray(arr); return arr; } public WSDLInterfaceOperation[] getSortedOperations() { WSDLInterfaceOperation[] arr = new WSDLInterfaceOperation[operations.size()]; new ArrayList(operations.values()).toArray(arr); Arrays.sort(arr); return arr; } public WSDLInterfaceOperation getOperation(QName name) { WSDLInterfaceOperation operation = operations.get(name); return operation; } public WSDLInterfaceOperation getOperation(String localName) { WSDLInterfaceOperation operation = operations.get(new QName(name.getNamespaceURI(), localName)); return operation; } public void addOperation(WSDLInterfaceOperation operation) { operations.put(operation.getName(), operation); } public WSDLInterfaceFault[] getFaults() { WSDLInterfaceFault[] arr = new WSDLInterfaceFault[faults.size()]; new ArrayList(faults.values()).toArray(arr); return arr; } public WSDLInterfaceFault getFault(QName name) { WSDLInterfaceFault fault = faults.get(name); return fault; } public WSDLInterfaceFault getFault(String localName) { WSDLInterfaceFault fault = faults.get(new QName(name.getNamespaceURI(), localName)); return fault; } public void addFault(WSDLInterfaceFault fault) { faults.put(fault.getName(), fault); } public WSDLDocumentation getDocumentationElement() { return documentationElement; } public void setDocumentationElement(WSDLDocumentation documentationElement) { this.documentationElement = documentationElement; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/0000755000175000017500000000000010755000262030706 5ustar godgod././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSElementDeclaration.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000001335710566046204031505 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import org.apache.xerces.xs.ShortList; import org.apache.xerces.xs.XSAnnotation; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSException; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.util.NotImplementedException; /** * Represents an XS Element Declaration * @author Anil Saldhana * @since May 3, 2005 */ public class JBossXSElementDeclaration extends JBossXSObject implements XSElementDeclaration { protected String targetNamespace = null; protected JBossXSTypeDefinition xstype = null; protected boolean nillable = false; private XSElementDeclaration xsed; /** * Sole Annotation object */ protected XSAnnotation annotation = null; /** * */ public JBossXSElementDeclaration() { super(); } /** * @param name * @param namespace */ public JBossXSElementDeclaration(String name, String namespace) { super(name, namespace); } /** * Create a new JBossXSElementDeclaration while * reading data from XSElementDeclaration. * @param xe */ public JBossXSElementDeclaration(XSElementDeclaration xe) { if (xe == null) throw new IllegalArgumentException("Illegal Null Argument:xe"); xsed = xe; name = xe.getName(); namespace = xe.getNamespace(); XSTypeDefinition xt = xe.getTypeDefinition(); if (xt instanceof JBossXSTypeDefinition == false && xt instanceof XSComplexTypeDefinition) { xstype = new JBossXSComplexTypeDefinition((XSComplexTypeDefinition)xt); } else if (xt instanceof JBossXSTypeDefinition == false) { xstype = new JBossXSTypeDefinition(xt); } this.annotation = xe.getAnnotation(); } public XSElementDeclaration getXSElementDeclaration() { return xsed; } /** * One of XSConstants.SCOPE_GLOBAL, XSConstants.SCOPE_LOCAL * or XSConstants.SCOPE_ABSENT */ protected short scope = 0; protected XSComplexTypeDefinition enclosingCTDefinition; public XSTypeDefinition getTypeDefinition() { return this.xstype; } public void setTypeDefinition(XSTypeDefinition xst) { if (xst instanceof JBossXSTypeDefinition) this.xstype = (JBossXSTypeDefinition)xst; else if (xst instanceof XSComplexTypeDefinition) this.xstype = new JBossXSComplexTypeDefinition((XSComplexTypeDefinition)xst); } /** * One of XSConstants.SCOPE_GLOBAL, XSConstants.SCOPE_LOCAL * or XSConstants.SCOPE_ABSENT * @return */ public short getScope() { return this.scope; } public void setScope(short scope) { this.scope = scope; } public XSComplexTypeDefinition getEnclosingCTDefinition() { return this.enclosingCTDefinition; } public void setEnclosingCTDefinition(XSComplexTypeDefinition enclosingCTDefinition) { this.enclosingCTDefinition = enclosingCTDefinition; } public String getTargetNamespace() { return targetNamespace; } public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; this.setNamespace(targetNamespace); } public short getConstraintType() { return 0; } public String getConstraintValue() { return null; } public Object getActualVC() throws XSException { return null; } public short getActualVCType() throws XSException { return 0; } public ShortList getItemValueTypes() throws XSException { return null; } public boolean getNillable() { return this.nillable; } public void setNillable(boolean nillable) { this.nillable = nillable; } public XSNamedMap getIdentityConstraints() { return null; } public XSElementDeclaration getSubstitutionGroupAffiliation() { return null; } public boolean isSubstitutionGroupExclusion(short i) { return false; } public short getSubstitutionGroupExclusions() { return 0; } public boolean isDisallowedSubstitution(short i) { return false; } public short getDisallowedSubstitutions() { return 0; } public boolean getAbstract() { return false; } public XSAnnotation getAnnotation() { return this.annotation; } /** * Get the type */ @Override public short getType() { return XSConstants.ELEMENT_DECLARATION; } public XSObjectList getAnnotations() { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSTypeDefinition.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000001266610542776150031513 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.WSException; /** * @author Anil Saldhana * @since Apr 20, 2005 */ public class JBossXSTypeDefinition extends JBossXSObject implements XSTypeDefinition { private static final long serialVersionUID = -3317350531846406564L; protected boolean anonymous = false; protected JBossXSTypeDefinition baseType; protected boolean isFinal = false; public JBossXSTypeDefinition() { } public JBossXSTypeDefinition(String name, String namespace) { super(name, namespace); } /** * Create a new JBossXSTypeDefinition * while reading data from a XSTypeDefinition * * @param xt */ public JBossXSTypeDefinition(XSTypeDefinition xt) { super(xt.getName(), xt.getNamespace()); setAnonymous(xt.getAnonymous()); XSTypeDefinition xbase = xt.getBaseType(); if (xbase != null) { if (xbase instanceof JBossXSTypeDefinition == false && !("anyType".equals(xbase.getName()))) baseType = new JBossXSTypeDefinition(xbase); } } /** * Return whether this type definition is a simple type or complex type. */ public short getTypeCategory() { throw new WSException("Type unidentified"); } /** * {base type definition}: either a simple type definition or a complex * type definition. */ public XSTypeDefinition getBaseType() { return baseType; } /** * {final}. For a complex type definition it is a subset of {extension, * restriction}. For a simple type definition it is a subset of * {extension, list, restriction, union}. * @param restriction Extension, restriction, list, union constants * (defined in XSConstants). * @return True if restriction is in the final set, * otherwise false. */ public boolean isFinal(short restriction) { return isFinal; } /** * For complex types the returned value is a bit combination of the subset * of {DERIVATION_EXTENSION, DERIVATION_RESTRICTION} * corresponding to final set of this type or * DERIVATION_NONE. For simple types the returned value is * a bit combination of the subset of { * DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST * } corresponding to final set of this type or * DERIVATION_NONE. */ public short getFinal() { return 0; } /** Convenience attribute. A boolean that specifies if the type definition is anonymous. */ public boolean getAnonymous() { return anonymous; } public void setAnonymous(boolean anonymous) { this.anonymous = anonymous; } /** * Convenience method which checks if this type is derived from the given * ancestorType. * @param ancestorType An ancestor type definition. * @param derivationMethod A bit combination representing a subset of { * DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST * }. * @return True if this type is derived from ancestorType * using only derivation methods from the derivationMethod * . */ public boolean derivedFromType(XSTypeDefinition ancestorType, short derivationMethod) { return false; } /** * Convenience method which checks if this type is derived from the given * ancestor type. * @param namespace An ancestor type namespace. * @param name An ancestor type name. * @param derivationMethod A bit combination representing a subset of { * DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST * }. * @return True if this type is derived from ancestorType * using only derivation methods from the derivationMethod * . */ public boolean derivedFrom(String namespace, String name, short derivationMethod) { return false; } public void setBaseType(XSTypeDefinition baseT) { if (baseT instanceof JBossXSTypeDefinition) { this.baseType = (JBossXSTypeDefinition)baseT; } else { this.baseType = new JBossXSTypeDefinition(baseT); } } public void setFinal(boolean aFinal) { isFinal = aFinal; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSErrorHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000001163510551203052031470 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import org.apache.xerces.xni.XNIException; import org.apache.xerces.xni.parser.XMLErrorHandler; import org.apache.xerces.xni.parser.XMLParseException; import org.jboss.logging.Logger; /** * Error Handler for the Xerces schema parser default implementation * @author Anil Saldhana * @since Aug 11, 2005 */ public class JBossXSErrorHandler implements XMLErrorHandler { private static final Logger log = Logger.getLogger(JBossXSErrorHandler.class); /** * Reports a warning. Warnings are non-fatal and can be safely ignored by most applications. * @param domain - The domain of the warning. The domain can be any string but is suggested to be a valid URI. The domain can be used to conveniently specify a web site location of the relevent specification or document pertaining to this warning. * @param key - The warning key. This key can be any string and is implementation dependent. * @param exception - Exception. * @throws XNIException Thrown to signal that the parser should stop parsing the document. */ public void warning(String domain, String key, XMLParseException xexp) throws XNIException { log.trace(getFormattedString(domain, key, xexp)); } /** * Reports an error. Errors are non-fatal and usually signify that the document is invalid with respect to its grammar(s). * @param domain - The domain of the warning. The domain can be any string but is suggested to be a valid URI. The domain can be used to conveniently specify a web site location of the relevent specification or document pertaining to this warning. * @param key - The warning key. This key can be any string and is implementation dependent. * @param exception - Exception. * @throws XNIException Thrown to signal that the parser should stop parsing the document. */ public void error(String domain, String key, XMLParseException xexp) throws XNIException { if ("src-include.2.1".equals(key)) throw new XNIException("Parser should stop:", xexp); String errorMsg = getFormattedString(domain, key, xexp); log.error(errorMsg); } /** * Report a fatal error. Fatal errors usually occur when the document is not well-formed * and signifies that the parser cannot continue normal operation. * @param domain - The domain of the warning. The domain can be any string but is suggested to be a valid URI. The domain can be used to conveniently specify a web site location of the relevent specification or document pertaining to this warning. * @param key - The warning key. This key can be any string and is implementation dependent. * @param exception - Exception. * @throws XNIException Thrown to signal that the parser should stop parsing the document. */ public void fatalError(String domain, String key, XMLParseException xexp) throws XNIException { String errorMsg = getFormattedString(domain, key, xexp); log.error(errorMsg); throw new XNIException("Parser should stop: " + errorMsg, xexp); } /** * Get the name of the schema file in question */ private String getFileName(XMLParseException xexp) { String fname = xexp.getExpandedSystemId(); if (fname != null) { int index = fname.lastIndexOf('/'); if (index != -1) fname = fname.substring(index + 1); } else { fname = ""; } return fname; } /** * Return a formatted string that gives as much information * as possible to the user */ private String getFormattedString(String domain, String key, XMLParseException xexp) { StringBuilder buf = new StringBuilder(getFileName(xexp)); buf.append("[domain:"); buf.append(domain).append("]::[key=").append(key).append("]::"); buf.append("Message="); buf.append(xexp.getLocalizedMessage()); return buf.toString(); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSSimpleTypeDefinition.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000001042510542776150031502 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.util.ArrayList; import java.util.List; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; /** * XSSimpleTypeDefinition * @author Anil Saldhana * @since Aug 4, 2005 */ public class JBossXSSimpleTypeDefinition extends JBossXSTypeDefinition implements XSSimpleTypeDefinition { private XSSimpleTypeDefinition xsSimple = null; private List enumerations = new ArrayList(); public JBossXSSimpleTypeDefinition() { } public JBossXSSimpleTypeDefinition(XSSimpleTypeDefinition xs) { this.xsSimple = xs; } public short getVariety() { return xsSimple.getVariety(); } public XSSimpleTypeDefinition getPrimitiveType() { return xsSimple.getPrimitiveType(); } public short getBuiltInKind() { return xsSimple.getBuiltInKind(); } public XSSimpleTypeDefinition getItemType() { return xsSimple.getItemType(); } public XSObjectList getMemberTypes() { return xsSimple.getMemberTypes(); } public short getDefinedFacets() { return xsSimple.getDefinedFacets(); } public boolean isDefinedFacet(short arg0) { return xsSimple.isDefinedFacet(arg0); } public short getFixedFacets() { return xsSimple.getFixedFacets(); } public boolean isFixedFacet(short arg0) { return xsSimple.isFixedFacet(arg0); } public String getLexicalFacetValue(short arg0) { return xsSimple.getLexicalFacetValue(arg0); } public StringList getLexicalEnumeration() { if (xsSimple == null) return new JBossXSStringList(enumerations); return xsSimple.getLexicalEnumeration(); } public void addLexicalEnumeration(String enumeration) { this.enumerations.add(enumeration); } public StringList getLexicalPattern() { return xsSimple.getLexicalPattern(); } public short getOrdered() { return xsSimple.getOrdered(); } public boolean getFinite() { return xsSimple.getFinite(); } public boolean getBounded() { return xsSimple.getBounded(); } public boolean getNumeric() { return xsSimple.getNumeric(); } public XSObjectList getFacets() { return xsSimple.getFacets(); } public XSObjectList getMultiValueFacets() { return xsSimple.getMultiValueFacets(); } public XSObjectList getAnnotations() { return xsSimple.getAnnotations(); } /** * Get the type */ @Override public short getType() { return XSTypeDefinition.SIMPLE_TYPE; } /** * Return whether this type definition is a simple type or complex type. */ @Override public short getTypeCategory() { return XSTypeDefinition.SIMPLE_TYPE; } //*************************** //Override base class methods //**************************** @Override public String getName() { if (xsSimple == null) return name; return xsSimple.getName(); } @Override public String getNamespace() { if (xsSimple == null) return namespace; return xsSimple.getNamespace(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000001305110566046204031474 0ustar godgod/* * 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.metadata.wsdl.xmlschema; // $Id: JBossXSEntityResolver.java 2397 2007-02-18 12:54:28Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.HashMap; import java.util.Map; import org.apache.xerces.xni.XMLResourceIdentifier; import org.apache.xerces.xni.XNIException; import org.apache.xerces.xni.parser.XMLEntityResolver; import org.apache.xerces.xni.parser.XMLInputSource; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.utils.ResourceURL; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** * Entity Resolver for the default Xerces Reference parser * @author Anil Saldhana * @author Thomas.Diesler@jboss.org * @since 12-Aug-2005 */ public class JBossXSEntityResolver implements XMLEntityResolver { // provide logging private static final Logger log = Logger.getLogger(JBossXSEntityResolver.class); private Map schemaLocationByNamespace = new HashMap(); private EntityResolver delegate; public JBossXSEntityResolver(EntityResolver resolver, Map schemaLocationByNamespace) { this.schemaLocationByNamespace = schemaLocationByNamespace; this.delegate = resolver; } /** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resId) throws XNIException, IOException { log.trace("Resolve entity: " + resId); // First try the JBossEntityResolver String publicId = resId.getPublicId(); String systemId = resId.getLiteralSystemId(); String namespace = resId.getNamespace(); try { String publicURI = (publicId != null ? publicId : namespace); InputSource inputSource = delegate.resolveEntity(publicURI, systemId); if (inputSource != null) { XMLInputSource source = getXMLInputSource(inputSource, resId); return source; } } catch (Exception ex) { log.trace(ex); } try { String expandedSysId = resId.getExpandedSystemId(); if (expandedSysId != null) { log.trace("Use ExpandedSystemId: " + expandedSysId); return getXMLInputSource(new URL(expandedSysId), resId); } } catch (IOException e) { log.trace(e); } try { if (systemId != null) { log.trace("Use LiteralSystemId: " + systemId); return getXMLInputSource(new URL(systemId), resId); } } catch (IOException e) { log.trace(e); } // in case of a DOCTYPE declaration ew refer to systemId String namespaceURI = resId.getNamespace() != null ? resId.getNamespace() : resId.getLiteralSystemId(); // The schema parser will obviously know this schema already if (Constants.NS_SCHEMA_XSD.equals(namespaceURI)) return null; try { URL url = schemaLocationByNamespace.get(namespaceURI); if (url != null) { log.trace("Use SchemaLocationByNamespace: " + url); return getXMLInputSource(url, resId); } // Delegate to JBoss Entity Resolver XMLInputSource source = getXMLInputSource(delegate.resolveEntity(null, namespaceURI), resId); if (source != null) return source; } catch (SAXException e) { log.trace(e); } try { log.trace("Use NamespaceURI: " + namespaceURI); return getXMLInputSource(new URL(namespaceURI), resId); } catch (IOException e) { log.trace(e); } log.trace("Cannot obtain XMLInputSource for: " + resId); return null; } private XMLInputSource getXMLInputSource(URL url, XMLResourceIdentifier resId) throws IOException { InputStream inputStream = new ResourceURL(url).openStream(); InputSource inputSource = new InputSource(inputStream); return getXMLInputSource(inputSource, resId); } private XMLInputSource getXMLInputSource(InputSource inputSource, XMLResourceIdentifier resId) { String encoding = inputSource.getEncoding(); InputStream byteStream = inputSource.getByteStream(); return new XMLInputSource(resId.getPublicId(), resId.getExpandedSystemId(), resId.getBaseSystemId(), byteStream, encoding); } }././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSStringList.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000000572410542776150031510 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.xerces.xs.StringList; /** * Implements the StringList interface * @author Anil Saldhana * @since Apr 20, 2005 */ public class JBossXSStringList implements StringList { protected List strList = new ArrayList(); public JBossXSStringList() { } public JBossXSStringList(List alist) { this.strList = alist; } public JBossXSStringList(Collection col) { this.strList.addAll(col); } /** * The number of GenericStrings in the list. The range of * valid child object indices is 0 to length-1 inclusive. */ public int getLength() { return strList.size(); } /** * Checks if the GenericString item is a member * of this list. * @param item GenericString whose presence in this list is * to be tested. * @return True if this list contains the GenericString * item. */ public boolean contains(String item) { return strList.contains(item); } /** * Returns the indexth item in the collection or * null if index is greater than or equal to * the number of objects in the list. The index starts at 0. * @param index index into the collection. * @return The GenericString at the indexth * position in the StringList, or null if * the index specified is not valid. */ public String item(int index) { return (String)strList.get(index); } public List toList() { return strList; } public void addItem(String str) { strList.add(str); } public String toString() { return strList.toString(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000006022410650145103031470 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.io.IOException; import java.io.OutputStream; import java.io.Serializable; import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSAnnotation; import org.apache.xerces.xs.XSAttributeDeclaration; import org.apache.xerces.xs.XSAttributeGroupDefinition; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSModelGroupDefinition; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSNamespaceItem; import org.apache.xerces.xs.XSNamespaceItemList; import org.apache.xerces.xs.XSNotationDeclaration; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * Represents a schema model * @author Anil Saldhana * @since Apr 20, 2005 */ public class JBossXSModel implements XSModel, Cloneable { // provide logging private static final Logger log = Logger.getLogger(JBossXSModel.class); private AnonymousMapper anonymousMapper = new AnonymousMapper(); private boolean qualifiedElements = false; private NamespaceRegistry namespaceRegistry = new NamespaceRegistry(); protected XSNamespaceItemList nslist = null; protected HashMap nsimap = new HashMap(); public JBossXSModel() { } @Override public JBossXSModel clone() throws CloneNotSupportedException { return (JBossXSModel)super.clone(); } /** * Convenience method. Returns a list of all namespaces that belong to * this schema. The value null is not a valid namespace * name, but if there are components that do not have a target namespace * , null is included in this list. */ public StringList getNamespaces() { return new JBossXSStringList(nsimap.keySet()); } /** * A set of namespace schema information information items (of type * XSNamespaceItem), one for each namespace name which * appears as the target namespace of any schema component in the schema * used for that assessment, and one for absent if any schema component * in the schema had no target namespace. For more information see * schema information. */ public XSNamespaceItemList getNamespaceItems() { nslist = new JBossXSNamespaceItemList(nsimap.values()); //One for the default xsd JBossXSNamespaceItem nsxsd = new JBossXSNamespaceItem(Constants.NS_SCHEMA_XSD, namespaceRegistry, qualifiedElements); ((JBossXSNamespaceItemList)nslist).addItem(nsxsd); return nslist; } /** * Returns a list of top-level components, i.e. element declarations, * attribute declarations, etc. * @param objectType The type of the declaration, i.e. * ELEMENT_DECLARATION. Note that * XSTypeDefinition.SIMPLE_TYPE and * XSTypeDefinition.COMPLEX_TYPE can also be used as the * objectType to retrieve only complex types or simple * types, instead of all types. * @return A list of top-level definitions of the specified type in * objectType or an empty XSNamedMap if no * such definitions exist. */ public XSNamedMap getComponents(short objectType) { JBossXSNamedMap map = new JBossXSNamedMap(); JBossXSStringList sl = (JBossXSStringList)getNamespaces(); int len = sl != null ? sl.getLength() : 0; for (int i = 0; i < len; i++) { String ns = sl.item(i); JBossXSNamespaceItem ni = nsimap.get(ns); JBossXSNamedMap nm = null; if (ni != null) { nm = (JBossXSNamedMap)ni.getComponents(objectType); map.addItems(nm.toList()); } } return map; } /** * Convenience method. Returns a list of top-level component declarations * that are defined within the specified namespace, i.e. element * declarations, attribute declarations, etc. * @param objectType The type of the declaration, i.e. * ELEMENT_DECLARATION. * @param namespace The namespace to which the declaration belongs or * null (for components with no target namespace). * @return A list of top-level definitions of the specified type in * objectType and defined in the specified * namespace or an empty XSNamedMap. */ public XSNamedMap getComponentsByNamespace(short objectType, String namespace) { JBossXSNamedMap map = new JBossXSNamedMap(); JBossXSNamespaceItem ni = nsimap.get(namespace); if (ni == null) return map; return ni.getComponents(objectType); } /** * [annotations]: a set of annotations if it exists, otherwise an empty * XSObjectList. */ public XSObjectList getAnnotations() { List lst = new ArrayList(); JBossXSObjectList objlist = new JBossXSObjectList(lst); Set keyset = nsimap.keySet(); for (String ns : keyset) { XSNamespaceItem xs = nsimap.get(ns); objlist.addObjects(xs.getAnnotations()); } return objlist; } /** * Convenience method. Returns a top-level element declaration. * @param name The name of the declaration. * @param namespace The namespace of the declaration, otherwise * null. * @return A top-level element declaration or null if such a * declaration does not exist. */ public XSElementDeclaration getElementDeclaration(String name, String namespace) { if (name == null) return null; if (name.startsWith(">") || name.endsWith("]")) return anonymousMapper.getElementDeclaration(name, namespace); JBossXSNamespaceItem ni = nsimap.get(namespace); if (ni == null) return null; return ni.getElementDeclaration(name); } /** * Convenience method. Returns a top-level attribute declaration. * @param name The name of the declaration. * @param namespace The namespace of the declaration, otherwise * null. * @return A top-level attribute declaration or null if such * a declaration does not exist. */ public XSAttributeDeclaration getAttributeDeclaration(String name, String namespace) { JBossXSNamespaceItem ni = nsimap.get(namespace); if (ni == null) return null; return ni.getAttributeDeclaration(name); } /** * Convenience method. Returns a top-level simple or complex type * definition. * @param name The name of the definition. * @param namespace The namespace of the declaration, otherwise * null. * @return An XSTypeDefinition or null if such * a definition does not exist. */ public XSTypeDefinition getTypeDefinition(String name, String namespace) { if (name == null) return null; if (name.startsWith(">") || name.endsWith("]")) return anonymousMapper.getTypeDefinition(name, namespace); JBossXSNamespaceItem ni = nsimap.get(namespace); if (ni == null) return null; return ni.getTypeDefinition(name); } /** * Convenience method. Returns a top-level attribute group definition. * @param name The name of the definition. * @param namespace The namespace of the definition, otherwise * null. * @return A top-level attribute group definition or null if * such a definition does not exist. */ public XSAttributeGroupDefinition getAttributeGroup(String name, String namespace) { return null; } /** * Convenience method. Returns a top-level model group definition. * @param name The name of the definition. * @param namespace The namespace of the definition, otherwise * null. * @return A top-level model group definition or null if * such a definition does not exist. */ public XSModelGroupDefinition getModelGroupDefinition(String name, String namespace) { return null; } /** * Convenience method. Returns a top-level notation declaration. * @param name The name of the declaration. * @param namespace The namespace of the declaration, otherwise * null. * @return A top-level notation declaration or null if such * a declaration does not exist. */ public XSNotationDeclaration getNotationDeclaration(String name, String namespace) { return null; } public void addXSAnnotation(XSAnnotation xa) { String ns = xa.getNamespace(); if (ns == null && nsimap.keySet().size() == 1) { ns = nsimap.keySet().iterator().next(); } if (ns != null) { createNamespaceItemIfNotExistent(ns); JBossXSNamespaceItem jbnm = nsimap.get(ns); jbnm.addXSAnnotation(xa); } else { log.trace("Cannot assign XSAnnotation to null namespace"); } } public void addXSAttributeDeclaration(XSAttributeDeclaration attr) { //Add attribute to the namespace item String ns = attr.getNamespace(); JBossXSNamespaceItem jbnm = createNamespaceItemIfNotExistent(ns); jbnm.addXSAttributeDeclaration(attr); } public void addXSTypeDefinition(XSTypeDefinition xst) { //Add type to the namespace item String ns = xst.getNamespace(); if (ns == null) throw new WSException("Illegal namespace:null"); JBossXSNamespaceItem jbnm = createNamespaceItemIfNotExistent(ns); jbnm.addXSTypeDefinition(xst); anonymousMapper.rebuild(); } public void addXSComplexTypeDefinition(XSTypeDefinition xst) { this.addXSTypeDefinition(xst); anonymousMapper.rebuild(); } public void addXSElementDeclaration(XSElementDeclaration xsel) { //Add element to the namespace item String ns = xsel.getNamespace(); JBossXSNamespaceItem jbnm = createNamespaceItemIfNotExistent(ns); jbnm.addXSElementDeclaration(xsel); anonymousMapper.rebuild(); } public void addSchemaLocation(String nsURI, URL locationURL) { JBossXSNamespaceItem ni = createNamespaceItemIfNotExistent(nsURI); ni.addDocumentLocation(locationURL.toExternalForm()); } public void addXSNamespaceItem(XSNamespaceItem xsitem) { ((JBossXSNamespaceItemList)nslist).addItem(xsitem); anonymousMapper.rebuild(); } public void setXSNamespaceItemList(XSNamespaceItemList list) { this.nslist = list; } public void merge(JBossXSModel xsm) { JBossXSNamespaceItemList jxsm = (JBossXSNamespaceItemList)xsm.getNamespaceItems(); int len = jxsm.getLength(); for (int i = 0; i < len; i++) { JBossXSNamespaceItem ni = (JBossXSNamespaceItem)jxsm.item(i); String sns = ni.getSchemaNamespace(); JBossXSNamespaceItem mynsi = nsimap.get(sns); if (mynsi != null) mynsi.merge(ni); else { //add the namespaceitem nsimap.put(sns, ni); ni.setNamespaceRegistry(namespaceRegistry); } } NamespaceRegistry xsmRegistry = xsm.getNamespaceRegistry(); Iterator iter = xsmRegistry.getRegisteredPrefixes(); while (iter.hasNext()) { String prefix = (String)iter.next(); String ns = xsmRegistry.getNamespaceURI(prefix); this.namespaceRegistry.registerURI(ns, prefix); } anonymousMapper.rebuild(); } public void removeXSTypeDefinition(XSTypeDefinition xst) { String ns = xst.getNamespace(); JBossXSNamespaceItem ni = nsimap.get(ns); ni.removeXSTypeDefinition(xst); anonymousMapper.rebuild(); } /** * Given a namespaceuri, return the NamespaceItem that represents it * @param nsuri Namespace URI * @return JBossXSNamespaceItem */ public JBossXSNamespaceItem getNamespaceItem(String nsuri) { return nsimap.get(nsuri); } public void writeTo(OutputStream out) throws IOException { out.write(serialize().getBytes()); } public String serialize() { StringBuilder sb = serializeNamespaceItems(); /** * Since the serialized string can contain multiple schema * definitions, we have to embed in a root element before * parsing for layout */ sb.insert(0, ""); sb.append(""); // Layout schema String xsModelString = sb.toString(); if (xsModelString.length() > 0) { try { Element root = DOMUtils.parse(xsModelString); //xsModelString = DOMWriter.printNode(root, true); xsModelString = this.getChildNodesSerialized(root); } catch (IOException e) { log.error("Cannot parse xsModelString: " + xsModelString, e); } } return xsModelString; } public Map getAnonymousTypes() { return anonymousMapper.getTypes(); } public Map getAnonymousElements() { return anonymousMapper.getElements(); } public boolean isQualifiedElements() { return qualifiedElements; } public void setQualifiedElements(boolean qualifiedElements) { this.qualifiedElements = qualifiedElements; for (JBossXSNamespaceItem item : nsimap.values()) item.setQualifiedElements(qualifiedElements); } public NamespaceRegistry getNamespaceRegistry() { return namespaceRegistry; } public void eagerInitialize() { anonymousMapper.build(); } private String registerNamespace(String ns) { String prefix = namespaceRegistry.getPrefix(ns); if (prefix != null) return prefix; // XML Namespace MUST ALWAYS BE the "xml" prefix if (Constants.NS_XML.equals(ns)) prefix = Constants.PREFIX_XML; return namespaceRegistry.registerURI(ns, prefix); } private JBossXSNamespaceItem createNamespaceItemIfNotExistent(String ns) { if (ns == null) throw new IllegalArgumentException("Illegal null argument:ns"); JBossXSNamespaceItem jbnm = nsimap.get(ns); if (jbnm == null) { jbnm = new JBossXSNamespaceItem(ns, namespaceRegistry, qualifiedElements); nsimap.put(ns, jbnm); registerNamespace(ns); } return jbnm; } private StringBuilder serializeNamespaceItems() { StringBuilder sb = new StringBuilder(); //Write a schema definition for each namespaceitem that is custom Collection col = nsimap.values(); for (JBossXSNamespaceItem i : col) { String nameS = i.getSchemaNamespace(); if (Constants.NS_SCHEMA_XSD.equals(nameS) || Constants.URI_SOAP11_ENC.equals(nameS)) continue; sb.append(i.toString()); } return sb; } private String getChildNodesSerialized(Element root) { StringBuilder sb = new StringBuilder(); Iterator iter = DOMUtils.getChildElements(root); while (iter != null && iter.hasNext()) { Node n = (Node)iter.next(); sb.append(DOMWriter.printNode(n, true)); sb.append("\n"); } return sb.toString(); } private class AnonymousMapper implements Serializable { private static final long serialVersionUID = 5572350092914194023L; private HashMap anonymousTypeMap; private HashMap anonymousElementMap; // not really a stack, but it does contain items on the stack private HashSet stack = new HashSet(); /** * Triggers a rebuild of anonymous types only if a build has occured before. */ public void rebuild() { if (anonymousTypeMap != null) build(); } /** * Builds the anonymous type mapping. This is intended to be called lazily. */ public void build() { XSModel model = JBossXSModel.this; anonymousTypeMap = new HashMap(); anonymousElementMap = new HashMap(); XSNamedMap namedMap = model.getComponents(XSConstants.TYPE_DEFINITION); for (int i = 0; i < namedMap.getLength(); i++) { XSTypeDefinition type = (XSTypeDefinition)namedMap.item(i); if (type.getTypeCategory() != XSTypeDefinition.COMPLEX_TYPE) continue; analyzeComplexType((XSComplexTypeDefinition)type, null, type.getNamespace()); } namedMap = model.getComponents(XSConstants.ELEMENT_DECLARATION); for (int i = 0; i < namedMap.getLength(); i++) { XSElementDeclaration element = (XSElementDeclaration)namedMap.item(i); analyzeElement(element, null, element.getNamespace(), null, null); } } private void analyzeElement(XSElementDeclaration element, String parentName, String namespace, Integer minOccurs, Integer maxOccurs) { String name = element.getName(); if (element.getScope() != XSConstants.SCOPE_GLOBAL) { name = parentName + ">" + name; anonymousElementMap.put(namespace + ":" + name, element); } if (maxOccurs != null && maxOccurs.intValue() > 1) { String key = namespace + ":" + name + "[" + minOccurs.intValue() + "," + maxOccurs.intValue() + "]"; anonymousTypeMap.put(key, createArrayWrapperComplexType(element, name, namespace, minOccurs, maxOccurs)); if (minOccurs.intValue() == 1) { key = namespace + ":" + name + "[" + "," + maxOccurs.intValue() + "]"; anonymousTypeMap.put(key, createArrayWrapperComplexType(element, name, namespace, minOccurs, maxOccurs)); } } XSTypeDefinition type = element.getTypeDefinition(); if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) analyzeComplexType((XSComplexTypeDefinition)type, name, namespace); if (type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) analyzeSimpleType((XSSimpleTypeDefinition)type, name, namespace); } private XSComplexTypeDefinition createArrayWrapperComplexType(XSElementDeclaration element, String name, String namespace, Integer minOccurs, Integer maxOccurs) { JBossXSComplexTypeDefinition definition = new JBossXSComplexTypeDefinition(name, namespace); definition.setAnonymous(true); JBossXSModelGroup group = new JBossXSModelGroup(); group.setCompositor(XSModelGroup.COMPOSITOR_SEQUENCE); List particles = new ArrayList(1); JBossXSParticle particle = new JBossXSParticle(); particle.setMaxOccurs(maxOccurs); particle.setMinOccurs(minOccurs); particle.setTerm(element); particles.add(particle); group.setParticles(particles); particle = new JBossXSParticle(); particle.setTerm(group); definition.setParticle(particle); return definition; } private String analyzeType(XSTypeDefinition type, String parentName, String namespace) { String name; if (type.getAnonymous()) name = ">" + parentName; else name = type.getName(); if (type.getAnonymous()) { anonymousTypeMap.put(namespace + ":" + name, type); if(log.isDebugEnabled()) log.debug("Registered as anon type: {" + namespace + ":" + name + "} -> " + type); } return name; } private void analyzeSimpleType(XSSimpleTypeDefinition simpleType, String parentName, String namespace) { analyzeType(simpleType, parentName, namespace); } private void analyzeComplexType(XSComplexTypeDefinition complexType, String parentName, String namespace) { // Prevent reentrancy if (stack.contains(complexType)) return; stack.add(complexType); String name = analyzeType(complexType, parentName, namespace); analyzeParticle(complexType.getParticle(), name, namespace); stack.remove(complexType); } private void analyzeParticle(XSParticle particle, String parentName, String namespace) { // Is this right, can a particle be null? if (particle == null) return; XSTerm term = particle.getTerm(); // Is this right, can a term be null? if (term == null) return; switch (term.getType()) { case XSConstants.MODEL_GROUP: XSModelGroup group = (XSModelGroup)term; XSObjectList list = group.getParticles(); for (int i = 0; i < list.getLength(); i++) analyzeParticle((XSParticle)list.item(i), parentName, namespace); break; case XSConstants.ELEMENT_DECLARATION: XSElementDeclaration decl = (XSElementDeclaration)term; analyzeElement(decl, parentName, namespace, new Integer(particle.getMinOccurs()), new Integer(particle.getMaxOccurs())); } } public XSTypeDefinition getTypeDefinition(String name, String namespace) { // We lazily build this, after the first anonymous type name lookup if (anonymousTypeMap == null) build(); return anonymousTypeMap.get(namespace + ":" + name); } public XSElementDeclaration getElementDeclaration(String name, String namespace) { // We lazily build this, after the first anonymous type name lookup if (anonymousElementMap == null) build(); return anonymousElementMap.get(namespace + ":" + name); } public Map getElements() { if (anonymousElementMap == null) build(); // avoid the copy, trust the client return anonymousElementMap; } public Map getTypes() { if (anonymousTypeMap == null) build(); // avoid the copy, trust the client return anonymousTypeMap; } } public XSObjectList getSubstitutionGroup(XSElementDeclaration arg0) { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItem.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000003667510542776150031521 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeSet; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSAnnotation; import org.apache.xerces.xs.XSAttributeDeclaration; import org.apache.xerces.xs.XSAttributeGroupDefinition; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModelGroupDefinition; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSNamespaceItem; import org.apache.xerces.xs.XSNotationDeclaration; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.xb.binding.NamespaceRegistry; /** * Xerces Schema API Implementation * @author Anil Saldhana * @since Apr 20, 2005 */ public class JBossXSNamespaceItem implements XSNamespaceItem { // provide logging private static final Logger log = Logger.getLogger(JBossXSNamespaceItem.class); private String schemaNamespace = null; private List docLocations = null; private Map anns = new HashMap(); private Map attrs = new HashMap(); private Map elements = new HashMap(); private Map types = new HashMap(); private boolean qualifiedElements = false; private NamespaceRegistry namespaceRegistry; public JBossXSNamespaceItem(String ns, NamespaceRegistry namespaceRegistry, boolean qualifiedElements) { this.schemaNamespace = ns; this.namespaceRegistry = namespaceRegistry; this.qualifiedElements = qualifiedElements; } /** * [schema namespace]: A namespace name or null if absent. */ public String getSchemaNamespace() { return schemaNamespace; } /** * [schema components]: a list of top-level components, i.e. element * declarations, attribute declarations, etc. * @param objectType The type of the declaration, i.e. * ELEMENT_DECLARATION. Note that * XSTypeDefinition.SIMPLE_TYPE and * XSTypeDefinition.COMPLEX_TYPE can also be used as the * objectType to retrieve only complex types or simple * types, instead of all types. * @return A list of top-level definition of the specified type in * objectType or an empty XSNamedMap if no * such definitions exist. */ public XSNamedMap getComponents(short objectType) { JBossXSNamedMap jbnm = new JBossXSNamedMap(); if(objectType == XSConstants.ELEMENT_DECLARATION && elements.size() > 0) jbnm.addItems(elements.values()); else { if(objectType == XSConstants.ATTRIBUTE_DECLARATION && attrs.size() > 0) { jbnm.addItems(attrs.values()); } else if(objectType == XSConstants.TYPE_DEFINITION && types.size() > 0) { jbnm.addItems(types.values()); } else if(objectType == XSTypeDefinition.COMPLEX_TYPE) { Collection col = types.values(); jbnm.addItems(getTypes(col,XSTypeDefinition.COMPLEX_TYPE)); } else if(objectType == XSTypeDefinition.SIMPLE_TYPE) { Collection col = types.values(); jbnm.addItems(getTypes(col,XSTypeDefinition.SIMPLE_TYPE)); } } return jbnm; } /** * [annotations]: a set of annotations if it exists, otherwise an empty * XSObjectList. */ public XSObjectList getAnnotations() { List lst = new ArrayList(); lst.addAll(anns.values()); return new JBossXSObjectList(lst); } /** * Convenience method. Returns a top-level element declaration. * @param name The name of the declaration. * @return A top-level element declaration or null if such a * declaration does not exist. */ public XSElementDeclaration getElementDeclaration(String name) { JBossXSElementDeclaration jbe = null; //Ensure we return JBossXSElementDeclaration if(elements != null) { XSElementDeclaration xe = elements.get(name); if(xe != null && !(xe instanceof JBossXSElementDeclaration)) jbe = new JBossXSElementDeclaration(xe); else return xe; } return jbe; } /** * Convenience method. Returns a top-level attribute declaration. * @param name The name of the declaration. * @return A top-level attribute declaration or null if such * a declaration does not exist. */ public XSAttributeDeclaration getAttributeDeclaration(String name) { if(attrs != null) return attrs.get(name); return null; } /** * Convenience method. Returns a top-level simple or complex type * definition. * @param name The name of the definition. * @return An XSTypeDefinition or null if such * a definition does not exist. */ public XSTypeDefinition getTypeDefinition(String name) { if(types != null) return types.get(name); return null; } /** * Convenience method. Returns a top-level attribute group definition. * @param name The name of the definition. * @return A top-level attribute group definition or null if * such a definition does not exist. */ public XSAttributeGroupDefinition getAttributeGroup(String name) { return null; } /** * Convenience method. Returns a top-level model group definition. * @param name The name of the definition. * @return A top-level model group definition definition or * null if such a definition does not exist. */ public XSModelGroupDefinition getModelGroupDefinition(String name) { return null; } /** * Convenience method. Returns a top-level notation declaration. * @param name The name of the declaration. * @return A top-level notation declaration or null if such * a declaration does not exist. */ public XSNotationDeclaration getNotationDeclaration(String name) { return null; } /** * [document location] - a list of location URIs for the documents that * contributed to the XSModel. */ public StringList getDocumentLocations() { if(docLocations == null) return new JBossXSStringList(); JBossXSStringList strList = new JBossXSStringList(docLocations); return strList; } //Setters //Custom methods public void addDocumentLocation(String uri) { if(docLocations == null) docLocations = new ArrayList(); docLocations.add(uri); } public void addDocumentLocations(List uri) { if(docLocations == null) docLocations = new ArrayList(); docLocations.addAll(uri); } /** * Add an XSAnnotation */ public void addXSAnnotation(XSAnnotation xa) { if(xa == null) throw new IllegalArgumentException("Illegal Null Argument:xa"); anns.put(xa.getName(),xa); } /** * Add an XSAttributeDeclaration */ public void addXSAttributeDeclaration(XSAttributeDeclaration att) { if(att == null) throw new IllegalArgumentException("att is null"); attrs.put(att.getName(),att); } /** * Add an XSElementDeclaration * @param el */ public void addXSElementDeclaration(XSElementDeclaration el) { if(el == null) throw new IllegalArgumentException("Element is null"); elements.put(el.getName(),el); } /** * Add an XSTypeDefinition * @param xsType */ public void addXSTypeDefinition(XSTypeDefinition xsType) { if(xsType == null) throw new IllegalArgumentException("type is null"); String xsTypeName = xsType.getName(); log.trace("addXSTypeDefinition: " + xsTypeName); types.put(xsTypeName,xsType); } /** * Overrides the toString method */ @Override public String toString() { /* * FIXME - The SOAP Encoding namespace handling should be revisited. This * routine should really operate purely off of the registry, instead of * printing constant declarations, and having to double check that the * registry does not contain them. * * This order is currently maintained to preserve the format of the * generated schema files in the test harness. */ if(isEmpty()) return ""; WSSchemaUtils sutils = WSSchemaUtils.getInstance(namespaceRegistry, schemaNamespace); StringBuilder buffer = new StringBuilder(); buffer.append( ""); //Write the import namespaces iter = namespaceRegistry.getRegisteredURIs(); while (iter.hasNext()) { String ns = (String) iter.next(); if (ns.equals(schemaNamespace)) continue; if (ns.equals(Constants.URI_SOAP11_ENC)) continue; if (ns.equals(Constants.NS_SCHEMA_XSI)) continue; buffer.append(""); } //Sort the types //TreeSet treeset = new TreeSet(types.keySet()); TreeSet treeset = new TreeSet(new XSComparator()); treeset.addAll(types.keySet()); for(String key: treeset) { buffer.append(sutils.write(types.get(key))); } // Serialize the elements //treeset = new TreeSet(elements.keySet()); treeset = new TreeSet(new XSComparator()); treeset.addAll(elements.keySet()); for( String key: treeset) { buffer.append(sutils.write(elements.get(key) )); } buffer.append(""); return buffer.toString(); } public void merge(JBossXSNamespaceItem nsi) { //Merge the attributes JBossXSNamedMap nmap = (JBossXSNamedMap)nsi.getComponents(XSConstants.ATTRIBUTE_DECLARATION); int len = nmap.getLength(); for(int i=0;i 0) return false; if(types.size() > 0 ) return false; if(elements.size()>0) return false; return bool; } private class XSComparator implements Comparator { public int compare(Object arg0, Object arg1) { String str1 = (String)arg0; String str2 = (String)arg1; if(Character.isUpperCase(str1.charAt(0)) && Character.isLowerCase(str2.charAt(0)) ) return 1; return str1.compareTo(str2); } } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObjectList.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000000553710542776150031512 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.util.ArrayList; import java.util.List; import org.apache.xerces.xs.XSObject; import org.apache.xerces.xs.XSObjectList; /** * Xerces Schema API * @author Anil Saldhana * @since Apr 20, 2005 */ public class JBossXSObjectList implements XSObjectList { protected List list = new ArrayList(); public JBossXSObjectList() { } public JBossXSObjectList(List lst) { this.list = lst; } /** * The number of XSObjects in the list. The range of valid * child object indices is 0 to length-1 inclusive. */ public int getLength() { int len = list.size(); return len; } /** * Returns the indexth item in the collection or * null if index is greater than or equal to * the number of objects in the list. The index starts at 0. * @param index index into the collection. * @return The XSObject at the indexth * position in the XSObjectList, or null if * the index specified is not valid. */ public XSObject item(int index) { return (XSObject)list.get(index); } public void addItem(XSObject xsobj) { list.add(xsobj); } public void addItem(XSObject xsobj, boolean shouldSort) { if(shouldSort) addItem(xsobj); else list.add(xsobj); } //CUSTOM METHODS public void addObjects(XSObjectList lst) { if(lst instanceof JBossXSObjectList) list.addAll(((JBossXSObjectList)lst).toList()); else { int len = lst != null ? lst.getLength() : 0 ; for(int i=0; i < len; i++) { list.add(lst.item(i)); } } } public List toList() { return list; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSParticle.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000000727710566046204031511 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSTerm; import org.jboss.util.NotImplementedException; /** * @author Anil Saldhana * @since Apr 21, 2005 */ public class JBossXSParticle extends JBossXSObject implements XSParticle, Comparable { protected int minOccurs = 0; protected int maxOccurs = 0; protected XSTerm term = null; public JBossXSParticle() { } public JBossXSParticle(String name, String namespace) { super(name, namespace); } /** * [min occurs]: determines the minimum number of terms that can occur. */ public int getMinOccurs() { return minOccurs; } /** * [max occurs]: determines the maximum number of terms that can occur. * To query for the value of unbounded use * maxOccursUnbounded. When the value of * maxOccursUnbounded is true, the value of * maxOccurs is unspecified. */ public int getMaxOccurs() { return maxOccurs; } /** * [max occurs]: whether the maxOccurs value is unbounded. */ public boolean getMaxOccursUnbounded() { return (maxOccurs == -1); } /** * [term]: one of a model group, a wildcard, or an element declaration. */ public XSTerm getTerm() { return term; } /** * Get the type */ @Override public short getType() { return XSConstants.PARTICLE; } public void setMinOccurs(int minOccurs) { this.minOccurs = minOccurs; } public void setMaxOccurs(int maxOccurs) { this.maxOccurs = maxOccurs; } public void setTerm(XSTerm term) { this.term = term; } /* (non-Javadoc) * @see java.lang.Comparable#compareTo(T) */ public int compareTo(Object o) { int c = -1; if (o instanceof JBossXSParticle) { JBossXSParticle w = (JBossXSParticle)o; String oname = w.getTerm().getName(); String termName = term.getName(); if (termName != null) c = termName.compareTo(oname); //In the case of doclit, need to be careful about String_1,SimpleType_2 if (termName != null) { char num1 = termName.charAt(termName.length() - 1); char num2 = oname.charAt(oname.length() - 1); if (Character.isDigit(num1) && Character.isDigit(num2)) c = ("" + num1).compareTo(("" + num2)); } } return c; } public XSObjectList getAnnotations() { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModelGroup.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000000603610566046204031501 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.util.Iterator; import java.util.List; import org.apache.xerces.xs.XSAnnotation; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSObjectList; import org.jboss.util.NotImplementedException; /** * Implements a ModelGroup of the Xerces Schema API * @author Anil Saldhana * @since Apr 21, 2005 */ public class JBossXSModelGroup extends JBossXSObject implements XSModelGroup { private JBossXSObjectList xsparts = new JBossXSObjectList();; protected short compositor = 0; /** * [compositor]: one of all, choice or sequence. The valid constant values * are: * COMPOSITOR_SEQUENCE, COMPOSITOR_CHOICE, COMPOSITOR_ALL. */ public short getCompositor() { return compositor; } /** * A list of [particles] if it exists, otherwise an empty * XSObjectList. */ public XSObjectList getParticles() { return xsparts; } /** * An [annotation] if it exists, otherwise null. */ public XSAnnotation getAnnotation() { return null; } public void setParticles(List p) { xsparts = new JBossXSObjectList(); Iterator iter = p.iterator(); while (iter.hasNext()) { xsparts.addItem((JBossXSParticle)iter.next()); } } public void setParticles(List p, boolean shouldSort) { xsparts = new JBossXSObjectList(); if (shouldSort) setParticles(p); else { Iterator iter = p.iterator(); while (iter.hasNext()) { xsparts.addItem((JBossXSParticle)iter.next(), false); } } } public void setCompositor(short compositor) { this.compositor = compositor; } /** * Get the type */ @Override public short getType() { return XSConstants.MODEL_GROUP; } public XSObjectList getAnnotations() { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSObject.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000000713410542776150031505 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import org.apache.xerces.xs.XSNamespaceItem; import org.apache.xerces.xs.XSObject; /** * @author Anil Saldhana * @since Apr 20, 2005 */ public class JBossXSObject implements XSObject { protected String name; protected String namespace; private String prefix; private XSNamespaceItem xsNSItem; private short type; public JBossXSObject() { } public JBossXSObject(String name, String namespace) { this.name = name; this.namespace = namespace; } /** * The type of this object, i.e. * ELEMENT_DECLARATION. */ public short getType() { return type; } /** * The name of type NCName, as defined in XML Namespaces, of * this declaration specified in the {name} property of the * component or null if the definition of this component * does not have a {name} property. For anonymous types, * the processor must construct and expose an anonymous type name that * is distinct from the name of every named type and the name of every * other anonymous type. */ public String getName() { return name; } public void setName(String n) { name = n; } /** * The [target namespace] of this object, or null if it is * unspecified. */ public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } /** * A namespace schema information item corresponding to the target * namespace of the component, if it is globally declared; or * null otherwise. */ public XSNamespaceItem getNamespaceItem() { return xsNSItem; } public void setNamespaceItem(XSNamespaceItem xsNSItem) { this.xsNSItem = xsNSItem; } public void setType(short t) { type = t; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof JBossXSObject)) return false; final JBossXSObject jBossXSObject = (JBossXSObject)o; if (name != null ? !name.equals(jBossXSObject.name) : jBossXSObject.name != null) return false; if (namespace != null ? !namespace.equals(jBossXSObject.namespace) : jBossXSObject.namespace != null) return false; return true; } public int hashCode() { int result; result = (name != null ? name.hashCode() : 0); result = 29 * result + (namespace != null ? namespace.hashCode() : 0); return result; } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamespaceItemList.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000000504010542776150031477 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.xerces.xs.XSNamespaceItem; import org.apache.xerces.xs.XSNamespaceItemList; /** * * * @author Anil Saldhana * @since Apr 20, 2005 */ public class JBossXSNamespaceItemList implements XSNamespaceItemList { protected List xsnsList = new ArrayList(); public JBossXSNamespaceItemList() { super(); } public JBossXSNamespaceItemList(List list) { super(); xsnsList = list; } public JBossXSNamespaceItemList(Collection col) { super(); xsnsList.addAll(col); } /** * The number of XSNamespaceItems in the list. The range of * valid child object indices is 0 to length-1 inclusive. */ public int getLength() { return xsnsList.size(); } /** * Returns the indexth item in the collection or * null if index is greater than or equal to * the number of objects in the list. The index starts at 0. * @param index index into the collection. * @return The XSNamespaceItem at the indexth * position in the XSNamespaceItemList, or * null if the index specified is not valid. */ public XSNamespaceItem item(int index) { return (XSNamespaceItem)xsnsList.get(index); } public void addItem(XSNamespaceItem item) { xsnsList.add(item); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/WSSchemaUtils.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/WSSc0000644000175000017500000006225110650145103031454 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.io.IOException; import java.io.Writer; import java.util.Arrays; import java.util.List; import javax.xml.namespace.QName; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSAnnotation; import org.apache.xerces.xs.XSAttributeDeclaration; import org.apache.xerces.xs.XSAttributeUse; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSNamespaceItem; import org.apache.xerces.xs.XSNamespaceItemList; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.wsf.common.DOMWriter; import org.jboss.xb.binding.NamespaceRegistry; /** * Singleton class that works on the JBoss version of XSModel * @author Anil Saldhana * @since Jun 3, 2005 */ public class WSSchemaUtils { private static final String xsNS = Constants.NS_SCHEMA_XSD; private static SchemaUtils utils = SchemaUtils.getInstance(); private NamespaceRegistry namespaceRegistry; private String targetNamespace = null; public static WSSchemaUtils getInstance(NamespaceRegistry namespaceRegistry, String targetNamespace) { return new WSSchemaUtils(namespaceRegistry, targetNamespace); } private WSSchemaUtils(NamespaceRegistry namespaceRegistry, String targetNamespace) { this.namespaceRegistry = namespaceRegistry; this.targetNamespace = targetNamespace; } /** * Checks whether given a targetNS and other regular schema namespaces, * the passed "checkNS" is a custom namespace * @param targetNS Target Namespace of the schema * @param checkNS Namespace that needs to be checked if its a custom namespace * @return true - if checkNS is a custom namespace, false - otherwise */ public boolean checkCustomNamespace(String targetNS, String checkNS) { String[] nsarr = new String[] { xsNS, Constants.NS_SCHEMA_XSI }; List knownNamespaces = Arrays.asList(nsarr); boolean isCustom = false; if (xsNS.equals(targetNS)) throw new IllegalArgumentException("targetNamespace cannot be " + xsNS); if (checkNS == null) throw new IllegalArgumentException("checkNS is null"); if (knownNamespaces.contains(checkNS) == false && targetNS.equals(checkNS) == false) isCustom = true; return isCustom; } /** * Create a global XSElementDeclaration object * @param name * @param xstype * @param targetNS * @return */ public JBossXSElementDeclaration createGlobalXSElementDeclaration(String name, XSTypeDefinition xstype, String targetNS) { JBossXSElementDeclaration xsel = new JBossXSElementDeclaration(); xsel.setName(name); xsel.setTypeDefinition(xstype); xsel.setTargetNamespace(targetNS); xsel.setNamespace(targetNS); xsel.setScope(XSConstants.SCOPE_GLOBAL); return xsel; } /** * Generate a Schema Model for a namespace * @return */ public JBossXSModel createXSModel() { return new JBossXSModel(); } public JBossXSComplexTypeDefinition createXSComplexTypeDefinition(String name, XSTypeDefinition baseType, List xsparts, String typens) { //No complex type if particles are null if (xsparts == null) return null; JBossXSComplexTypeDefinition ct = new JBossXSComplexTypeDefinition(); ct.setName(name); ct.setNamespace(typens); JBossXSModelGroup group = new JBossXSModelGroup(); group.setCompositor(XSModelGroup.COMPOSITOR_SEQUENCE); group.setParticles(xsparts); // Plug the particle array into the modelgroup JBossXSParticle xspa = new JBossXSParticle(null, typens); xspa.setTerm(group); ((JBossXSComplexTypeDefinition)ct).setParticle(xspa); if (baseType != null) { ((JBossXSComplexTypeDefinition)ct).setDerivationMethod(XSConstants.DERIVATION_EXTENSION); ((JBossXSComplexTypeDefinition)ct).setBaseType(baseType); } return ct; } /** * Create a local XSElementDeclaration object * @param name * @param xstype * @param targetNS * @param isNillable * @return */ public JBossXSElementDeclaration createXSElementDeclaration(String name, XSTypeDefinition xstype, boolean isNillable) { JBossXSElementDeclaration xsel = new JBossXSElementDeclaration(); xsel.setName(name); xsel.setTypeDefinition(xstype); xsel.setNillable(isNillable); return xsel; } public JBossXSParticle createXSParticle(String targetNS, boolean isArray, XSTerm xsterm) { JBossXSParticle xsp = new JBossXSParticle(null, targetNS); if (isArray) xsp.setMaxOccurs(-1); xsp.setTerm(xsterm); return xsp; } /** * Creates a XSTypeDefinition object given a QName * * @param qname * @return a XSTypeDefinition */ public JBossXSTypeDefinition createXSTypeDefinition(QName qname) { JBossXSTypeDefinition jbxs = new JBossXSTypeDefinition(); jbxs.setName(qname.getLocalPart()); jbxs.setNamespace(qname.getNamespaceURI()); return jbxs; } /** * Generate a complex type for a custom exception * @param exname * @param ns * @return */ public XSComplexTypeDefinition getExceptionType(String exname, String ns) { JBossXSParticle xsp = new JBossXSParticle(); /*xsp.setType(XSConstants.ELEMENT_DECLARATION); xsp.setMaxOccurs(-1); JBossXSElementDeclaration xsel = (JBossXSElementDeclaration)createXSElementDeclaration("name", utils.getSchemaBasicType("string"), true); xsp.setTerm(xsel); */ XSComplexTypeDefinition ct = new JBossXSComplexTypeDefinition(exname, ns); ((JBossXSComplexTypeDefinition)ct).setParticle(xsp); return ct; } /** * Convert the read-only Xerces implementation of XSModel * into JBossXSModel. * If the input is JBossXSModel, it will be returned back. * @param xsmodel XSModel object * @return JBossXSModel (RW Model) */ public JBossXSModel getJBossXSModel(XSModel xsmodel) { if (xsmodel instanceof JBossXSModel) return (JBossXSModel)xsmodel; JBossXSModel jbxs = new JBossXSModel(); copyXSModel(xsmodel, jbxs); return jbxs; } /** * Checks if the XSModel is empty given a namespace * @param xsmodel Schema Model to check * @param namespace namespace to check components for * @return true (if empty) and false (if not empty) */ public boolean isEmptySchema(JBossXSModel xsmodel, String namespace) { if (xsmodel == null) return true; if (namespace == null) throw new WSException("Target Namespace of xsmodel is null"); XSNamedMap tmap = xsmodel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION, namespace); XSNamedMap emap = xsmodel.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION, namespace); if (tmap != null && tmap.getLength() > 0) return false; if (emap != null && emap.getLength() > 0) return false; return true; } /** * Serialize the SchemaModel into a Writer * @param xsmodel Schema Model which needs to be serialized * @param writer a Writer to which serialization should happen * @throws IOException */ public void serialize(XSModel xsmodel, Writer writer) throws IOException { StringBuilder buffer = new StringBuilder(); if (xsmodel instanceof JBossXSModel) { String str = ((JBossXSModel)xsmodel).serialize(); buffer.append(str); } else { buffer.append(""); } writer.write(buffer.toString()); } /** * Serialize the SchemaModel (with no types and elements) into a Writer * @param xsmodel Schema Model which needs to be serialized * @param writer a Writer to which serialization should happen * @throws IOException */ public void serializeEmptySchema(XSModel xsmodel, Writer writer) throws IOException { StringBuilder buffer = new StringBuilder(); buffer.append(""); writer.write(buffer.toString()); } /** * Return a string for the element declaration * @param xsel * @param xsp * @return */ public String write(XSElementDeclaration xsel, XSParticle xsp) { XSTypeDefinition xst = xsel.getTypeDefinition(); if (xst == null) throw new IllegalStateException("Type xst is null"); boolean isGlobalRef = (xsel.getScope() == XSConstants.SCOPE_GLOBAL); boolean isAnonType = xst.getAnonymous(); StringBuilder buf = new StringBuilder(); String elname = xsel.getName(); String prefix = null; if (isGlobalRef) { String namespace = xsel.getNamespace(); prefix = getPrefix(namespace); buf.append(""); else buf.append(">").append(write(xst)).append(""); return buf.toString(); } public String write(XSAttributeDeclaration decl) { XSTypeDefinition xst = decl.getTypeDefinition(); if (xst == null) throw new IllegalStateException("Type xst is null"); boolean isGlobalRef = (decl.getScope() == XSConstants.SCOPE_GLOBAL); boolean isAnonType = xst.getAnonymous(); StringBuilder buf = new StringBuilder(); String name = decl.getName(); String prefix = null; if (isGlobalRef) { String namespace = decl.getNamespace(); prefix = getPrefix(namespace); buf.append(""); else buf.append(">").append(write(xst)).append(""); return buf.toString(); } /** * Return a string for the global element declaration * @param xsel * @param xsp * @return */ public String write(XSElementDeclaration xsel) { boolean isAnonType = false; if (XSConstants.SCOPE_GLOBAL != xsel.getScope()) throw new IllegalArgumentException("Element is not a global element"); StringBuilder buf = new StringBuilder(); String elname = xsel.getName(); XSTypeDefinition xst = xsel.getTypeDefinition(); isAnonType = xst.getAnonymous(); String typename = xst.getName(); String namespace = xst.getNamespace(); String prefix = null; if (!Constants.NS_SCHEMA_XSD.equals(namespace)) { prefix = getPrefix(namespace); typename = prefix + ":" + typename; } buf.append("").append(write(xst)); if (xsel.getNillable() && xsel.getScope() != XSConstants.SCOPE_GLOBAL) buf.append(" nillable='true' "); if (!isAnonType) buf.append("/>"); else buf.append(""); return buf.toString(); } /** * Return a string for the xs model group * @param xstype * @return */ public String write(XSModelGroup xsm) { StringBuilder buf = new StringBuilder(); XSObjectList objlist = xsm.getParticles(); int lenobj = objlist != null ? objlist.getLength() : 0; for (int i = 0; i < lenobj; i++) { XSParticle jxsp = (XSParticle)objlist.item(i); XSTerm xterm = jxsp.getTerm(); short termType = xterm.getType(); if (termType == XSConstants.ELEMENT_DECLARATION) { XSElementDeclaration xsel = (XSElementDeclaration)jxsp.getTerm(); buf.append(this.write(xsel, jxsp)); } else if (termType == XSConstants.MODEL_GROUP) { XSObjectList olist = ((XSModelGroup)xterm).getParticles(); int lobj = olist != null ? olist.getLength() : 0; for (int k = 0; k < lobj; k++) { XSParticle jxp = (XSParticle)olist.item(k); XSTerm xsterm = jxp.getTerm(); termType = xsterm.getType(); if (termType == XSConstants.ELEMENT_DECLARATION) buf.append(write((XSElementDeclaration)xsterm, jxsp)); else if (termType == XSConstants.MODEL_GROUP && k > 0) buf.append(write((XSModelGroup)xsterm)); } } } return buf.toString(); } /** * Return a string for the xs type * @param xstype * @return */ public String write(XSTypeDefinition xstype) { StringBuilder buf = new StringBuilder(); //Handle Complex Type if (xstype instanceof XSComplexTypeDefinition) { XSComplexTypeDefinition jxstype = (XSComplexTypeDefinition)xstype; String jxsTypeName = jxstype.getName(); boolean isSimple = jxstype.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE; if (xstype.getAnonymous()) buf.append(""); else buf.append(""); XSTypeDefinition xsbase = (XSTypeDefinition)jxstype.getBaseType(); String baseType = null; if (xsbase != null && !("anyType".equals(xsbase.getName()))) baseType = getPrefix(xsbase.getNamespace()) + ":" + xsbase.getName(); if (baseType != null) { buf.append((isSimple) ? "" : ""); buf.append(""); } XSParticle xsp = jxstype.getParticle(); if (xsp != null) appendComplexTypeDefinition(buf, jxstype); XSObjectList list = jxstype.getAttributeUses(); for (int i = 0; i < list.getLength(); i++) { XSAttributeUse use = (XSAttributeUse)list.item(i); XSAttributeDeclaration decl = use.getAttrDeclaration(); buf.append(write(decl)); } if (baseType != null) { buf.append(""); buf.append((isSimple) ? "" : ""); } buf.append(""); } else if (xstype instanceof XSSimpleTypeDefinition) { XSTypeDefinition xsbase = (XSTypeDefinition)xstype.getBaseType(); buf.append(""); if (xsbase != null && !"anyType".equals(xsbase.getName())) { String baseType = xsbase.getName(); String ns = xsbase.getNamespace(); if (!Constants.NS_SCHEMA_XSD.equals(ns)) { String prefix = getPrefix(ns); baseType = prefix + ":" + baseType; } // currently only handle enumerations buf.append(""); StringList list = ((XSSimpleTypeDefinition)xstype).getLexicalEnumeration(); for (int i = 0; i < list.getLength(); i++) { String listItem = DOMWriter.normalize(list.item(i), false); buf.append(""); } buf.append(""); } buf.append(""); } return buf.toString(); } // Private methods private void appendSchemaDefinitions(StringBuilder buffer, XSNamespaceItemList itemlist) { int len = itemlist != null ? itemlist.getLength() : 0; for (int i = 0; i < len; i++) { XSNamespaceItem nsitem = (XSNamespaceItem)itemlist.item(i); String ns = nsitem.getSchemaNamespace(); //Ignore the one for xsd if (Constants.NS_SCHEMA_XSD.equals(ns)) continue; buffer.append(utils.getSchemaDefinitions(ns)); } //end for } private void appendComplexTypeDefinition(StringBuilder buf, XSComplexTypeDefinition jxstype) { XSParticle xsp = jxstype.getParticle(); XSTerm xsterm = xsp.getTerm(); short deriveMethod = jxstype.getDerivationMethod(); if (xsterm instanceof XSElementDeclaration) { // FIXME This is horribly wrong, but too much depends on this broken behavior buf.append(""); XSElementDeclaration xsel = (XSElementDeclaration)xsterm; buf.append(this.write(xsel, xsp)); buf.append(""); } else if (xsterm instanceof XSModelGroup) { XSModelGroup jmg = (XSModelGroup)xsterm; XSObjectList objlist = jmg.getParticles(); String end = null; switch (jmg.getCompositor()) { case XSModelGroup.COMPOSITOR_ALL: buf.append(""); end = ""; break; case XSModelGroup.COMPOSITOR_CHOICE: buf.append(""); end = ""; break; default: case XSModelGroup.COMPOSITOR_SEQUENCE: buf.append(""); end = ""; break; } int lenobj = objlist != null ? objlist.getLength() : 0; for (int i = 0; i < lenobj; i++) { XSParticle jxsp = (XSParticle)objlist.item(i); XSTerm xterm = jxsp.getTerm(); if (xterm instanceof XSElementDeclaration) { XSElementDeclaration xsel = (XSElementDeclaration)jxsp.getTerm(); buf.append(this.write(xsel, jxsp)); } else if (xterm instanceof XSModelGroup) { if (deriveMethod == XSConstants.DERIVATION_EXTENSION && i != lenobj - 1) continue; if (i == 0) continue;//Ignore as it provides the baseclass sequence of elements XSObjectList olist = ((XSModelGroup)xterm).getParticles(); int lobj = olist != null ? olist.getLength() : 0; for (int k = 0; k < lobj; k++) { XSParticle jxp = (XSParticle)olist.item(k); XSTerm jxpterm = jxp.getTerm(); short termType = jxpterm.getType(); if (termType == XSConstants.ELEMENT_DECLARATION) buf.append(write((XSElementDeclaration)jxpterm, jxsp)); else if (termType == XSConstants.MODEL_GROUP) buf.append(write((XSModelGroup)jxpterm)); } } } buf.append(end); } } private void appendTypes(StringBuilder buffer, XSModel xsmodel) { XSNamedMap xsmap = xsmodel.getComponents(XSConstants.TYPE_DEFINITION); int len = xsmap != null ? xsmap.getLength() : 0; for (int i = 0; i < len; i++) { XSTypeDefinition xstype = (XSTypeDefinition)xsmap.item(i); if (Constants.NS_SCHEMA_XSD.equals(xstype.getNamespace())) continue; buffer.append(this.write(xstype)); } } private void appendGlobalElements(StringBuilder buffer, XSModel xsmodel) { XSNamedMap xsmap = xsmodel.getComponents(XSConstants.ELEMENT_DECLARATION); int len = xsmap != null ? xsmap.getLength() : 0; for (int i = 0; i < len; i++) { XSElementDeclaration xsel = (XSElementDeclaration)xsmap.item(i); if (Constants.NS_SCHEMA_XSD.equals(xsel.getNamespace())) continue; buffer.append(this.write(xsel)); } } //Copy the Xerces implementation of XSModel into JBossXSModel public void copyXSModel(XSModel xsmodel, JBossXSModel jb) { if (xsmodel == null) throw new IllegalArgumentException("Illegal Null Argument:xsmodel"); if (jb == null) throw new IllegalArgumentException("Illegal Null Argument:jb"); //Copy all the Namespace Items jb.setXSNamespaceItemList(xsmodel.getNamespaceItems()); //Copy all the elements XSNamedMap xsmp = xsmodel.getComponents(XSConstants.ELEMENT_DECLARATION); int len = xsmp != null ? xsmp.getLength() : 0; for (int i = 0; i < len; i++) { XSElementDeclaration xsel = (XSElementDeclaration)xsmp.item(i); jb.addXSElementDeclaration(xsel); } //Copy all the types xsmp = xsmodel.getComponents(XSConstants.TYPE_DEFINITION); len = xsmp != null ? xsmp.getLength() : 0; for (int i = 0; i < len; i++) { XSTypeDefinition xstype = (XSTypeDefinition)xsmp.item(i); if (!this.xsNS.equals(xstype.getNamespace())) jb.addXSTypeDefinition(xstype); } //Copy all the attributes xsmp = xsmodel.getComponents(XSConstants.ATTRIBUTE_DECLARATION); len = xsmp != null ? xsmp.getLength() : 0; for (int i = 0; i < len; i++) { XSAttributeDeclaration xsattr = (XSAttributeDeclaration)xsmp.item(i); jb.addXSAttributeDeclaration(xsattr); } //copy all the global annotations //xsmp = xsmodel.getComponents(XSConstants.ANNOTATION); XSObjectList xo = xsmodel.getAnnotations(); len = xo != null ? xo.getLength() : 0; //len = xsmp != null ? xsmp.getLength() : 0; for (int i = 0; i < len; i++) { //XSAnnotation xa = (XSAnnotation)xsmp.item(i); XSAnnotation xa = (XSAnnotation)xo.item(i); jb.addXSAnnotation(xa); } } private String getPrefix(String namespace) { if (namespaceRegistry == null) throw new IllegalArgumentException("nameespaceRegistry can not be null!"); if (namespace == null) throw new IllegalArgumentException("namespace can not be null"); // XML Namespace can only legally be assigned the XML prefix if (namespace.equals(Constants.NS_XML)) return Constants.PREFIX_XML; if (namespace.equals(targetNamespace)) return Constants.PREFIX_TNS; if (namespace.equals(Constants.URI_SOAP11_ENC)) return Constants.PREFIX_SOAP11_ENC; if (namespace.equals(Constants.NS_SCHEMA_XSI)) return Constants.PREFIX_XSI; String prefix = namespaceRegistry.getPrefix(namespace); // Assume target namespace return (prefix == null) ? Constants.PREFIX_TNS : prefix; } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSNamedMap.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000000665110542776150031510 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSObject; /** * @author Anil Saldhana * @since Apr 20, 2005 */ public class JBossXSNamedMap implements XSNamedMap { protected List list = new ArrayList(); /** * The number of XSObjects in the XSObjectList. * The range of valid child object indices is 0 to length-1 * inclusive. */ public int getLength() { return list.size(); } /** * Returns the indexth item in the collection or * null if index is greater than or equal to * the number of objects in the list. The index starts at 0. * @param index index into the collection. * @return The XSObject at the indexth * position in the XSObjectList, or null if * the index specified is not valid. */ public XSObject item(int index) { return (XSObject)list.get(index); } /** * Retrieves an XSObject specified by local name and * namespace URI. *
      Per XML Namespaces, applications must use the value null as the * namespace parameter for methods if they wish to specify * no namespace. * @param namespace The namespace URI of the XSObject to * retrieve, or null if the XSObject has no * namespace. * @param localName The local name of the XSObject to * retrieve. * @return A XSObject (of any type) with the specified local * name and namespace URI, or null if they do not * identify any object in this map. */ public XSObject itemByName(String namespace, String localName) { XSObject xso = null; //Since our list may contain types from xerces implementation for(XSObject obj: list) { if(localName.equals(obj.getName()) && namespace.equals(obj.getNamespace())) return obj; } return xso; } public void addItem(XSObject obj) { list.add(obj); } public void addItems(Collection col) { list.addAll(col); } public List toList() { return list; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSComplexTypeDefinition.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/xmlschema/JBos0000644000175000017500000001545610542776150031513 0ustar godgod/* * 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.metadata.wsdl.xmlschema; import java.util.ArrayList; import java.util.List; import org.apache.xerces.xs.XSAttributeUse; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; import org.apache.xerces.xs.XSWildcard; /** * @author Anil Saldhana * @since Apr 21, 2005 */ public class JBossXSComplexTypeDefinition extends JBossXSTypeDefinition implements XSComplexTypeDefinition { private boolean isAbstract; private XSSimpleTypeDefinition xsSimple; private XSParticle xspart; private XSObjectList annots; private String prefix; private List attList = new ArrayList(); //Content Type private short contentType = XSComplexTypeDefinition.CONTENTTYPE_ELEMENT; private short deriveMethod = XSConstants.DERIVATION_NONE; public JBossXSComplexTypeDefinition( ) { } public JBossXSComplexTypeDefinition(String name, String namespace) { super(name, namespace); } public JBossXSComplexTypeDefinition(XSComplexTypeDefinition xc) { super(xc.getName(),xc.getNamespace()); setAnonymous(xc.getAnonymous()); xspart = xc.getParticle(); xsSimple = xc.getSimpleType(); deriveMethod = xc.getDerivationMethod(); this.baseType = new JBossXSTypeDefinition(xc.getBaseType()); } /** * [derivation method]: either DERIVATION_EXTENSION, * DERIVATION_RESTRICTION, or DERIVATION_NONE * (see XSConstants). */ public short getDerivationMethod() { return deriveMethod; } /** * [abstract]: a boolean. Complex types for which abstract is * true must not be used as the type definition for the validation of * element information items. */ public boolean getAbstract() { return isAbstract; } /** * A set of attribute uses if it exists, otherwise an empty * XSObjectList. */ public XSObjectList getAttributeUses() { JBossXSObjectList oblist = new JBossXSObjectList(); for(XSAttributeUse xa:attList) { oblist.addItem(xa); } return oblist; } /** * An attribute wildcard if it exists, otherwise null. */ public XSWildcard getAttributeWildcard() { return null; } /** * [content type]: one of empty (CONTENTTYPE_EMPTY), a simple * type definition (CONTENTTYPE_SIMPLE), mixed ( * CONTENTTYPE_MIXED), or element-only ( * CONTENTTYPE_ELEMENT). */ public short getContentType() { return contentType; } /** * A simple type definition corresponding to a simple content model, * otherwise null. */ public XSSimpleTypeDefinition getSimpleType() { return xsSimple; } /** * A particle for a mixed or element-only content model, otherwise * null. */ public XSParticle getParticle() { return xspart; } /** * [prohibited substitutions]: a subset of {extension, restriction} * @param restriction Extension or restriction constants (see * XSConstants). * @return True if restriction is a prohibited substitution, * otherwise false. */ public boolean isProhibitedSubstitution(short restriction) { return false; } /** * [prohibited substitutions]: A subset of {extension, restriction} or * DERIVATION_NONE represented as a bit flag (see * XSConstants). */ public short getProhibitedSubstitutions() { return 0; } /** * A set of [annotations] if it exists, otherwise an empty * XSObjectList. */ public XSObjectList getAnnotations() { return annots; } /** * Get the type */ @Override public short getType() { return XSTypeDefinition.COMPLEX_TYPE; } /** * Return whether this type definition is a simple type or complex type. */ @Override public short getTypeCategory() { return XSTypeDefinition.COMPLEX_TYPE; } public void setAbstract(boolean anAbstract) { isAbstract = anAbstract; } public void setDerivationMethod(short deriveMethod) { this.deriveMethod = deriveMethod; } /** * A simple type definition corresponding to a simple content model, * otherwise null. */ public void setSimpleType(XSSimpleTypeDefinition xsSimple) { this.xsSimple = xsSimple; } /** * A particle for a mixed or element-only content model, otherwise * null. */ public void setParticle(XSParticle xspart) { this.xspart = xspart; } /** * A set of [annotations] if it exists, otherwise an empty * XSObjectList. */ public void setAnnotations(XSObjectList annots) { this.annots = annots; } /** * @see XSComplexTypeDefinition.CONTENTTYPE_EMPTY * @see XSComplexTypeDefinition.CONTENTTYPE_SIMPLE * @see XSComplexTypeDefinition.CONTENTTYPE_MIXED * @see XSComplexTypeDefinition.CONTENTTYPE_ELEMENT * * @param contentType */ public void setContentType(short contentType) { this.contentType = contentType; } //********************************************************************* // Custom Methods //********************************************************************* public void addXSAttributeUse(XSAttributeUse at) { attList.add(at); } public String toString() { return ""; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLSOAPHeader0000755000175000017500000001060310542776150031232 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; import javax.xml.namespace.QName; /** * Represents a WSDL 2.0 SOAP Header Block. The presence of the SOAP Header * Block component indicates that the service supports headers and MAY require a * web service consumer/client to use the header. It may appear up to one time * in the message. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class WSDLSOAPHeader implements Serializable { private static final long serialVersionUID = -3102495235178249853L; private final QName element; private final String partName; private boolean required = false; private boolean mustUnderstand = false; private boolean includeInSignature = false; public WSDLSOAPHeader(QName element, String partName) { this.element = element; this.partName = partName; } /** * Returns the name of the header schema element that describes the header's * contents. * * @return the name of the header schema element */ public QName getElement() { return element; } /** * Returns the name of the WSDL 1.1 part, if the output is WSDL 1.1 * * @return the name of the part */ public String getPartName() { return partName; } /** * Indicates whether the resulting SOAP header has a mustUnderstand attribute * set to true. * * @return the value of the SOAP mustUnderstand attribute */ public boolean isMustUnderstand() { return mustUnderstand; } /** * Specifies whether the resulting SOAP Header has a mustUnderstand attribute * set to true. * * @param mustUnderstand the value of the SOAP mustUnderstand attribute */ public void setMustUnderstand(boolean mustUnderstand) { this.mustUnderstand = mustUnderstand; } /** * Indicates whether the resulting SOAP header must be present in the * message. * * @return true if the header must be present, otherwise false */ public boolean isRequired() { return required; } /** * Specifies whether the resulting SOAP header is required to be present on * the message. * * @param required true if the header must be present, otherwise false */ public void setRequired(boolean required) { this.required = required; } /** * Indicates the resulting WSDL should include this header as part of the * interface message. This is currently only valid for WSDL 1.1, as WSDL 2.0 * does not have an equivalent way to specify this. This serves as a hint to * binding tools that the header should be mapped to a Java parameter. * * @return whether the header should be part of the interface message */ public boolean isIncludeInSignature() { return includeInSignature; } /** * Speficies the resulting WSDL should include this header as part of the * interface message. This is currently only valid for WSDL 1.1, as WSDL 2.0 * does not have an equivalent way to specify this. This serves as a hint to * binding tools that the header should be mapped to a Java parameter. * * @param includeInSignature whether the header should be part of the * interface message */ public void setIncludeInSignature(boolean includeInSignature) { this.includeInSignature = includeInSignature; } }././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInput.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceO0000644000175000017500000000313110542776150031371 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLInterfaceOperationInput.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A Message Reference component associates a defined type with a message exchanged in an operation. By * default, the type system is based upon the XML Infoset * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLInterfaceOperationInput extends WSDLInterfaceMessageReference { private static final long serialVersionUID = -4691488323709300920L; public WSDLInterfaceOperationInput(WSDLInterfaceOperation wsdlOperation) { super(wsdlOperation); } }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLTypes.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLTypes.java0000644000175000017500000000434010542776150031401 0ustar godgod/* * 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.metadata.wsdl; //$Id: WSDLTypes.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.Serializable; import javax.xml.namespace.QName; import org.jboss.logging.Logger; /** * WSDL types. * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 10-Oct-2004 */ public abstract class WSDLTypes implements Serializable { private static final long serialVersionUID = 7919937323521372194L; // provide logging static private final Logger log = Logger.getLogger(WSDLTypes.class); private WSDLDefinitions wsdlDefinitions; private String namespace; public abstract QName getXMLType(QName name); public WSDLDefinitions getWsdlDefinitions() { return wsdlDefinitions; } void setWSDLDefintiions(WSDLDefinitions parent) { wsdlDefinitions = parent; } /** * Gets the namespace associate with this types declaration. Currently this is used to filter * which WSDL file receives this types definition. Null means all files. * * @return the namespace associated with this type definition */ public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBinding.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBinding.ja0000644000175000017500000001135110625052352031311 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLBinding.java 3217 2007-05-23 14:51:22Z palin $ import java.io.Serializable; import java.util.ArrayList; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; /** * A Binding component describes a concrete message format and transmission protocol which may be used * to define an endpoint (see 2.14 Endpoint [p.62] ). That is, a Binding component defines the * implementation details necessary to accessing the service. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 10-Oct-2004 */ public class WSDLBinding extends Extendable implements Serializable { private static final long serialVersionUID = -7699953670233209811L; // provide logging private static final Logger log = Logger.getLogger(WSDLBinding.class); // The parent WSDL definitions element. private final WSDLDefinitions wsdlDefinitions; private final QName name; /** The OPTIONAL interface attribute information item refers, by QName, to an Interface component. */ private QName interfaceName; /** The REQUIRED type attribute information item identifies the kind of binding details contained in the Binding * component. See wsdl20-bindings for valid values. */ private String type; /** The set of Binding Fault components corresponding to the fault element * information items in [children], if any.*/ private ArrayList faults = new ArrayList(); /** The set of Binding Operation components corresponding to the operation element * information items in [children], if any.*/ private ArrayList operations = new ArrayList(); public WSDLBinding(WSDLDefinitions wsdlDefinitions, QName name) { this.wsdlDefinitions = wsdlDefinitions; this.name = name; } public WSDLDefinitions getWsdlDefinitions() { return wsdlDefinitions; } public QName getName() { return name; } public QName getInterfaceName() { return interfaceName; } public void setInterfaceName(QName interfaceName) { log.trace("setInterfaceName: " + name); this.interfaceName = interfaceName; } public WSDLInterface getInterface() { WSDLInterface wsdlInterface = wsdlDefinitions.getInterface(interfaceName); if (wsdlInterface == null) throw new WSException("Cannot get interface for name: " + interfaceName); return wsdlInterface; } public String getType() { return type; } public void setType(String type) { this.type = type; } public WSDLBindingFault[] getFaults() { WSDLBindingFault[] arr = new WSDLBindingFault[faults.size()]; faults.toArray(arr); return arr; } public void addFault(WSDLBindingFault fault) { faults.add(fault); } public WSDLBindingOperation[] getOperations() { WSDLBindingOperation[] arr = new WSDLBindingOperation[operations.size()]; operations.toArray(arr); return arr; } public WSDLBindingOperation getOperationByRef(QName qname) { WSDLBindingOperation wsdlBindingOperation = null; for (WSDLBindingOperation aux : operations) { if (aux.getRef().equals(qname)) { if (wsdlBindingOperation != null) log.warn("Multiple binding operations reference: " + qname); wsdlBindingOperation = aux; } } if (wsdlBindingOperation == null) log.warn("Cannot obtain binding operation for ref: " + qname); return wsdlBindingOperation; } public void addOperation(WSDLBindingOperation operation) { operations.add(operation); } }././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLImport.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLImport.jav0000644000175000017500000000711710542776150031413 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; // $Id: WSDLImport.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * The WSDL import element information item, like the include element information item (see 4.1 Including Descriptions [p.73] ) * also allows for the separation of the different components of a WSDL description into independent descriptions, * but in this case with different target namespaces, which can be imported as needed. This technique helps writing * clearer WSDL descriptions by separating the definitions according to their level of abstraction, and maximizes reusability. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLImport implements Serializable { private static final long serialVersionUID = -2641009286158029207L; // The parent WSDL definitions private WSDLDefinitions wsdlDefinitions; /** The REQUIRED namespace attribute information item is of type xs:anyURI . Its actual value indicates that the * containing WSDL document MAY contain qualified references to WSDL definitions in that namespace * (via one or more prefixes declared with namespace declarations in the normal way). This value MUST * NOT match the actual value of the enclosing WSDL document targetNamespace attribute * information item. If the import statement results in the import of a WSDL document then the actual value * of the namespace attribute information item MUST be identical to the actual value of the imported * WSDL document's targetNamespace attribute information item. */ private String namespace; /** The OPTIONAL location attribute information item is of type xs:anyURI . Its actual value is the location of * some information about the namespace identified by the namespace attribute information item. * The location attribute information item is optional. This allows WSDL components to be constructed * from information other than serialized XML 1.0. It also allows the development of WSDL processors that * have a priori (i.e., built-in) knowledge of certain namespaces. */ private String location; public WSDLImport(WSDLDefinitions wsdlDefinitions) { this.wsdlDefinitions = wsdlDefinitions; } public WSDLDefinitions getWsdlDefinitions() { return wsdlDefinitions; } public String getNamespace() { return namespace; } public void setNamespace(String namespace) { this.namespace = namespace; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLDefinitions.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLDefinition0000644000175000017500000002136210625052352031441 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLDefinitions.java 3217 2007-05-23 14:51:22Z palin $ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.wsdl.Definition; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.Document; /** * The top level Definitions component is just a container for two categories of components; * WSDL components and type system components. WSDL components are interfaces, bindings and services. * * Type system components describe the constraints on a message�s content. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLDefinitions extends Extendable implements Serializable { private static final long serialVersionUID = 1643422922694990226L; // provide logging private final Logger log = Logger.getLogger(WSDLDefinitions.class); /** The REQUIRED targetNamespace attribute information item defines the namespace affiliation of top-level * components defined in this definitions element information item. Interfaces, Bindings and Services * are top-level components. */ private String targetNamespace; /** The REQUIRED wsdl namespace. For WSDL-2.0 it is http://www.w3.org/2003/11/wsdl, * for WSDL-1.1 it is http://schemas.xmlsoap.org/wsdl/ */ private String wsdlNamespace; /** Zero or more import element information items */ private List imports = new ArrayList(); /** Zero or more include element information items */ private List includes = new ArrayList(); /** Types element information item */ private WSDLTypes types; /** Zero or more interface element information items */ private Map interfaces = new LinkedHashMap(); /** Zero or more binding element information items */ private Map bindings = new LinkedHashMap(); /** Zero or more service element information items */ private Map services = new LinkedHashMap(); // Zero or more namespace definitions // [TODO] What is this doing here? private NamespaceRegistry namespaces = new NamespaceRegistry(); // The original wsdl4j definition if we have wsdl-1.1 private Definition wsdlOneOneDefinition; // The WSDL document private Document wsdlDocument; public WSDLDefinitions() {} /** Set the wsdl4j definition if we have wsdl-1.1 */ public void setWsdlOneOneDefinition(Definition wsdlDefinition) { this.wsdlOneOneDefinition = wsdlDefinition; } /** * Get the wsdl4j definition if we have wsdl-1.1. * * Note: This object is NOT THREAD-SAFE */ public Definition getWsdlOneOneDefinition() { return wsdlOneOneDefinition; } public Document getWsdlDocument() { return wsdlDocument; } public void setWsdlDocument(Document wsdlDocument) { this.wsdlDocument = wsdlDocument; } /** Register the given namespaceURI/prefix combination */ public String registerNamespaceURI(String nsURI, String prefix) { String pre = namespaces.getPrefix(nsURI); if (pre == null || pre == "") { pre = namespaces.registerURI(nsURI, prefix); log.trace("registerNamespaceURI: " + pre + "=" + nsURI); } return pre; } /** Register a QName and return a QName that is guarantied to have a prefix */ public QName registerQName(QName qname) { return namespaces.registerQName(qname); } /** Get the prefix for a given namespaceURI */ public String getPrefix(String namespaceURI) { return namespaces.getPrefix(namespaceURI); } /** Get the namespaceURI for a given prefix */ public String getNamespaceURI(String prefix) { return namespaces.getNamespaceURI(prefix); } /** Get the prefix for the target namespace */ public String getTargetPrefix() { return namespaces.getPrefix(targetNamespace); } /** Get an iterator for registered namespace URIs */ public Iterator getRegisteredNamespaceURIs() { return namespaces.getRegisteredURIs(); } /** Get an iterator for registered prefixs */ public Iterator getRegisteredPrefix() { return namespaces.getRegisteredPrefixes(); } public String getTargetNamespace() { return targetNamespace; } public void setTargetNamespace(String namespaceURI) { if(namespaceURI == null) throw new IllegalArgumentException("Illegal Null Argument:namespaceURI"); log.trace("setTargetNamespace: " + namespaceURI); this.targetNamespace = namespaceURI; } public String getWsdlNamespace() { return wsdlNamespace; } public void setWsdlNamespace(String namespaceURI) { if (Constants.NS_WSDL11.equals(namespaceURI) == false) throw new IllegalArgumentException("Invalid default namespace: " + namespaceURI); this.wsdlNamespace = namespaceURI; } public WSDLImport[] getImports() { WSDLImport[] arr = new WSDLImport[imports.size()]; imports.toArray(arr); return arr; } public void addImport(WSDLImport anImport) { imports.add(anImport); } public WSDLInclude[] getIncludes() { WSDLInclude[] arr = new WSDLInclude[includes.size()]; includes.toArray(arr); return arr; } public void addInclude(WSDLInclude include) { includes.add(include); } public WSDLTypes getWsdlTypes() { return types; } public void setWsdlTypes(WSDLTypes types) { this.types = types; this.types.setWSDLDefintiions(this); } public WSDLInterface getInterface(QName name) { return interfaces.get(name); } public WSDLInterface[] getInterfaces() { WSDLInterface[] arr = new WSDLInterface[interfaces.size()]; new ArrayList(interfaces.values()).toArray(arr); return arr; } public void addInterface(WSDLInterface wsdlInterface) { interfaces.put(wsdlInterface.getName(), wsdlInterface); } public WSDLBinding[] getBindings() { WSDLBinding[] arr = new WSDLBinding[bindings.size()]; new ArrayList(bindings.values()).toArray(arr); return arr; } public WSDLBinding getBinding(QName name) { return bindings.get(name); } public WSDLBinding getBindingByInterfaceName(QName qname) { WSDLBinding wsdlBinding = null; for (WSDLBinding aux : bindings.values()) { if (aux.getInterfaceName().equals(qname)) { if (wsdlBinding != null) log.warn("Multiple WSDL bindings referrence the same interface: " + qname); wsdlBinding = aux; } } return wsdlBinding; } public void addBinding(WSDLBinding binding) { bindings.put(binding.getName(), binding); } public WSDLService[] getServices() { WSDLService[] arr = new WSDLService[services.size()]; new ArrayList(services.values()).toArray(arr); return arr; } public void addService(WSDLService service) { services.put(service.getName(), service); } public WSDLService getService(QName name) { return services.get(name); } public WSDLService getService(String localName) { return services.get(new QName(targetNamespace, localName)); } /** Unregister the given namespaceURI/prefix combination */ public void unRegisterNamespaceURI(String namespaceURI, String prefix) { String pre = namespaces.getPrefix(namespaceURI); if(pre != null && pre.equals(prefix)) namespaces.removePrefixMapping(prefix); } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLRPCPart.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLRPCPart.ja0000755000175000017500000000341610542776150031227 0ustar godgod/* * 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.metadata.wsdl; import javax.xml.namespace.QName; /** * Represents a child part of a RPC style message reference. This is currently * only used for WSDL 1.1 compatibility. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class WSDLRPCPart { private final String name; private final QName type; public WSDLRPCPart(String name, QName type) { this.name = name; this.type = type; } /** * Gets the XML local name of this part. * * @return the XML local name */ public String getName() { return name; } /** * Gets the XML type of this part. * * @return the XML type */ public QName getType() { return type; } }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceMessageReference.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceM0000755000175000017500000001533010573471351031375 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLInterfaceOperationPart.java 275 2006-05-04 21:36:29Z // jason.greene@jboss.com $ import java.util.Collection; import java.util.LinkedHashMap; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; /** * A Message Reference component associates a defined type with a message * exchanged in an operation. By default, the type system is based upon the XML * Infoset * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 10-Oct-2004 */ public abstract class WSDLInterfaceMessageReference extends Extendable implements Comparable { // provide logging protected Logger log = Logger.getLogger(getClass()); // The parent interface operation private WSDLInterfaceOperation wsdlOperation; /** * The OPTIONAL messageLabel attribute information item identifies the role * of this message in the message exchange pattern of the given operation * element information item. */ private String messageLabel; /** * The OPTIONAL element attribute information item is the element declaration * from the {element declarations} property resolved by the value of the * element attribute information item, otherwise empty. */ private QName element; /** * Used mainly for WSDL 1.1 compatibility, indicates rpc parts. * Although, this could be used to represent WSDL 2.0 RPC style. */ private LinkedHashMap childParts = new LinkedHashMap(); /** * Used for WSDL 1.1 */ private String partName; /** * Used for WSDL 1.1 */ private QName messageName; public WSDLInterfaceMessageReference(WSDLInterfaceOperation wsdlOperation) { log.trace("New part for wsdlOperation: " + wsdlOperation.getName()); this.wsdlOperation = wsdlOperation; } public WSDLInterfaceOperation getWsdlOperation() { return wsdlOperation; } public String getMessageLabel() { return messageLabel; } public void setMessageLabel(String messageLabel) { this.messageLabel = messageLabel; } public QName getElement() { return element; } public void setElement(QName element) { log.trace("setElement: " + element); this.element = element; } /** * Get the xmlType for this operation part. */ public QName getXMLType() { QName xmlType = null; // First try to read it from the schema WSDLDefinitions wsdlDefinitions = wsdlOperation.getWsdlInterface().getWsdlDefinitions(); WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes(); xmlType = wsdlTypes.getXMLType(element); // Fall back to the property if (xmlType == null) { WSDLProperty property = getProperty(Constants.WSDL_PROPERTY_PART_XMLTYPE); if (property != null) { String qnameRef = property.getValue(); int colIndex = qnameRef.indexOf(':'); String prefix = qnameRef.substring(0, colIndex); String localPart = qnameRef.substring(colIndex + 1); String nsURI = wsdlDefinitions.getNamespaceURI(prefix); xmlType = new QName(nsURI, localPart, prefix); } } if (xmlType == null) throw new WSException("Cannot obtain xmlType for element: " + element); return xmlType; } /** * Gets the child parts associated with this message reference. This is only * used for RPC style, and currently only supported by WSDL 1.1. * * @return the list of rpc parts that make up the message */ public Collection getChildParts() { return childParts.values(); } /** * Gets the child part associated with this message reference by part name. * This is only used for RPC style, and currently only supported by WSDL 1.1. * * @param name the part name * @return the part or null if not found */ public WSDLRPCPart getChildPart(String name) { return childParts.get(name); } /** * Adds a child part to this mesage reference. This is only used for RPC * style, and currently only supported by WSDL 1.1. * * @param childPart the list of rpc parts that make up the message */ public void addChildPart(WSDLRPCPart childPart) { this.childParts.put(childPart.getName(), childPart); } /** * Removes a speficied child part. This is This is only used for RPC * style, and currently only supported by WSDL 1.1. * * @param name the name of the part */ public void removeChildPart(String name) { this.childParts.remove(name); } /** * Gets the WSDL 1.1 part name. * * @return the part name */ public String getPartName() { return partName; } /** * Sets the WSDL 1.1 message name. * * @param messageName The part name */ public void setMessageName(QName messageName) { this.messageName = messageName; } /** * Gets the WSDL 1.1 message name. * * @return the message name */ public QName getMessageName() { return messageName; } /** * Sets the WSDL 1.1 part name. * * @param partName The part name */ public void setPartName(String partName) { this.partName = partName; } public int compareTo(Object o) { int c = -1; if (o instanceof WSDLInterfaceMessageReference) { WSDLInterfaceMessageReference w = (WSDLInterfaceMessageReference) o; String oname = w.getElement().getLocalPart(); String myname = getElement().getLocalPart(); c = myname.compareTo(oname); } return c; } }././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingOperationOutput.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingOpe0000644000175000017500000000334310542776150031375 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; // $Id: WSDLBindingOperationOutput.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A Binding Message Reference component describes a concrete binding of a particular message * participating in an operation to a particular concrete message format. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 10-Oct-2004 */ public class WSDLBindingOperationOutput extends WSDLBindingMessageReference implements Serializable { private static final long serialVersionUID = -999199387765793475L; public WSDLBindingOperationOutput(WSDLBindingOperation wsdlBindingOperation) { super(wsdlBindingOperation); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingOperationInput.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingOpe0000644000175000017500000000334110542776150031373 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; // $Id: WSDLBindingOperationInput.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A Binding Message Reference component describes a concrete binding of a particular message * participating in an operation to a particular concrete message format. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 10-Oct-2004 */ public class WSDLBindingOperationInput extends WSDLBindingMessageReference implements Serializable { private static final long serialVersionUID = -3945310906418557565L; public WSDLBindingOperationInput(WSDLBindingOperation wsdlBindingOperation) { super(wsdlBindingOperation); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInclude.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInclude.ja0000644000175000017500000000436410542776150031337 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; // $Id: WSDLInclude.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * The WSDL include element information item allows for the separation of different components of a * service definition, belonging the same target namespace, into independent WSDL documents which can be * merged as needed. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLInclude implements Serializable { private static final long serialVersionUID = 1210980063899094649L; // The parent WSDL definitions private WSDLDefinitions wsdlDefinitions; /** A location attribute information item is of type xs:anyURI . Its actual value is the location of some * information about the namespace identified by the targetNamespace attribute information item of the * containing definitions element information item.*/ private String location; public WSDLInclude(WSDLDefinitions wsdlDefinitions) { this.wsdlDefinitions = wsdlDefinitions; } public WSDLDefinitions getWsdlDefinitions() { return wsdlDefinitions; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceO0000644000175000017500000002236610743173754031410 0ustar godgod/* * 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.metadata.wsdl; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction; // $Id: WSDLInterfaceOperation.java 5471 2008-01-15 18:14:04Z alessio.soldano@jboss.com $ /** * An Interface Operation component describes an operation that a given interface supports. An operation is * an interaction with the service consisting of a set (ordinary and fault) messages exchanged between the * service and the other roles involved in the interaction, in particular the service requester. The sequencing * and cardinality of the messages involved in a particular interaction is governed by the message exchange * pattern used by the operation (see {message exchange pattern} property). * * @author Thomas.Diesler@jboss.org * @author (outputs.values()).toArray(arr); return arr; } public void addOutput(WSDLInterfaceOperationOutput output) { QName xmlName = output.getElement(); if (outputs.get(xmlName) != null) throw new WSException("Attempt to map multiple operation outputs to: " + xmlName); outputs.put(xmlName, output); } public WSDLInterfaceOperationOutput getOutput(QName qname) { WSDLInterfaceOperationOutput opOutput = (WSDLInterfaceOperationOutput)outputs.get(qname); return opOutput; } public void removeOutput(QName element) { outputs.remove(element); } public WSDLInterfaceOperationOutput getOutputByPartName(String partName) { WSDLInterfaceOperationOutput opOutput = null; for (WSDLInterfaceOperationOutput auxOutput : outputs.values()) { WSDLProperty property = auxOutput.getProperty(Constants.WSDL_PROPERTY_PART_NAME); if (property != null && property.getValue().equals(partName)) opOutput = auxOutput; } return opOutput; } public WSDLInterfaceOperationInfault[] getInfaults() { WSDLInterfaceOperationInfault[] arr = new WSDLInterfaceOperationInfault[infaults.size()]; infaults.toArray(arr); return arr; } public void addInfault(WSDLInterfaceOperationInfault infault) { infaults.add(infault); } public WSDLInterfaceOperationOutfault[] getOutfaults() { WSDLInterfaceOperationOutfault[] arr = new WSDLInterfaceOperationOutfault[outfaults.size()]; outfaults.toArray(arr); return arr; } public void addOutfault(WSDLInterfaceOperationOutfault outfault) { outfaults.add(outfault); } public Collection getRpcSignatureItems() { return rpcSignatureItems.values(); } public void addRpcSignatureItem(WSDLRPCSignatureItem item) { if (item.getDirection() != Direction.RETURN) item.setPosition(rpcSignatureItems.size()); rpcSignatureItems.put(item.getName(), item); } public WSDLRPCSignatureItem getRpcSignatureitem(String name) { return rpcSignatureItems.get(name); } /** * Attempts to locate a binding operation for this interface operation. * * @return the binding operation, or null if not found; */ public WSDLBindingOperation getBindingOperation() { WSDLInterface wsdlInterface = getWsdlInterface(); WSDLBinding binding = wsdlInterface.getWsdlDefinitions().getBindingByInterfaceName(wsdlInterface.getName()); if (binding == null) return null; WSDLBindingOperation bindingOperation = binding.getOperationByRef(getName()); return bindingOperation; } public int compareTo(Object o) { int c = -1; if (o instanceof WSDLInterfaceOperation) { WSDLInterfaceOperation w = (WSDLInterfaceOperation)o; String oname = w.getName().getLocalPart(); String myname = name.getLocalPart(); c = myname.compareTo(oname); } return c; } public WSDLDocumentation getDocumentationElement() { return documentationElement; } public void setDocumentationElement(WSDLDocumentation documentationElement) { this.documentationElement = documentationElement; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLProperty.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLProperty.j0000644000175000017500000000747210551203052031424 0ustar godgod/* * 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.metadata.wsdl; import java.io.Serializable; import javax.xml.namespace.QName; // $Id: WSDLProperty.java 1900 2007-01-10 15:28:42Z thomas.diesler@jboss.com $ /** * A "property" in the Features and Properties architecture represents a named runtime value which affects * the behaviour of some aspect of a Web service interaction, much like an environment variable. For * example, a reliable messaging SOAP module may specify a property to control the number of retries in the * case of network failure. WSDL documents may specify the value constraints for these properties by * referring to a Schema type, or by specifying a particular value. Properties, and hence property values, can * be shared amongst features/bindings/modules, and are named with URIs precisely to allow this type of * sharing. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLProperty implements Serializable { private static final long serialVersionUID = -7528676719881753461L; /** A REQUIRED uri attribute information item */ private String uri; /** An OPTIONAL required attribute information item */ private boolean required; /** The OPTIONAL value of the property, an ordered list of child information items, as * specified by the [children] property of element information items */ private String value; /** A OPTIONAL type definition constraining the value of the property, or the token * #value if the {value} property is not empty.*/ private QName constraint; private QName qnameValue; public WSDLProperty(String uri, String value) { if (uri == null) throw new IllegalArgumentException("Illegal property URI: " + uri); this.uri = uri; this.value = value; } public WSDLProperty(String uri, QName value) { if (uri == null) throw new IllegalArgumentException("Illegal property URI: " + uri); this.uri = uri; this.qnameValue = value; } public WSDLProperty(String uri, boolean required, String value, QName constraint) { if (uri == null) throw new IllegalArgumentException("Illegal property URI: " + uri); this.uri = uri; this.required = required; this.value = value; this.constraint = constraint; } public String getURI() { return uri; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public QName getConstraint() { return constraint; } public void setConstraint(QName constraint) { this.constraint = constraint; } public String toString() { return "[" + uri + "=" + value + "]"; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLException.0000644000175000017500000000663310542776150031400 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLException.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * An exception that may occur during WSDL processing. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLException extends RuntimeException { /** * Constructs a new exception with null as its detail message. * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. */ public WSDLException() { } /** * Constructs a new exception with the specified detail message. The * cause is not initialized, and may subsequently be initialized by * a call to {@link #initCause}. * * @param message the detail message. The detail message is saved for * later retrieval by the {@link #getMessage()} method. */ public WSDLException(String message) { super(message); } /** * Constructs a new exception with the specified cause and a detail * message of (cause==null ? null : cause.toString()) (which * typically contains the class and detail message of cause). * This constructor is useful for exceptions that are little more than * wrappers for other throwables (for example, {@link * java.security.PrivilegedActionException}). * * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A null value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.4 */ public WSDLException(Throwable cause) { super(cause); } /** * Constructs a new exception with the specified detail message and * cause.

      Note that the detail message associated with * cause is not automatically incorporated in * this exception's detail message. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A null value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.4 */ public WSDLException(String message, Throwable cause) { super(message, cause); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingOperation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingOpe0000644000175000017500000001113510625052352031364 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLBindingOperation.java 3217 2007-05-23 14:51:22Z palin $ import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.jboss.ws.Constants; /** * The Binding Operation component describes the concrete message format(s) and protocol interaction(s) * associated with a particular interface operation for a given endpoint. A particular operation of an interface * is uniquely identified by the target namespace of the interface and the name of the operation within that * interface. * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 10-Oct-2004 */ public class WSDLBindingOperation extends Extendable implements Comparable, Serializable { private static final long serialVersionUID = -1986624862746844610L; // The parent WSDL binding private WSDLBinding wsdlBinding; /** An Interface Operation component in the {operations} property of the Interface component * identified by the {interface} property of the parent Binding component. * This is the Interface Operation component for which binding information is being specified.*/ private QName ref; /** WSDL-1.1, style attribute from the soap:binding element */ private String encodingStyle = Constants.URI_LITERAL_ENC; /** WSDL-1.1, soapAction attribute from the soap:operation element */ private String soapAction; /** WSDL-1.1, namespaceURI attribute from the soap:body element */ private String namespaceURI; /** A OPTIONAL set of Binding Message Reference components */ private List inputs = new ArrayList(); /** A OPTIONAL set of Binding Message Reference components */ private List outputs = new ArrayList(); public WSDLBindingOperation(WSDLBinding wsdlBinding) { this.wsdlBinding = wsdlBinding; } public WSDLBinding getWsdlBinding() { return wsdlBinding; } public QName getRef() { return ref; } public void setRef(QName ref) { this.ref = ref; } public String getEncodingStyle() { return encodingStyle; } public void setEncodingStyle(String encodingStyle) { this.encodingStyle = encodingStyle; } public String getSOAPAction() { return soapAction; } public void setSOAPAction(String soapAction) { this.soapAction = soapAction; } public String getNamespaceURI() { return namespaceURI; } public void setNamespaceURI(String namespaceURI) { this.namespaceURI = namespaceURI; } public WSDLBindingOperationInput[] getInputs() { WSDLBindingOperationInput[] arr = new WSDLBindingOperationInput[inputs.size()]; inputs.toArray(arr); return arr; } public void addInput(WSDLBindingOperationInput input) { inputs.add(input); } public WSDLBindingOperationOutput[] getOutputs() { WSDLBindingOperationOutput[] arr = new WSDLBindingOperationOutput[outputs.size()]; outputs.toArray(arr); return arr; } public void addOutput(WSDLBindingOperationOutput output) { outputs.add(output); } /* (non-Javadoc) * @see java.lang.Comparable#compareTo(T) */ public int compareTo(Object obj) { int c = -1; if (obj instanceof WSDLBindingOperation) { WSDLBindingOperation w = (WSDLBindingOperation)obj; String oname = w.getRef().getLocalPart(); String myname = ref.getLocalPart(); c = myname.compareTo(oname); } return c; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingMessageReference.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLBindingMes0000755000175000017500000001022310625052352031365 0ustar godgod/* * 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.metadata.wsdl; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; import java.util.List; /** * A Binding Message Reference component describes a concrete binding of a * particular message participating in an operation to a particular concrete * message format. * * @author Jason T. Greene * @version $Revision: 3217 $ */ public abstract class WSDLBindingMessageReference extends Extendable { // The parent WSDL binding operation private WSDLBindingOperation wsdlBindingOperation; private String messageLabel; private List soapHeaders = new ArrayList(); private LinkedHashMap mimeParts = new LinkedHashMap(); public WSDLBindingMessageReference(WSDLBindingOperation wsdlBindingOperation) { this.wsdlBindingOperation = wsdlBindingOperation; } public WSDLBindingOperation getWsdlBindingOperation() { return wsdlBindingOperation; } /** * Gets the property that identifies the role that the message for which * binding details are being specified. The role is part of the {message * exchange pattern} of the Interface Operation component being bound by the * containing Binding Operation component. */ public String getMessageLabel() { return messageLabel; } /** * Sets the property that identifies the role that the message for which * binding details are being specified. The role is part of the {message * exchange pattern} of the Interface Operation component being bound by the * containing Binding Operation component. */ public void setMessageLabel(String messageLabel) { this.messageLabel = messageLabel; } /** * Gets the list of SOAP headers associated with this message reference. * * @return a list of soap headers */ public List getSoapHeaders() { return soapHeaders; } /** * Sets the list of SOAP headers associated with this message reference. * * @param soapHeaders The soapHeaders to set. */ public void setSoapHeaders(List soapHeaders) { this.soapHeaders = soapHeaders; } /** * Adds a SOAP header to the SOAP header list that is associated with this * message reference. * * @param soapHeader the SOAP header to add */ public void addSoapHeader(WSDLSOAPHeader soapHeader) { this.soapHeaders.add(soapHeader); } /** * Adds a MIME part to this message reference. This is only used for WSDL 1.1. * * @param mimePart the mime part to add */ public void addMimePart(WSDLMIMEPart mimePart) { this.mimeParts.put(mimePart.getPartName(), mimePart); } /** * Returns a list of mime parts on this message * * @return */ public Collection getMimeParts() { return mimeParts.values(); } /** * Gets a specific MIME part * * @param partName the wsdl part name * @return */ public WSDLMIMEPart getMimePart(String partName) { return mimeParts.get(partName); } }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceOperationInfault.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/metadata/wsdl/WSDLInterfaceO0000644000175000017500000000544710573471351031404 0ustar godgod/* * 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.metadata.wsdl; // $Id: WSDLInterfaceOperationInfault.java 2539 2007-03-07 08:08:09Z jason.greene@jboss.com $ import javax.xml.namespace.QName; /** * A Fault Reference component associates a defined type, specified by an Interface Fault component, to a * fault message exchanged in an operation. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLInterfaceOperationInfault extends Extendable { private static final long serialVersionUID = 1124693747462594773L; // The parent interface operation private WSDLInterfaceOperation wsdlInterfaceOperation; /** A REQUIRED reference to an Interface Fault component in the {faults} property of the parent * Interface Operation component's parent Interface component. Identifying the Interface Fault * component therefore indirectly defines the actual content or payload of the fault message. */ private QName ref; /** An OPTIONAL identifier of the message this fault relates to among those defined in the {message exchange * pattern} property of the Interface Operation component it is contained within. The value of this * property MUST match the name of a placeholder message defined by the message exchange pattern. */ private String messageLabel; public WSDLInterfaceOperationInfault(WSDLInterfaceOperation wsdlInterfaceOperation) { this.wsdlInterfaceOperation = wsdlInterfaceOperation; } public WSDLInterfaceOperation getWsdlInterfaceOperation() { return wsdlInterfaceOperation; } public QName getRef() { return ref; } public void setRef(QName ref) { this.ref = ref; } public String getMessageLabel() { return messageLabel; } public void setMessageLabel(String messageLabel) { this.messageLabel = messageLabel; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/0000755000175000017500000000000010755000263025335 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/factories/0000755000175000017500000000000010755000262027313 5ustar godgod././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/factories/JavaToXSDFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/factories/JavaToXSDFac0000644000175000017500000000444110542776150031430 0ustar godgod/* * 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.tools.factories; import org.jboss.ws.tools.JavaToXSD; import org.jboss.ws.tools.exceptions.JBossWSToolsException; import org.jboss.ws.tools.interfaces.JavaToXSDIntf; /** * Factory that provides a Java To Schema Converter * @author Anil Saldhana * @since Jul 23, 2005 */ public class JavaToXSDFactory { /** * Create a JavaToXSDFactory * @return * @throws JBossWSToolsException */ public static JavaToXSDFactory newInstance() throws JBossWSToolsException { String factoryName = null; JavaToXSDFactory factory = null; try { String defaultName = "org.jboss.ws.tools.factories.JavaToXSDFactory"; factoryName = System.getProperty("org.jboss.ws.tools.JavaToXSDFactory", defaultName); ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class factoryClass = loader.loadClass(factoryName); factory = (JavaToXSDFactory) factoryClass.newInstance(); } catch(Throwable e) { throw new JBossWSToolsException("Cannot create JavaToXSDFactory",e); } return factory; } public JavaToXSDFactory() { } public JavaToXSDIntf getJavaToXSD(String targetNamespace,String typeNamespace) { return new JavaToXSD(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/ant/0000755000175000017500000000000010755000262026116 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/ant/FixPathTask.java0000644000175000017500000000301110745660777031170 0ustar godgod/* * 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.tools.ant; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; public class FixPathTask extends Task { private String propertyName; @Override public void execute() throws BuildException { String path = getProject().getProperty(propertyName); if (path != null) { getProject().setProperty(propertyName, path.replace('\\', '/')); } } public void setProperty(String propertyName) { this.propertyName = propertyName; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/ant/wstools.java0000644000175000017500000000611610551451440030501 0ustar godgod/* * 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.tools.ant; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; /** * Ant task for jbossws tools * @author Anil Saldhana * @since Oct 5, 2005 */ public class wstools extends MatchingTask { protected Path compileClasspath = null; private boolean verbose = false; private String dest = null; private String config = null; /** * Creates a nested classpath element. */ public Path createClasspath() { if (compileClasspath == null) { compileClasspath = new Path(project); } return compileClasspath.createPath(); } /** * Adds a reference to a CLASSPATH defined elsewhere. */ public void setClasspathRef(Reference r) { createClasspath().setRefid(r); } public String getConfig() { return config; } public void setConfig(String config) { this.config = config; } public String getDest() { return dest; } public void setDest(String dest) { this.dest = dest; } public boolean isVerbose() { return verbose; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public void execute() throws BuildException { ClassLoader prevCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); try { String[] args = new String[] { "-dest", dest, "-config", config }; org.jboss.ws.tools.WSTools tools = new org.jboss.ws.tools.WSTools(); tools.generate(args); } catch (Exception ex) { if (ex instanceof BuildException) { throw (BuildException)ex; } else { throw new BuildException("Error running jbossws: ", ex, getLocation()); } } finally { Thread.currentThread().setContextClassLoader(prevCL); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/0000755000175000017500000000000010755000262027457 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/WebservicesXMLCreator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/Webservices0000644000175000017500000000470710551701602031673 0ustar godgod/* * 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.tools.interfaces; import java.io.File; import java.io.IOException; /** * Defines the contract for webservices.xml creating agents * @author Anil Saldhana * @since Jul 23, 2005 */ public interface WebservicesXMLCreator { /** * Generate the webservices.xml file * @throws IOException */ public void generateWSXMLDescriptor(File file) throws IOException; /** * @param targetNamespace The targetNamespace to set. */ public void setTargetNamespace(String targetNamespace); /** * @param seiName The seiName to set. */ public void setSeiName(String seiName); /** * @param portName The portName to set. */ public void setPortName(String portName); /** * @param serviceName The serviceName to set. */ public void setServiceName(String serviceName); /** * @param ejbLink The ejbLink to set. */ public void setEjbLink(String ejbLink); /** * @param servletLink The servletLink to set. */ public void setServletLink(String servletLink); /** * @param mappingFileEntry The mapping file entry */ public void setMappingFile(String mappingFileEntry); /** * * @param wsdlFileEntry The wsdl-file entry */ public void setWsdlFile(String wsdlFileEntry); /** * * @param append add ws descriptions to existing webservices.xml file, if any */ public void setAppend(boolean append); } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/SchemaCreatorIntf.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/SchemaCreat0000644000175000017500000000706210542776150031600 0ustar godgod/* * 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.tools.interfaces; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSTypeDefinition; /** * Defines the contract for Schema Creating agents (Java -> XSD Process) * @author Anil Saldhana * @since Jul 23, 2005 */ public interface SchemaCreatorIntf { /** * Add a package - namespace mapping entry * @param pkgname * @param ns * @throws IllegalArgumentException if either pkgname or ns is null */ public void addPackageNamespaceMapping(String pkgname, String ns); /** * Return a HashMap of custom namespaces like ns1, ns2 etc * @return */ public HashMap getCustomNamespaceMap(); /** * get the XSModel representing the targetNS * @return */ public JBossXSModel getXSModel(); public JavaWsdlMapping getJavaWsdlMapping(); /** * @return Returns the packageNamespaceMap. */ public Map getPackageNamespaceMap(); /** * Return the Type Mapping * @return */ public LiteralTypeMapping getTypeMapping(); /** * Main method that is involved in generating a Schema Type * @param xmlType QName of the Complex Type. Can be null * @param javaType Java class for the type. Can be null * @return Schema Type */ public JBossXSTypeDefinition generateType(QName xmlType, Class javaType); public JBossXSTypeDefinition generateType(QName xmlType, Class javaType, Map elementNames); /** * Given a XML Type, return the Java class * * @param xmlType * @return */ public Class getJavaType(QName xmlType); /** * Given a Java class, return the XML Type * * @param javaType * @return */ public QName getXMLSchemaType(Class javaType); /** * Users can provide a customized map of java packages to xml namespace * @param packageNamespaceMap The packageNamespaceMap to set. */ public void setPackageNamespaceMap(Map packageNamespaceMap); /** * SchemaCreator maintains a map of namespaces that will be fed back * into WSDLDefinitions for all custom namespaces * @param nsuri * @return */ public String allocatePrefix(String nsuri); /** * Set the XSModel representing the targetNS * @param xsm */ public void setXSModel(JBossXSModel xsm); }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/WSDLToJavaIntf.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/WSDLToJavaI0000644000175000017500000000634410542776150031412 0ustar godgod/* * 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.tools.interfaces; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.Map; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLException; /** * Defines the contract for WSDL To Java Converters * @author Anil Saldhana * @since Jul 23, 2005 */ public interface WSDLToJavaIntf { /** * Provide a WSDLFile and get back the WSDL20 Object Graph * @param wsdlfileurl * @return * @throws org.jboss.ws.metadata.wsdl.WSDLException */ public WSDLDefinitions convertWSDL2Java(URL wsdlfileurl) throws WSDLException; /** * Get the features *
      *
      Features are: *
      USE_ANNOTATIONS : Should the generated Java Types use annotations * @throws IllegalStateException feature unrecognized */ public boolean getFeature(String name); /** * Set one or more features of the WSDLToJava tool *
      *
      Features are: *
      USE_ANNOTATIONS : Should the generated Java Types use annotations * @param name * @param value */ public void setFeature(String name, boolean value); /** * Method for use by the Web Services Layer * @param wsdlFile URL to the WSDL file * @param dir Directory where the generated files should be stored * @param annotate Is JAX-WS 2.0 compliance needed ie. annotations needed? * @throws IOException */ public void generateSEI(URL wsdlFile, File dir, boolean annotate) throws IOException; /** * Generate the SEI * @param wsdl The WSDL20Definitions (root of the object tree) * @param dir The directory where the SEI files will be written * @throws IOException * @throws Exception */ public void generateSEI(WSDLDefinitions wsdl, File dir) throws IOException; /** * Global configuration from user that defines a map of package->Namespace * * @param map */ public void setNamespacePackageMap(Map map); /** * The client can provide a type mapping * @param typeMapping */ public void setTypeMapping(LiteralTypeMapping typeMapping); public void setParameterStyle(String paramStyle); } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/ServiceCreatorIntf.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/ServiceCrea0000644000175000017500000000355510542776150031617 0ustar godgod/* * 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.tools.interfaces; import java.io.IOException; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; /** * Defines the contract for creation of java.xml.rpc.Service Interface * @author Anil Saldhana * @since Jul 23, 2005 */ public interface ServiceCreatorIntf { /** * @return Returns the packageName. */ public String getPackageName(); /** * @param packageName The packageName to set. */ public void setPackageName(String packageName); /** * @return the WSDL Definitions */ public WSDLDefinitions getWsdl(); /** * Set the WSDL Definitions * * @param wsdl */ public void setWsdl(WSDLDefinitions wsdl); /** * Create the Service Interface for the endpoint * @throws IOException * */ public void createServiceDescriptor() throws IOException; } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/JavaToXSDIntf.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/JavaToXSDIn0000644000175000017500000000461010542776150031447 0ustar godgod/* * 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.tools.interfaces; import java.io.IOException; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; /** * Interface that defines the contract for all Java To Schema converters * @author Anil Saldhana * @since Jul 23, 2005 */ public interface JavaToXSDIntf { /** * Method that is used to obtain a Schema Model given * a Java class, a XMLName and a XMLType * @param xmlType * @param javaType Class object that is the type of the xmlType * @return a schema model * @throws IOException */ public JBossXSModel generateForSingleType(QName xmlType, Class javaType) throws IOException; public JBossXSModel generateForSingleType(QName xmlType, Class javaType, Map elementNames) throws IOException; /** * Get the SchemaCreator (that deals with creation of schema types) * Pluggable feature of JavaToXSD * @return */ public SchemaCreatorIntf getSchemaCreator(); /** * A map of package->namespace map that denote user customization * * @param map */ public void setPackageNamespaceMap(Map map); /** * Set the WSDLStyle * @see org.jboss.ws.Constants for Constants.DOCUMENT_LITERAL * and Constants.RPC_LITERAL * @param wsdlStyle */ public void setWSDLStyle(String wsdlStyle); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/XSDToJavaIntf.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/interfaces/XSDToJavaIn0000644000175000017500000000566210542776150031457 0ustar godgod/* * 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.tools.interfaces; import java.io.File; import java.io.IOException; import org.apache.xerces.xs.XSModel; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; /** * Defines the contract for all Schema Types to Java Types converters * @author Anil Saldhana * @since Jul 20, 2005 */ public interface XSDToJavaIntf { /** * Generate the Java Types given the XSD Schema file * @param schemaFile String representing FQN of a schema file * @param dirloc location to place the generated java source files * @param packageName package name for the types * @param createPackageDir Should the package structure be created * @throws IOException */ public void generateJavaSource( String schemaFile, File dirloc, String packageName, boolean createPackageDir) throws IOException; /** * Generate the Java Types given the XSD Schema object graph * @param xsmodel xml schema object graph based on Xerces Schema API * @param dirloc location to place the generated java source files * @param packageName package name for the types * @param createPackageDir Should the package structure be created * @throws IOException */ public void generateJavaSource( XSModel xsmodel, File dirloc, String packageName, boolean createPackageDir) throws IOException; /** * Generate the Java Types given the XSD Schema object graph * @param xsmodel xml schema object graph based on Xerces Schema API * @param dirloc location to place the generated java source files * @param packageName package name for the types * @throws IOException */ public void generateJavaSource(XSModel xsmodel, File dirloc, String packageName) throws IOException; /** * Set the type mapping to be used in the generation * * @param tm */ public void setTypeMapping(LiteralTypeMapping tm); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/mapping/0000755000175000017500000000000010755000262026767 5ustar godgod././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/mapping/MappingFileGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/mapping/MappingFileGen0000644000175000017500000002207510736716066031564 0ustar godgod/* * 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.tools.mapping; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.xml.rpc.encoding.TypeMapping; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.Constants; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.tools.JavaWriter; import org.jboss.ws.tools.NamespacePackageMapping; import org.jboss.ws.tools.XSDTypeToJava; import org.jboss.ws.tools.XSDTypeToJava.VAR; import org.jboss.ws.tools.helpers.MappingFileGeneratorHelper; /** * Generates the JAXRPC Mapping file from the WSDL Definitions. *

      Guidance: *

      * If there is knowledge of the ServiceEndpointInterface (SEI) * as in serverside generation (Java->WSDL), will make use of it. *

      *

      * The TypeMapping needs to be provided externally. *

      * * @author Anil Saldhana * @since Apr 5, 2005 */ public class MappingFileGenerator { /** * WSDLDefinitions object that is the root of the WSDL object model */ protected WSDLDefinitions wsdlDefinitions; /** * Package Names to override */ protected Map namespacePackageMap; /** * Service Name */ protected String serviceName; /** * SEI Package Name to override */ protected String packageName; /** * Service Endpoint Interface (if available). *
      Will be available for server side generation (Java -> WSDL) */ protected Class serviceEndpointInterface = null; /** * Type Mapping that is input from outside */ protected LiteralTypeMapping typeMapping = null; protected String parameterStyle; public MappingFileGenerator(WSDLDefinitions wsdl, TypeMapping typeM) { this.wsdlDefinitions = wsdl; String targetNS = wsdl.getTargetNamespace(); packageName = NamespacePackageMapping.getJavaPackageName(targetNS); this.typeMapping = (LiteralTypeMapping)typeM; } /** * @return @see #wsdlDefinitions */ public WSDLDefinitions getWsdlDefinitions() { return wsdlDefinitions; } public void setWsdlDefinitions(WSDLDefinitions wsdlDefinitions) { this.wsdlDefinitions = wsdlDefinitions; } /** * @return @see #packageName */ public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } public Map getNamespacePackageMap() { return namespacePackageMap; } public void setNamespacePackageMap(Map map) { namespacePackageMap = map; } /** * @return @see #serviceName */ public String getServiceName() { return serviceName; } public void setServiceEndpointInterface(Class serviceEndpointInterface) { this.serviceEndpointInterface = serviceEndpointInterface; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public void setParameterStyle(String paramStyle) { this.parameterStyle = paramStyle; } /** * Method that generates the jaxrpc mapping metadata *
      Guidance:
      *

      If you need the metadata serialized, please use: * @see JavaWsdlMapping#serialize() *

      * @throws IOException * @throws IllegalArgumentException mappingfilename is null */ public JavaWsdlMapping generate() throws IOException { MappingFileGeneratorHelper helper = new MappingFileGeneratorHelper(this.wsdlDefinitions, this.serviceName, this.namespacePackageMap, this.serviceEndpointInterface, this.typeMapping, this.parameterStyle); JavaWsdlMapping jwm = new JavaWsdlMapping(); //If the schema has types, we will need to generate the java/xml type mapping helper.constructJavaXmlTypeMapping(jwm); WSDLService[] services = wsdlDefinitions.getServices(); int lenServices = 0; if (services != null) lenServices = services.length; for (int i = 0; i < lenServices; i++) { WSDLService wsdlService = services[i]; jwm.addServiceInterfaceMappings(helper.constructServiceInterfaceMapping(jwm, wsdlService)); helper.constructServiceEndpointInterfaceMapping(jwm, wsdlService); } // Add package to namespace mapping after helper has generated the rest of the file. String targetNS = wsdlDefinitions.getTargetNamespace(); String typeNamespace = helper.getTypeNamespace(); if (typeNamespace == null) typeNamespace = targetNS; //Construct package mapping //Check if the user has provided a typeNamespace if (typeNamespace != null && typeNamespace.equals(targetNS) == false || isServerSideGeneration()) jwm.addPackageMapping(helper.constructPackageMapping(jwm, getPackageName(typeNamespace), typeNamespace)); jwm.addPackageMapping(helper.constructPackageMapping(jwm, getPackageName(targetNS), targetNS)); return jwm; } public void generateJavaSourceFileForRequestResponseStruct(File location, ServiceEndpointInterfaceMapping seim, JBossXSModel xsmodel, String typeNamespace) throws IOException { WSDLUtils utils = WSDLUtils.getInstance(); XSDTypeToJava xst = new XSDTypeToJava(); xst.setTypeMapping(this.typeMapping); xst.setPackageName(getPackageName(typeNamespace)); ServiceEndpointMethodMapping[] mapArr = seim.getServiceEndpointMethodMappings(); int len = mapArr != null ? mapArr.length : 0; for (int i = 0; i < len; i++) { ServiceEndpointMethodMapping mm = mapArr[i]; String opname = mm.getJavaMethodName(); String sei = seim.getServiceEndpointInterface(); String plainClassName = utils.getJustClassName(sei); String classname = plainClassName + "_" + opname + "_RequestStruct"; List listInputs = new ArrayList(); MethodParamPartsMapping[] mppmarr = mm.getMethodParamPartsMappings(); int lenmppmarr = mppmarr != null ? mppmarr.length : 0; for (int j = 0; j < lenmppmarr; j++) { listInputs.addAll(xst.getVARList((XSComplexTypeDefinition)xsmodel.getTypeDefinition(opname, typeNamespace), xsmodel, false)); } JavaWriter jw = new JavaWriter(); jw.createJavaFile(location, classname, getPackageName(typeNamespace), listInputs, null, null, false, null); classname = plainClassName + "_" + opname + "_ResponseStruct"; XSTypeDefinition xt = xsmodel.getTypeDefinition(opname + "Response", typeNamespace); List listOutputs = new ArrayList(); if (xt instanceof XSSimpleTypeDefinition) { listOutputs.add(new VAR(Constants.DEFAULT_RPC_RETURN_NAME, xt.getName(), false)); } else listOutputs.addAll(xst.getVARList((XSComplexTypeDefinition)xt, xsmodel, false)); jw.createJavaFile(location, classname, getPackageName(typeNamespace), listOutputs, null, null, false, null); } } //PRIVATE METHODS private boolean isServerSideGeneration() { return this.serviceEndpointInterface != null; } private String getPackageName(String targetNamespace) { //Get it from global config if (namespacePackageMap != null) { String pkg = namespacePackageMap.get(targetNamespace); if (pkg != null) { return pkg; } } //Default behaviour will always generate all classes in the SEI package only return packageName; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/0000755000175000017500000000000010755000263026777 5ustar godgod././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/ReturnTypeUnwr0000644000175000017500000001034210551741510031720 0ustar godgod/* * 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.tools.helpers; import javax.xml.namespace.QName; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; /** * A helper class to unwrap a return type is possible. * * @author darran.lofthouse@jboss.com * @since 10 Dec 2006 */ public class ReturnTypeUnwrapper { public JBossXSModel xsmodel; public QName xmlType; public XSElementDeclaration unwrappedElement; public boolean array = false; public boolean primitive = false; private boolean wrapped; public ReturnTypeUnwrapper(QName xmlType, JBossXSModel xsmodel, boolean wrapped) { this.xmlType = xmlType; this.xsmodel = xsmodel; this.wrapped = wrapped; } public boolean unwrap() { if (wrapped == false) return false; XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); if (xt instanceof XSComplexTypeDefinition == false) throw new WSException("[JAX-RPC 2.3.1.2] Tried to unwrap a non-complex type."); XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt; boolean hasAttributes = wrapper.getAttributeUses().getLength() > 0; if (hasAttributes) throw new WSException("[JAX-RPC 2.3.1.2] Can not unwrap, complex type contains attributes."); boolean unwrapped = false; XSParticle particle = wrapper.getParticle(); if (particle != null) { XSTerm term = particle.getTerm(); if (term instanceof XSModelGroup == false) throw new WSException("[JAX-RPC 2.3.1.2] Expected model group, could not unwrap"); XSModelGroup group = (XSModelGroup)term; unwrapped = unwrapModelGroup(group); } return unwrapped; } private boolean unwrapModelGroup(XSModelGroup group) { XSObjectList particles = group.getParticles(); if (particles.getLength() == 1) { XSParticle particle = (XSParticle)particles.item(0); boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1; XSTerm term = particle.getTerm(); if (term instanceof XSModelGroup) { return unwrapModelGroup((XSModelGroup)term); } else if (term instanceof XSElementDeclaration) { unwrappedElement = (XSElementDeclaration)term; XSTypeDefinition type = unwrappedElement.getTypeDefinition(); if (type.getAnonymous() == false) xmlType = new QName(unwrappedElement.getTypeDefinition().getNamespace(), unwrappedElement.getTypeDefinition().getName()); this.array = array; primitive = !(unwrappedElement.getNillable() || (particle.getMinOccurs() == 0 && particle.getMaxOccurs() == 1)); } } else { throw new WSException("[JAX-RPC 2.3.1.2] Unable to unwrap model group with multiple particles."); } return unwrappedElement != null; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/JavaToXSDHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/JavaToXSDHelpe0000644000175000017500000000655710542776150031471 0ustar godgod/* * 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.tools.helpers; import java.util.Map; import javax.xml.namespace.QName; import org.apache.xerces.xs.XSModel; import org.jboss.ws.Constants; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.ws.tools.interfaces.SchemaCreatorIntf; import org.jboss.ws.tools.schema.SchemaTypeCreator; /** * Helper class used by the JavaToXSD subsystem * @author Anil Saldhana * @since Aug 8, 2005 */ public class JavaToXSDHelper { protected WSDLUtils utils = WSDLUtils.getInstance(); protected SchemaUtils schemautils = SchemaUtils.getInstance(); private SchemaCreatorIntf creator = null; private String wsdlStyle = Constants.RPC_LITERAL; protected String jaxwsAssert = "JAXRPC2.0 Assertion:"; public JavaToXSDHelper() { creator = new SchemaTypeCreator(); } /** * Given a XMLType and a JavaType, generate a JBossXSModel * @param xmlType QName of the XMLType * @param javaType Class Type * @param targetNamespace * @return JBossXSModel * @throws IllegalArgumentException if targetNamespace is null */ public JBossXSModel generateXSModel(QName xmlType, Class javaType, String targetNamespace) { if(targetNamespace == null) throw new IllegalArgumentException("Illegal Null Argument: targetNamespace"); XSModel xsmodel = creator.getXSModel(); if(xsmodel == null) creator.setXSModel(new JBossXSModel()); // Special case: if javaType is a Standard jaxrpc holder Class cls = utils.getJavaTypeForHolder(javaType); if(cls != null) return null; creator.generateType(null, javaType ); return creator.getXSModel(); } /** * Get the SchemaCreator * * @return */ public SchemaCreatorIntf getSchemaCreator() { return creator; } /** * Get the WSDL Style * * @return */ public String getWsdlStyle() { return wsdlStyle; } /** * A customized Package->Namespace map * * @param map */ public void setPackageNamespaceMap(Map map) { creator.setPackageNamespaceMap(map); } /** * Set the WSDL Style * * @param wsdlStyle */ public void setWsdlStyle(String wsdlStyle) { this.wsdlStyle = wsdlStyle; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/ReformatXML.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/ReformatXML.ja0000644000175000017500000000405110650145103031450 0ustar godgod/* * 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.tools.helpers; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * @author Heiko Braun * @version $Id: ReformatXML.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ * @since Sep 27, 2006 */ public class ReformatXML { public static void main(String[] args) throws Exception { if(args.length == 0) throw new IllegalArgumentException("Please specify a filename"); ReformatXML formatter = new ReformatXML(); try { FileInputStream in = new FileInputStream(args[0]); System.out.println( formatter.reformat(in)); } catch (FileNotFoundException e) { System.err.println("Failed to read from file " + args[0] +": "+e.getMessage()); } } public String reformat(InputStream in) throws Exception { Element root = DOMUtils.parse(in); return DOMWriter.printNode(root, true); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/ToolsHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/ToolsHelper.ja0000644000175000017500000003664310736716066031605 0ustar godgod/* * 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.tools.helpers; import java.io.File; import java.io.IOException; import java.io.Writer; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.core.soap.Style; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.tools.Configuration; import org.jboss.ws.tools.JavaToWSDL; import org.jboss.ws.tools.JavaWriter; import org.jboss.ws.tools.NamespacePackageMapping; import org.jboss.ws.tools.WSDLToJava; import org.jboss.ws.tools.WebservicesXMLCreatorImpl; import org.jboss.ws.tools.Configuration.GlobalConfig; import org.jboss.ws.tools.Configuration.JavaToWSDLConfig; import org.jboss.ws.tools.Configuration.WSDLToJavaConfig; import org.jboss.ws.tools.XSDTypeToJava.VAR; import org.jboss.ws.tools.client.ServiceCreator; import org.jboss.ws.tools.interfaces.WebservicesXMLCreator; import org.jboss.ws.tools.mapping.MappingFileGenerator; import org.jboss.ws.tools.wsdl.WSDLWriter; import org.jboss.wsf.common.JavaUtils; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.*; /** * Helper class used by the cmd line tool "jbossws" * and ant task "wstools" * @author Anil Saldhana * @since Aug 19, 2005 */ public class ToolsHelper { private static Logger log = Logger.getLogger(ToolsHelper.class); /** * Java To WSDL Generation [Serverside Generation] * * @param config * @param outDir * @throws IOException */ public void handleJavaToWSDLGeneration(Configuration config, String outDir) throws IOException { JavaToWSDLConfig j2wc = config.getJavaToWSDLConfig(false); JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11); jwsdl.setServiceName(j2wc.serviceName); jwsdl.setTargetNamespace(j2wc.targetNamespace); jwsdl.setTypeNamespace(j2wc.typeNamespace); jwsdl.setOperationMap(j2wc.operations); if ("document".equals(j2wc.wsdlStyle)) jwsdl.setStyle(Style.DOCUMENT); else if ("rpc".equals(j2wc.wsdlStyle)) jwsdl.setStyle(Style.RPC); else throw new WSException("Unrecognized Style:" + j2wc.wsdlStyle); if ("wrapped".equals(j2wc.parameterStyle)) jwsdl.setParameterStyle(ParameterStyle.WRAPPED); else if ("bare".equals(j2wc.parameterStyle)) jwsdl.setParameterStyle(ParameterStyle.BARE); else throw new WSException("Unrecognized Parameter Style:" + j2wc.parameterStyle); Class endpointClass = loadClass(j2wc.endpointName); if (endpointClass == null) throw new WSException("Endpoint " + j2wc.endpointName + " cannot be loaded"); //Take care of passing global config details GlobalConfig gcfg = config.getGlobalConfig(false); if (gcfg != null) { if (gcfg.packageNamespaceMap != null) jwsdl.setPackageNamespaceMap(gcfg.packageNamespaceMap); } WSDLDefinitions wsdl = jwsdl.generate(endpointClass); //Create the WSDL Directory createDir(outDir + "/wsdl"); String wsdlPath = outDir + "/wsdl/" + j2wc.serviceName + ".wsdl"; //Generate the WSDL Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath), Constants.DEFAULT_XML_CHARSET); new WSDLWriter(wsdl).write(fw, Constants.DEFAULT_XML_CHARSET); fw.close(); //Generate the Mapping File if (j2wc.mappingFileNeeded) { UnifiedMetaData unifiedMetaData = jwsdl.getUnifiedMetaData(); JavaWsdlMapping mapping = jwsdl.getJavaWsdlMapping(); createWrapperTypes(j2wc, outDir, unifiedMetaData, mapping, endpointClass); Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" + j2wc.mappingFileName), Constants.DEFAULT_XML_CHARSET); writer.write(Constants.XML_HEADER); writer.write(DOMWriter.printNode(DOMUtils.parse(mapping.serialize()), true)); writer.close(); } //Generate the webservices.xml file if (j2wc.wsxmlFileNeeded) { WebservicesXMLCreator wscr = new WebservicesXMLCreatorImpl(); wscr.setTargetNamespace(j2wc.targetNamespace); //wscr.setLocation(new File(outDir).toURL()); wscr.setSeiName(j2wc.endpointName); wscr.setServiceName(j2wc.serviceName); //Get the portname from wsdl definitions WSDLService wsdlService = wsdl.getService(j2wc.serviceName); String portName = wsdlService.getEndpoints()[0].getName().getLocalPart(); //wscr.setPortName(j2wc.serviceName + "Port"); wscr.setPortName(portName); //wscr.setMappingFileName(j2wc.mappingFileName); if (j2wc.servletLink != null) { wscr.setMappingFile("WEB-INF/" + j2wc.mappingFileName); wscr.setWsdlFile("WEB-INF/wsdl/" + j2wc.serviceName + ".wsdl"); wscr.setServletLink(j2wc.servletLink); } else { wscr.setMappingFile("META-INF/" + j2wc.mappingFileName); wscr.setWsdlFile("META-INF/wsdl/" + j2wc.serviceName + ".wsdl"); wscr.setEjbLink(j2wc.ejbLink); } wscr.setAppend(j2wc.wsxmlFileAppend); wscr.generateWSXMLDescriptor(new File(outDir + "/webservices.xml")); } } private void createWrapperTypes(JavaToWSDLConfig j2wc, String outDir, UnifiedMetaData wsMetaData, JavaWsdlMapping mapping, Class endpointClass) throws IOException { Map index = indexMappingTypes(mapping); EndpointMetaData epMetaData = null; for (ServiceMetaData service : wsMetaData.getServices()) { epMetaData = service.getEndpointByServiceEndpointInterface(j2wc.endpointName); if (epMetaData != null) break; } if (epMetaData == null) throw new WSException("Could not find endpoint in metadata: " + j2wc.endpointName); String packageName = endpointClass.getPackage().getName(); ClassLoader classLoader = wsMetaData.getClassLoader(); for (OperationMetaData opMetaData : epMetaData.getOperations()) { if (opMetaData.isDocumentWrapped()) { for (ParameterMetaData parameter : opMetaData.getParameters()) { String name = endpointClass.getSimpleName() + "_" + opMetaData.getQName().getLocalPart() + "_RequestStruct"; createWrapperType(parameter, name, packageName, index, classLoader, outDir); } ParameterMetaData returnParameter = opMetaData.getReturnParameter(); if (returnParameter != null) { String name = endpointClass.getSimpleName() + "_" + opMetaData.getQName().getLocalPart() + "_ResponseStruct"; createWrapperType(returnParameter, name, packageName, index, classLoader, outDir); } } } } private void createWrapperType(ParameterMetaData parameter, String name, String packageName, Map mappingIndex, ClassLoader classLoader, String outDir) throws IOException { List wrappedParameters = parameter.getWrappedParameters(); if (wrappedParameters == null) return; List vars = new ArrayList(); for (WrappedParameter wrapped : wrappedParameters) { String typeName = JavaUtils.convertJVMNameToSourceName(wrapped.getType(), classLoader); vars.add(new VAR(wrapped.getVariable(), typeName, false)); } JavaWriter writer = new JavaWriter(); writer.createJavaFile(new File(outDir), name + ".java", packageName, vars, null, null, false, null); JavaXmlTypeMapping type = mappingIndex.get(parameter.getXmlType()); if (type == null) throw new WSException("JAX-RPC mapping metadata is missing a wrapper type: " + parameter.getXmlType()); type.setJavaType(packageName + "." + name); } private Map indexMappingTypes(JavaWsdlMapping mapping) { Map index = new HashMap(); for (JavaXmlTypeMapping type : mapping.getJavaXmlTypeMappings()) { QName qname = type.getRootTypeQName(); if (qname == null) continue; index.put(qname, type); } return index; } /** * Client Side Generation [WSDL To Java] * * @param config * @param outDir */ public void handleWSDLToJavaGeneration(Configuration config, String outDir) { WSDLToJavaConfig w2jc = config.getWSDLToJavaConfig(false); GlobalConfig glc = config.getGlobalConfig(false); WSDLToJava wsdlToJava = new WSDLToJava(); wsdlToJava.setTypeMapping(new LiteralTypeMapping()); WSDLDefinitions wsdl = null; try { URL wsdlURL = null; try { wsdlURL = new URL(w2jc.wsdlLocation); } catch (MalformedURLException e) { // ignore } if (wsdlURL == null) { File wsdlFile = new File(w2jc.wsdlLocation); if (wsdlFile.exists()) { wsdlURL = wsdlFile.toURL(); } } if (wsdlURL == null) { ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); wsdlURL = ctxLoader.getResource(w2jc.wsdlLocation); } if (wsdlURL == null) throw new IllegalArgumentException("Cannot load wsdl: " + w2jc.wsdlLocation); wsdl = wsdlToJava.convertWSDL2Java(wsdlURL); if (glc != null) wsdlToJava.setNamespacePackageMap(glc.packageNamespaceMap); wsdlToJava.setParameterStyle(w2jc.parameterStyle); wsdlToJava.generateSEI(wsdl, new File(outDir)); //Generate the Service File this.generateServiceFile(getPackageName(wsdl, glc), wsdl, outDir); //Generate the Mapping File if (w2jc.mappingFileNeeded) { MappingFileGenerator mgf = new MappingFileGenerator(wsdl, new LiteralTypeMapping()); if (glc != null && glc.packageNamespaceMap != null) mgf.setNamespacePackageMap(glc.packageNamespaceMap); mgf.setServiceName(wsdl.getServices()[0].getName().getLocalPart()); mgf.setParameterStyle(w2jc.parameterStyle); JavaWsdlMapping jwm = mgf.generate(); Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" + w2jc.mappingFileName), Constants.DEFAULT_XML_CHARSET); writer.write(Constants.XML_HEADER); writer.write(DOMWriter.printNode(DOMUtils.parse(jwm.serialize()), true)); writer.close(); } //Generate the webservices.xml file if (w2jc.wsxmlFileNeeded) { String seiName = "mypackage.MyServiceEndpointInterface"; String serviceName = "MyServiceName"; if (wsdl.getServices().length == 1) serviceName = wsdl.getServices()[0].getName().getLocalPart(); if (wsdl.getInterfaces().length == 1) { String seiPackage = getPackageName(wsdl, glc); seiName = seiPackage + "." + wsdlToJava.getServiceEndpointInterfaceName(wsdl.getInterfaces()[0]); } WebservicesXMLCreator wscr = new WebservicesXMLCreatorImpl(); wscr.setTargetNamespace(wsdl.getTargetNamespace()); wscr.setSeiName(seiName); wscr.setServiceName(serviceName); WSDLService wsdlService = wsdl.getService(serviceName); String portName = wsdlService.getEndpoints()[0].getName().getLocalPart(); wscr.setPortName(portName); String wsdlShortName = wsdlURL.getPath(); wsdlShortName = wsdlShortName.substring(wsdlShortName.lastIndexOf("/")); if (w2jc.servletLink != null) { wscr.setMappingFile("WEB-INF/" + w2jc.mappingFileName); wscr.setWsdlFile("WEB-INF/wsdl" + wsdlShortName); wscr.setServletLink(w2jc.servletLink); } else { wscr.setMappingFile("META-INF/" + w2jc.mappingFileName); wscr.setWsdlFile("META-INF/wsdl" + wsdlShortName); wscr.setEjbLink(w2jc.ejbLink); } wscr.generateWSXMLDescriptor(new File(outDir + "/webservices.xml")); } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException(ex); } } //PRIVATE METHODS private Class loadClass(String cls) { Class clazz = null; try { clazz = Thread.currentThread().getContextClassLoader().loadClass(cls); } catch (ClassNotFoundException e) { log.error("Cannot load endpoint:" + e.getLocalizedMessage()); } return clazz; } private void generateServiceFile(String packageName, WSDLDefinitions wsdl, String location) throws IOException { ServiceCreator sc = new ServiceCreator(); sc.setPackageName(packageName); sc.setDirLocation(new File(location)); sc.setWsdl(wsdl); sc.createServiceDescriptor(); } private String getPackageName(WSDLDefinitions wsdl, GlobalConfig glc) { String targetNamespace = wsdl.getTargetNamespace(); //Get it from global config if it is overriden if (glc != null && glc.packageNamespaceMap != null) { String pkg = glc.packageNamespaceMap.get(targetNamespace); if (pkg != null) { return pkg; } } return NamespacePackageMapping.getJavaPackageName(targetNamespace); } private void createDir(String path) { File file = new File(path); if (file.exists() == false) file.mkdirs(); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/MappingFileGen0000644000175000017500000011251310736716066031570 0ustar godgod/* * 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.tools.helpers; import java.beans.Introspector; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import org.apache.xerces.xs.XSAttributeDeclaration; import org.apache.xerces.xs.XSAttributeUse; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping; import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping; import org.jboss.ws.metadata.jaxrpcmapping.PortMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceInterfaceMapping; import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping; import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping; import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceMessageReference; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLProperty; import org.jboss.ws.metadata.wsdl.WSDLRPCPart; import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLTypes; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.ws.tools.HeaderUtil; import org.jboss.ws.tools.NamespacePackageMapping; import org.jboss.ws.tools.RPCSignature; import org.jboss.ws.tools.ToolsUtils; import org.jboss.ws.tools.WSToolsConstants; import org.jboss.ws.tools.mapping.MappingFileGenerator; import org.jboss.wsf.common.JavaUtils; import org.w3c.dom.Element; /** * Helper class for MappingFileGenerator (only client of this class) * @see MappingFileGenerator * @author Anil Saldhana * @since Sep 18, 2005 */ public class MappingFileGeneratorHelper { // provide logging private static final Logger log = Logger.getLogger(MappingFileGeneratorHelper.class); private WSDLDefinitions wsdlDefinitions = null; private String typeNamespace; private String serviceName = null; private String packageName = null; private Map namespacePackageMap = null; private Set registeredTypes = new HashSet(); private Set registeredExceptions = new HashSet(); private LiteralTypeMapping typeMapping = null; private String wsdlStyle; private WSDLUtils utils = WSDLUtils.getInstance(); private String parameterStyle; public MappingFileGeneratorHelper(WSDLDefinitions wsdl, String sname, Map map, Class seiClass, LiteralTypeMapping ltm, String paramStyle) { this.wsdlDefinitions = wsdl; this.serviceName = sname; String targetNS = wsdl.getTargetNamespace(); packageName = NamespacePackageMapping.getJavaPackageName(targetNS); this.namespacePackageMap = map; this.typeMapping = ltm; this.wsdlStyle = utils.getWSDLStyle(wsdl); this.parameterStyle = paramStyle; checkEssentials(); } /** * Returns the type namespace that was discovered during generation. */ public String getTypeNamespace() { return typeNamespace; } public PackageMapping constructPackageMapping(JavaWsdlMapping jwm, String packageType, String ns) { PackageMapping pk = new PackageMapping(jwm); pk.setPackageType(packageType); pk.setNamespaceURI(ns); return pk; } public ServiceInterfaceMapping constructServiceInterfaceMapping(JavaWsdlMapping jwm, WSDLService ser) { serviceName = ser.getName().getLocalPart(); String javaServiceName = serviceName; //Check if the serviceName conflicts with a portType or interface name if (wsdlDefinitions.getInterface(new QName(wsdlDefinitions.getTargetNamespace(), serviceName)) != null) javaServiceName += "_Service"; if (this.serviceName == null || serviceName.length() == 0) throw new IllegalArgumentException("MappingFileGenerator:Service Name is null"); String targetNS = wsdlDefinitions.getTargetNamespace(); String prefix = WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_SERVICE_PREFIX; ServiceInterfaceMapping sim = new ServiceInterfaceMapping(jwm); sim.setServiceInterface(getPackageName(targetNS) + "." + javaServiceName); sim.setWsdlServiceName(new QName(targetNS, serviceName, prefix)); WSDLEndpoint[] endpoints = ser.getEndpoints(); int lenendpoints = 0; if (endpoints != null) lenendpoints = endpoints.length; for (int j = 0; j < lenendpoints; j++) { WSDLEndpoint endpt = endpoints[j]; String portname = endpt.getName().getLocalPart(); //port mapping PortMapping pm = new PortMapping(sim); pm.setPortName(portname); pm.setJavaPortName(portname); sim.addPortMapping(pm); } return sim; } public void constructServiceEndpointInterfaceMapping(JavaWsdlMapping jwm, WSDLService ser) { serviceName = ser.getName().getLocalPart(); if (this.serviceName == null || serviceName.length() == 0) throw new IllegalArgumentException("MappingFileGenerator:Service Name is null"); String targetNS = wsdlDefinitions.getTargetNamespace(); WSDLEndpoint[] endpoints = ser.getEndpoints(); int lenendpoints = 0; if (endpoints != null) lenendpoints = endpoints.length; for (int j = 0; j < lenendpoints; j++) { WSDLEndpoint endpt = endpoints[j]; QName binding = endpt.getBinding(); WSDLBinding wsdlbind = wsdlDefinitions.getBinding(binding); String bindName = wsdlbind.getName().getLocalPart(); QName portTypeName = wsdlbind.getInterfaceName(); WSDLInterface wsdlintf = wsdlDefinitions.getInterface(portTypeName); String portName = wsdlintf.getName().getLocalPart(); String javaPortName = utils.chopPortType(portName); if (wsdlDefinitions.getService(javaPortName) != null) javaPortName += "_PortType"; ServiceEndpointInterfaceMapping seim = new ServiceEndpointInterfaceMapping(jwm); seim.setServiceEndpointInterface(getPackageName(targetNS) + "." + javaPortName); seim.setWsdlPortType(new QName(targetNS, portName, "portTypeNS")); seim.setWsdlBinding(new QName(targetNS, bindName, "bindingNS")); constructServiceEndpointMethodMapping(seim, wsdlintf); jwm.addServiceEndpointInterfaceMappings(seim); } } public void constructServiceEndpointMethodMapping(ServiceEndpointInterfaceMapping seim, WSDLInterface intf) { WSDLInterfaceOperation[] wioparr = intf.getOperations(); int len = 0; if (wioparr != null) len = wioparr.length; for (int j = 0; j < len; j++) { WSDLInterfaceOperation wiop = wioparr[j]; String opname = wiop.getName().getLocalPart(); ServiceEndpointMethodMapping semm = new ServiceEndpointMethodMapping(seim); semm.setJavaMethodName(ToolsUtils.firstLetterLowerCase(opname)); semm.setWsdlOperation(opname); semm.setWrappedElement(isWrapped()); WSDLBindingOperation bindingOperation = HeaderUtil.getWSDLBindingOperation(wsdlDefinitions, wiop); if (isDocStyle()) { constructDOCParameters(semm, wiop, bindingOperation); } else { constructRPCParameters(semm, wiop, bindingOperation); } seim.addServiceEndpointMethodMapping(semm); } } private void constructDOCParameters(ServiceEndpointMethodMapping semm, WSDLInterfaceOperation wiop, WSDLBindingOperation bindingOperation) { WSDLInterfaceOperationInput win = WSDLUtils.getWsdl11Input(wiop); WSDLInterfaceOperationOutput output = WSDLUtils.getWsdl11Output(wiop); JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes()); MethodParamPartsMapping mpin = null; boolean holder = false; if (win != null) { QName xmlName = win.getElement(); QName xmlType = win.getXMLType(); String partName = win.getPartName(); String wsdlMessageName = win.getMessageName().getLocalPart(); XSTypeDefinition xt = schemaModel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); boolean wrapped = isWrapped(); if (wrapped) { wrapped = unwrapRequest(semm, wsdlMessageName, xmlName.getLocalPart(), xt); } if (wrapped == false) { if (xt instanceof XSSimpleTypeDefinition) xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt); String paramMode = "IN"; holder = output != null && xmlName.equals(output.getElement()); if (holder == true) { paramMode = "INOUT"; } mpin = getMethodParamPartsMapping(semm, xmlName, xmlType, 0, wsdlMessageName, paramMode, partName, false, true); semm.addMethodParamPartsMapping(mpin); } } if (holder == false && output != null) { QName xmlName = output.getElement(); QName xmlType = output.getXMLType(); boolean primitive = true; String targetNS = wsdlDefinitions.getTargetNamespace(); QName messageName = new QName(targetNS, output.getMessageName().getLocalPart(), WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS); String partName = output.getPartName(); String containingElement = xmlName.getLocalPart(); boolean array = false; XSTypeDefinition xt = schemaModel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); ReturnTypeUnwrapper unwrapper = new ReturnTypeUnwrapper(xmlType, schemaModel, isWrapped()); if (unwrapper.unwrap()) { if (unwrapper.unwrappedElement != null) { XSElementDeclaration element = unwrapper.unwrappedElement; xt = element.getTypeDefinition(); primitive = unwrapper.primitive; partName = element.getName(); containingElement = containingElement + ToolsUtils.firstLetterUpperCase(unwrapper.unwrappedElement.getName()); array = unwrapper.array; if (xt.getAnonymous()) { xmlType = new QName(containingElement); } else if (unwrapper.xmlType != null) { xmlType = unwrapper.xmlType; } } } //Check it is a holder. if (wiop.getInputByPartName(xmlName.getLocalPart()) == null) { String nameSpace = null; if (xt != null) { nameSpace = xt.getNamespace(); } if (xt instanceof XSSimpleTypeDefinition) xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt); String javaType = getJavaTypeAsString(xmlName, xmlType, nameSpace, array, primitive); if ((isDocStyle() == false && "void".equals(javaType)) == false) { WsdlReturnValueMapping wrvm = new WsdlReturnValueMapping(semm); wrvm.setMethodReturnValue(javaType); wrvm.setWsdlMessage(messageName); wrvm.setWsdlMessagePartName(partName); semm.setWsdlReturnValueMapping(wrvm); } } } if (bindingOperation != null) { constructHeaderParameters(semm, wiop, bindingOperation); } } private void constructHeaderParameters(ServiceEndpointMethodMapping semm, WSDLInterfaceOperation wiop, WSDLBindingOperation bindingOperation) { WSDLSOAPHeader[] inputHeaders = HeaderUtil.getSignatureHeaders(bindingOperation.getInputs()); WSDLSOAPHeader[] outputHeaders = HeaderUtil.getSignatureHeaders(bindingOperation.getOutputs()); String wsdlMessageName = bindingOperation.getWsdlBinding().getInterface().getName().getLocalPart(); int paramPosition = 1; for (WSDLSOAPHeader currentInput : inputHeaders) { boolean inOutput = HeaderUtil.containsMatchingPart(outputHeaders, currentInput); String mode = getMode(true, inOutput); constructHeaderParameter(semm, currentInput, paramPosition++, wsdlMessageName, mode); } for (WSDLSOAPHeader currentOutput : outputHeaders) { boolean inInput = HeaderUtil.containsMatchingPart(inputHeaders, currentOutput); if (inInput == true) continue; constructHeaderParameter(semm, currentOutput, paramPosition++, wsdlMessageName, "OUT"); } } private void constructHeaderParameter(ServiceEndpointMethodMapping semm, WSDLSOAPHeader header, int paramPosition, String wsdlMessageName, String mode) { QName elementName = header.getElement(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes()); XSElementDeclaration xe = xsmodel.getElementDeclaration(elementName.getLocalPart(), elementName.getNamespaceURI()); XSTypeDefinition xt = xe.getTypeDefinition(); WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes(); QName xmlType = wsdlTypes.getXMLType(header.getElement()); // Replace the xt with the real type from the schema. xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); if (xt instanceof XSSimpleTypeDefinition) xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt); String partName = header.getPartName(); MethodParamPartsMapping mpin = getMethodParamPartsMapping(semm, elementName, xmlType, paramPosition, wsdlMessageName, mode, partName, false, true); semm.addMethodParamPartsMapping(mpin); } private String getMode(final boolean input, final boolean output) { if (input == true & output == true) { return "INOUT"; } else if (input == true) { return "IN"; } else if (output == true) { return "OUT"; } return ""; } private String getMode(WSDLInterfaceOperation op, String name) { WSDLInterfaceOperationInput in = WSDLUtils.getWsdl11Input(op); WSDLInterfaceOperationOutput out = WSDLUtils.getWsdl11Output(op); boolean i = false, o = false; if (in != null && in.getChildPart(name) != null) i = true; if (out != null && out.getChildPart(name) != null) o = true; if (i && o) return "INOUT"; if (o) return "OUT"; return "IN"; } private void constructRPCParameters(ServiceEndpointMethodMapping semm, WSDLInterfaceOperation wiop, WSDLBindingOperation bindingOperation) { WSDLInterfaceOperationInput win = WSDLUtils.getWsdl11Input(wiop); if (win == null) throw new WSException("RPC endpoints require an input message"); String wsdlMessageName = win.getMessageName().getLocalPart(); JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes()); RPCSignature signature = new RPCSignature(wiop); int i = 0; for (WSDLRPCPart part : signature.parameters()) { String partName = part.getName(); QName xmlName = new QName(partName); QName xmlType = part.getType(); XSTypeDefinition xt = schemaModel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); if (xt instanceof XSSimpleTypeDefinition) xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt); MethodParamPartsMapping mpin = getMethodParamPartsMapping(semm, xmlName, xmlType, i++, wsdlMessageName, getMode(wiop, part.getName()), partName, false, true); semm.addMethodParamPartsMapping(mpin); } WSDLRPCPart returnParameter = signature.returnParameter(); if (returnParameter != null) { String partName = returnParameter.getName(); QName xmlName = new QName(partName); QName xmlType = returnParameter.getType(); XSTypeDefinition xt = schemaModel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); String nameSpace = null; if (xt != null) { nameSpace = xt.getNamespace(); } if (xt instanceof XSSimpleTypeDefinition) { xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt); } WsdlReturnValueMapping wrvm = new WsdlReturnValueMapping(semm); wrvm.setMethodReturnValue(getJavaTypeAsString(xmlName, xmlType, nameSpace, false, true)); QName messageName = WSDLUtils.getWsdl11Output(wiop).getMessageName(); wrvm.setWsdlMessage(new QName(messageName.getNamespaceURI(), messageName.getLocalPart(), WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS)); wrvm.setWsdlMessagePartName(partName); semm.setWsdlReturnValueMapping(wrvm); } if (bindingOperation != null) { constructHeaderParameters(semm, wiop, bindingOperation); } } public void constructJavaXmlTypeMapping(JavaWsdlMapping jwm) { WSDLInterface[] intfArr = wsdlDefinitions.getInterfaces(); int len = intfArr != null ? intfArr.length : 0; for (int i = 0; i < len; i++) { WSDLInterface wi = intfArr[i]; WSDLInterfaceOperation[] ops = wi.getOperations(); int lenOps = ops.length; for (int j = 0; j < lenOps; j++) { WSDLInterfaceOperation op = ops[j]; for (WSDLInterfaceOperationInput input : op.getInputs()) { if (isDocStyle()) { XSTypeDefinition xt = getXSType(input); // Don't unwrap the actual parameter. addJavaXMLTypeMap(xt, input.getElement().getLocalPart(), "", "", jwm, false); } else { for (WSDLRPCPart part : input.getChildParts()) addJavaXMLTypeMap(getXSType(part.getType()), input.getElement().getLocalPart(), "", "", jwm, true); } } for (WSDLInterfaceOperationOutput output : op.getOutputs()) { if (isDocStyle()) { XSTypeDefinition xt = getXSType(output); // Don't unwrap the response type. addJavaXMLTypeMap(xt, output.getElement().getLocalPart(), "", "", jwm, false); } else { for (WSDLRPCPart part : output.getChildParts()) addJavaXMLTypeMap(getXSType(part.getType()), output.getElement().getLocalPart(), "", "", jwm, true); } } for (WSDLInterfaceFault fault : wi.getFaults()) { QName xmlType = fault.getXmlType(); QName xmlName = fault.getElement(); WSDLTypes types = wsdlDefinitions.getWsdlTypes(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types); XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); addJavaXMLTypeMap(xt, xmlName.getLocalPart(), "", "", jwm, true); String exceptionType = getJavaTypeAsString(null, xmlType, xt.getNamespace(), false, true); if (registeredExceptions.contains(exceptionType) == false) { registeredExceptions.add(exceptionType); ExceptionMapping exceptionMapping = new ExceptionMapping(jwm); exceptionMapping.setExceptionType(exceptionType); exceptionMapping.setWsdlMessage(fault.getName()); jwm.addExceptionMappings(exceptionMapping); } } WSDLBindingOperation bindingOperation = HeaderUtil.getWSDLBindingOperation(wsdlDefinitions, op); if (bindingOperation != null) { constructHeaderJavaXmlTypeMapping(jwm, HeaderUtil.getSignatureHeaders(bindingOperation.getInputs())); constructHeaderJavaXmlTypeMapping(jwm, HeaderUtil.getSignatureHeaders(bindingOperation.getOutputs())); } }//end for } } public void constructHeaderJavaXmlTypeMapping(JavaWsdlMapping jwm, WSDLSOAPHeader[] headers) { for (WSDLSOAPHeader current : headers) { QName elementName = current.getElement(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes()); XSElementDeclaration xe = xsmodel.getElementDeclaration(elementName.getLocalPart(), elementName.getNamespaceURI()); XSTypeDefinition xt = xe.getTypeDefinition(); addJavaXMLTypeMap(xt, elementName.getLocalPart(), "", "", jwm, true); } } private boolean unwrapRequest(ServiceEndpointMethodMapping methodMapping, String messageName, String containingElement, XSTypeDefinition xt) { if (xt instanceof XSComplexTypeDefinition == false) throw new WSException("Tried to unwrap a non-complex type."); List partsMappings = new ArrayList(); XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt; if (wrapper.getAttributeUses().getLength() > 0) return false; boolean unwrappedElement = false; XSParticle particle = wrapper.getParticle(); if (particle == null) { return true; } else { XSTerm term = particle.getTerm(); if (term instanceof XSModelGroup) { unwrappedElement = unwrapGroup(partsMappings, methodMapping, messageName, containingElement, (XSModelGroup)term); } } if (unwrappedElement) { addMethodParamPartsMappings(partsMappings, methodMapping); return true; } return false; } private void addMethodParamPartsMappings(List partsMappings, ServiceEndpointMethodMapping methodMapping) { for (MethodParamPartsMapping current : partsMappings) { methodMapping.addMethodParamPartsMapping(current); } } private boolean unwrapGroup(List partsMappings, ServiceEndpointMethodMapping methodMapping, String messageName, String containingElement, XSModelGroup group) { if (group.getCompositor() != XSModelGroup.COMPOSITOR_SEQUENCE) return false; XSObjectList particles = group.getParticles(); for (int i = 0; i < particles.getLength(); i++) { XSParticle particle = (XSParticle)particles.item(i); XSTerm term = particle.getTerm(); if (term instanceof XSModelGroup) { if (unwrapGroup(partsMappings, methodMapping, messageName, containingElement, (XSModelGroup)term) == false) return false; } else if (term instanceof XSElementDeclaration) { XSElementDeclaration element = (XSElementDeclaration)term; XSTypeDefinition type = element.getTypeDefinition(); QName xmlName = new QName(element.getNamespace(), element.getName()); QName xmlType; if (type.getAnonymous()) { String tempName = ToolsUtils.firstLetterUpperCase(containingElement) + ToolsUtils.firstLetterUpperCase(element.getName()); xmlType = new QName(type.getNamespace(), tempName); } else { xmlType = new QName(type.getNamespace(), type.getName()); } boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1; boolean primitive = !(element.getNillable() || (particle.getMinOccurs() == 0 && particle.getMaxOccurs() == 1)); MethodParamPartsMapping part = getMethodParamPartsMapping(methodMapping, xmlName, xmlType, partsMappings.size(), messageName, "IN", xmlName.getLocalPart(), array, primitive); partsMappings.add(part); } } // If we reach here we must have successfully unwrapped the parameters. return true; } private void checkEssentials() { if (typeMapping == null) throw new WSException("typeMapping is null"); } private XSTypeDefinition getXSType(WSDLInterfaceMessageReference part) { //Check if there are any custom properties WSDLInterfaceOperation op = part.getWsdlOperation(); String zeroarg1 = null; String zeroarg2 = null; WSDLProperty prop1 = op.getProperty(Constants.WSDL_PROPERTY_ZERO_ARGS); if (prop1 != null) zeroarg1 = prop1.getValue(); if (zeroarg1 != null && zeroarg2 != null && zeroarg1.equals(zeroarg2) == false) return null; if (zeroarg1 != null && "true".equals(zeroarg1)) return null; QName xmlType = part.getXMLType(); WSDLTypes types = wsdlDefinitions.getWsdlTypes(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types); return xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); } private XSTypeDefinition getXSType(QName xmlType) { WSDLTypes types = wsdlDefinitions.getWsdlTypes(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types); return xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); } private void addJavaXMLTypeMap(XSTypeDefinition xt, String name, String containingElement, String containingType, JavaWsdlMapping jwm, boolean skipWrapperArray) { JavaXmlTypeMapping jxtm = null; if (xt instanceof XSComplexTypeDefinition) { XSModelGroup xm = null; XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xt; if (xc.getContentType() != XSComplexTypeDefinition.CONTENTTYPE_EMPTY) { XSParticle xp = xc.getParticle(); if (xp != null) { XSTerm xterm = xp.getTerm(); if (xterm instanceof XSModelGroup) xm = (XSModelGroup)xterm; } } if ((skipWrapperArray && SchemaUtils.isWrapperArrayType(xt)) == false) { jxtm = new JavaXmlTypeMapping(jwm); String javaType; String localName = xt.getName(); // Anonymous if (localName == null) { String tempName = containingElement + ToolsUtils.firstLetterUpperCase(name); javaType = getJavaTypeAsString(null, new QName(tempName), xt.getNamespace(), false, true); StringBuilder temp = new StringBuilder(); if (containingType != null && containingType.length() > 0) temp.append(">").append(containingType); temp.append(">").append(name); localName = temp.toString(); jxtm.setAnonymousTypeQName(new QName(xt.getNamespace(), localName, "typeNS")); } else { javaType = getJavaTypeAsString(null, new QName(localName), xt.getNamespace(), false, true); jxtm.setRootTypeQName(new QName(xt.getNamespace(), xt.getName(), "typeNS")); } if (typeNamespace == null) { typeNamespace = xt.getNamespace(); } if (registeredTypes.contains(javaType)) return; jxtm.setJavaType(javaType); jxtm.setQNameScope("complexType"); registeredTypes.add(javaType); jwm.addJavaXmlTypeMappings(jxtm); // addJavaXMLTypeMapping(jwm, jxtm if (xm != null) { addVariableMappingMap(xm, jxtm, javaType); } // Add simple content if it exists XSSimpleTypeDefinition simple = xc.getSimpleType(); if (simple != null) { addJavaXMLTypeMap(simple, xc.getName(), "", "", jwm, skipWrapperArray); } // Add attributes XSObjectList attributeUses = ((XSComplexTypeDefinition)xc).getAttributeUses(); if (attributeUses != null) addAttributeMappings(attributeUses, jxtm); } if (xm != null) addGroup(xm, name, xc.getName(), jwm); } // Add enum simpleType support } private void addVariableMappingMap(XSModelGroup xm, JavaXmlTypeMapping jxtm, String javaType) { XSObjectList xo = xm.getParticles(); int len = xo != null ? xo.getLength() : 0; for (int i = 0; i < len; i++) { XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm(); if (xsterm instanceof XSModelGroup) addVariableMappingMap((XSModelGroup)xsterm, jxtm, javaType); else if (xsterm instanceof XSElementDeclaration) { XSElementDeclaration xe = (XSElementDeclaration)xsterm; VariableMapping vm = new VariableMapping(jxtm); String name = xe.getName(); // JBWS-1170 Convert characters which are illegal in Java identifiers vm.setJavaVariableName(ToolsUtils.convertInvalidCharacters(Introspector.decapitalize(name))); vm.setXmlElementName(name); jxtm.addVariableMapping(vm); } } } private void addAttributeMappings(XSObjectList attributes, JavaXmlTypeMapping jxtm) { for (int i = 0; i < attributes.getLength(); i++) { XSAttributeUse obj = (XSAttributeUse)attributes.item(i); XSAttributeDeclaration att = obj.getAttrDeclaration(); XSSimpleTypeDefinition simple = att.getTypeDefinition(); addJavaXMLTypeMap(simple, "none", "", "", jxtm.getJavaWsdlMapping(), true); VariableMapping vm = new VariableMapping(jxtm); String name = att.getName(); vm.setXmlAttributeName(name); // JBWS-1170 Convert characters which are illegal in Java identifiers vm.setJavaVariableName(ToolsUtils.convertInvalidCharacters(Introspector.decapitalize(name))); jxtm.addVariableMapping(vm); } } private void addGroup(XSModelGroup xm, String containingElement, String containingType, JavaWsdlMapping jwm) { XSObjectList xo = xm.getParticles(); int len = xo != null ? xo.getLength() : 0; for (int i = 0; i < len; i++) { XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm(); if (xsterm instanceof XSModelGroup) { addGroup((XSModelGroup)xsterm, containingElement, containingType, jwm); } else if (xsterm instanceof XSElementDeclaration) { XSElementDeclaration xe = (XSElementDeclaration)xsterm; XSTypeDefinition typeDefinition = xe.getTypeDefinition(); String tempContainingElement = ""; String tempContainingType = ""; if (xe.getScope() != XSConstants.SCOPE_GLOBAL) { tempContainingElement = containingElement; tempContainingType = containingType; } addJavaXMLTypeMap(typeDefinition, xe.getName(), tempContainingElement, tempContainingType, jwm, !isWrapped()); } } } private String getJavaTypeAsString(QName xmlName, QName xmlType, String targetNS, boolean array, boolean primitive) { String jtype = null; String arraySuffix = (array) ? "[]" : ""; if (!isDocStyle()) { JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes()); XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); XSElementDeclaration unwrapped = SchemaUtils.unwrapArrayType(xt); StringBuilder builder = new StringBuilder(); while (unwrapped != null) { xt = unwrapped.getTypeDefinition(); primitive = !unwrapped.getNillable(); builder.append("[]"); unwrapped = SchemaUtils.unwrapArrayType(xt); } if (builder.length() > 0) { xmlType = new QName(xt.getNamespace(), xt.getName()); arraySuffix = builder.toString(); } } //First try to get it from the typeMapping Class javaType = typeMapping.getJavaType(xmlType, primitive); /** * Special case - when qname=xsd:anyType && javaType == Element * then cls has to be javax.xml.soap.SOAPElement */ if (xmlType.getNamespaceURI().equals(Constants.NS_SCHEMA_XSD) && "anyType".equals(xmlType.getLocalPart()) && javaType == Element.class) javaType = SOAPElement.class; javaType = this.makeCustomDecisions(javaType, xmlType); if (javaType == null) { log.debug("Typemapping lookup failed for " + xmlName); log.debug("Falling back to identifier generation"); String className = xmlType.getLocalPart(); if (className.charAt(0) == '>') className = className.substring(1); className = ToolsUtils.convertInvalidCharacters(className); jtype = getPackageName(targetNS) + "." + utils.firstLetterUpperCase(className); } else { //Handle arrays if (javaType.isArray()) { jtype = JavaUtils.getSourceName(javaType); } else jtype = javaType.getName(); } return jtype + arraySuffix; } private boolean isDocStyle() { return Constants.DOCUMENT_LITERAL.equals(wsdlStyle); } /** * Any custom decisions that need to be made will be done here * * @param javaType * @param xmlName * @param xmlType */ private Class makeCustomDecisions(Class javaType, QName xmlType) { if (javaType != null && xmlType != null) { if (Byte[].class == javaType && Constants.NS_SCHEMA_XSD.equals(xmlType.getNamespaceURI()) && "base64Binary".equals(xmlType.getLocalPart())) javaType = byte[].class; } return javaType; } private boolean isWrapped() { return "wrapped".equals(parameterStyle) && Constants.DOCUMENT_LITERAL.equals(wsdlStyle); } private MethodParamPartsMapping getMethodParamPartsMapping(ServiceEndpointMethodMapping semm, QName xmlName, QName xmlType, int paramPosition, String wsdlMessageName, String paramMode, String wsdlMessagePartName, boolean array, boolean primitive) { String targetNS = wsdlDefinitions.getTargetNamespace(); MethodParamPartsMapping mppm = new MethodParamPartsMapping(semm); mppm.setParamPosition(paramPosition); String javaType = getJavaTypeAsString(xmlName, xmlType, targetNS, array, primitive); mppm.setParamType(javaType); //WSDL Message Mapping WsdlMessageMapping wmm = new WsdlMessageMapping(mppm); wmm.setParameterMode(paramMode); String wsdlNS = WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS; wmm.setWsdlMessage(new QName(targetNS, wsdlMessageName, wsdlNS)); wmm.setWsdlMessagePartName(wsdlMessagePartName); mppm.setWsdlMessageMapping(wmm); return mppm; } private String getPackageName(String targetNamespace) { //Get it from global config if (namespacePackageMap != null) { String pkg = namespacePackageMap.get(targetNamespace); if (pkg != null) { return pkg; } } //Default behaviour will always generate all classes in the SEI package only return packageName; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/JavaToWSDLHelper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/helpers/JavaToWSDLHelp0000644000175000017500000004454110650145103031416 0ustar godgod/* * 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.tools.helpers; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.rpc.encoding.TypeMapping; import javax.xml.rpc.holders.Holder; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.Style; import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping; import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping; import org.jboss.ws.metadata.jaxrpcmapping.PortMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping; import org.jboss.ws.metadata.jaxrpcmapping.ServiceInterfaceMapping; import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping; import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping; import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLTypes; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.XSModelTypes; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSElementDeclaration; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.ws.tools.JavaToXSD; import org.jboss.ws.tools.interfaces.JavaToXSDIntf; import org.jboss.ws.tools.interfaces.SchemaCreatorIntf; import org.jboss.ws.tools.wsdl.WSDLGenerator; import org.jboss.wsf.common.JavaUtils; /** * Java To WSDL Helper which uses UnifiedMetaData * @author Anil Saldhana * @since Oct 7, 2005 */ public class JavaToWSDLHelper extends WSDLGenerator { private JavaToXSDIntf javaToXSD = new JavaToXSD(); private JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping(); private Map mappedTypes = new HashMap(); private Set mappedPackages = new HashSet(); private Map packageNamespaceMap = new HashMap(); private Set mappedExceptions = new HashSet(); protected void processTypes() { // All type processing is done in processService() wsdl.setWsdlTypes(new XSModelTypes()); } @Override protected void processOperation(WSDLInterface wsdlInterface, WSDLBinding wsdlBinding, OperationMetaData operation) { super.processOperation(wsdlInterface, wsdlBinding, operation); try { //Generate Types for the individual parameters, faults and return value for (ParameterMetaData paramMetaData : operation.getParameters()) { generateTypesForXSD(paramMetaData); } for (FaultMetaData faultMetaData : operation.getFaults()) { generateTypesForXSD(faultMetaData); } ParameterMetaData returnMetaData = operation.getReturnParameter(); if (returnMetaData != null) { generateTypesForXSD(returnMetaData); } } catch (IOException io) { throw new WSException(io); } } public void generateTypesForXSD(ParameterMetaData pmd) throws IOException { //Types always deals with TypeNamespace QName xmlType = pmd.getXmlType(); if(xmlType.getNamespaceURI().equals(Constants.NS_SCHEMA_XSD) == false) generateType(xmlType, pmd.getJavaType(), buildElementNameMap(pmd)); if (pmd.getOperationMetaData().getStyle() == Style.DOCUMENT || pmd.isInHeader()) generateElement(pmd.getXmlName(), xmlType); //Attachment type if(pmd.isSwA()) wsdl.registerNamespaceURI(Constants.NS_SWA_MIME, "mime"); } private Map buildElementNameMap(ParameterMetaData pmd) { List wrappedParameters = pmd.getWrappedParameters(); if (wrappedParameters == null) return null; Map map = new LinkedHashMap(wrappedParameters.size()); for (WrappedParameter param : wrappedParameters) map.put(param.getVariable(), param.getName()); return map; } public void generateTypesForXSD(FaultMetaData fmd) throws IOException { //Types always deals with TypeNamespace SchemaCreatorIntf sc = javaToXSD.getSchemaCreator(); //Look at the features QName xmlType = fmd.getXmlType(); if(xmlType.getNamespaceURI().equals(Constants.NS_SCHEMA_XSD) == false) generateType(xmlType ,fmd.getJavaType(), null); } public void processEndpoint(WSDLService service, EndpointMetaData endpoint) { super.processEndpoint(service, endpoint); // build JAX-RPC mapping info buildServiceMapping(endpoint); } /* * Currently we only handle 1 endpoint on 1 service, this is the way everything * else is handled anyway. */ private void buildServiceMapping(EndpointMetaData endpoint) { QName origQName = endpoint.getServiceMetaData().getServiceName(); String serviceInterfaceName = endpoint.getServiceEndpointInterface().getPackage().getName() + "." + origQName.getLocalPart(); QName serviceQName = new QName(origQName.getNamespaceURI(), origQName.getLocalPart(), "serviceNS"); ServiceInterfaceMapping serviceMapping = new ServiceInterfaceMapping(javaWsdlMapping); serviceMapping.setServiceInterface(serviceInterfaceName); serviceMapping.setWsdlServiceName(serviceQName); String endpointName = endpoint.getPortName().getLocalPart(); PortMapping portMapping = new PortMapping(serviceMapping); portMapping.setJavaPortName(endpointName); portMapping.setPortName(endpointName); serviceMapping.addPortMapping(portMapping); javaWsdlMapping.addServiceInterfaceMappings(serviceMapping); String interfaceName = endpoint.getPortTypeName().getLocalPart(); ServiceEndpointInterfaceMapping seiMapping = new ServiceEndpointInterfaceMapping(javaWsdlMapping); seiMapping.setServiceEndpointInterface(endpoint.getServiceEndpointInterfaceName()); seiMapping.setWsdlPortType(new QName(wsdl.getTargetNamespace(), interfaceName, "portTypeNS")); seiMapping.setWsdlBinding(new QName(wsdl.getTargetNamespace(), interfaceName + "Binding", "bindingNS")); for (OperationMetaData operation : endpoint.getOperations()) { ServiceEndpointMethodMapping methodMapping = new ServiceEndpointMethodMapping(seiMapping); methodMapping.setJavaMethodName(operation.getJavaName()); methodMapping.setWsdlOperation(operation.getQName().getLocalPart()); boolean isWrapped = operation.isDocumentWrapped(); methodMapping.setWrappedElement(isWrapped); int i = 0; for (ParameterMetaData param : operation.getParameters()) { if (isWrapped && param.isInHeader() == false) { List wrappedParameters = param.getWrappedParameters(); for (WrappedParameter wrapped : wrappedParameters) { String type = JavaUtils.convertJVMNameToSourceName(wrapped.getType(), endpoint.getClassLoader()); String name = wrapped.getName().getLocalPart(); buildParamMapping(methodMapping, interfaceName, operation, name, type, "IN", false, i++); } } else { String name = param.getXmlName().getLocalPart(); String type = JavaUtils.convertJVMNameToSourceName(param.getJavaTypeName(), endpoint.getClassLoader()); buildParamMapping(methodMapping, interfaceName, operation, name, type, param.getMode().toString(), param.isInHeader(), i++); } } ParameterMetaData returnParam = operation.getReturnParameter(); if (returnParam != null && ((! isWrapped) || (! returnParam.getWrappedParameters().isEmpty()))) { String name, type; if (isWrapped) { WrappedParameter wrappedParameter = returnParam.getWrappedParameters().get(0); name = wrappedParameter.getName().getLocalPart(); type = wrappedParameter.getType(); } else { name = returnParam.getXmlName().getLocalPart(); type = returnParam.getJavaTypeName(); } type = JavaUtils.convertJVMNameToSourceName(type, endpoint.getClassLoader()); buildReturnParamMapping(methodMapping, interfaceName, operation, name, type); } seiMapping.addServiceEndpointMethodMapping(methodMapping); for(FaultMetaData fmd : operation.getFaults()) { JavaXmlTypeMapping typeMapping = mappedTypes.get(fmd.getXmlType()); if (typeMapping == null) continue; String javaTypeName = fmd.getJavaTypeName(); if (mappedExceptions.contains(javaTypeName)) continue; mappedExceptions.add(javaTypeName); ExceptionMapping mapping = new ExceptionMapping(javaWsdlMapping); mapping.setExceptionType(javaTypeName); QName name = new QName(wsdl.getTargetNamespace(), fmd.getXmlName().getLocalPart()); mapping.setWsdlMessage(name); // Variable mappings generated from SchemaTypesCreater have their order preserved for (VariableMapping variableMapping : typeMapping.getVariableMappings()) mapping.addConstructorParameter(variableMapping.getXmlElementName()); javaWsdlMapping.addExceptionMappings(mapping); } } javaWsdlMapping.addServiceEndpointInterfaceMappings(seiMapping); // Add package mapping for SEI String name = endpoint.getServiceEndpointInterface().getPackage().getName(); String namespace = packageNamespaceMap.get(name); if (namespace == null) namespace = WSDLUtils.getInstance().getTypeNamespace(name); addPackageMapping(name, namespace); } private void buildParamMapping(ServiceEndpointMethodMapping methodMapping, String interfaceName, OperationMetaData operation, String name, String type, String mode, boolean header, int position) { MethodParamPartsMapping paramMapping = new MethodParamPartsMapping(methodMapping); paramMapping.setParamPosition(position); paramMapping.setParamType(type); WsdlMessageMapping messageMapping = new WsdlMessageMapping(paramMapping); messageMapping.setWsdlMessagePartName(name); String messageName = interfaceName + "_" + operation.getQName().getLocalPart(); if ("OUT".equals(mode)) messageName += "Response"; QName messageQName = new QName(wsdl.getTargetNamespace(), messageName, "wsdlMsgNS"); messageMapping.setWsdlMessage(messageQName); messageMapping.setParameterMode(mode); messageMapping.setSoapHeader(header); paramMapping.setWsdlMessageMapping(messageMapping); methodMapping.addMethodParamPartsMapping(paramMapping); } private void buildReturnParamMapping(ServiceEndpointMethodMapping methodMapping, String interfaceName, OperationMetaData operation, String name, String type) { WsdlReturnValueMapping returnMapping = new WsdlReturnValueMapping(methodMapping); returnMapping.setMethodReturnValue(type); returnMapping.setWsdlMessagePartName(name); String messageName = interfaceName + "_" + operation.getQName().getLocalPart() + "Response";; QName messageQName = new QName(wsdl.getTargetNamespace(), messageName, "wsdlMsgNS"); returnMapping.setWsdlMessage(messageQName); methodMapping.setWsdlReturnValueMapping(returnMapping); } /** * During the WSDL generation process, a typeMapping will be * created that maps xml types -> java types * * @return typeMapping */ public TypeMapping getTypeMapping() { return this.javaToXSD.getSchemaCreator().getTypeMapping(); } /** * A customized Package->Namespace map * * @param map */ public void setPackageNamespaceMap(Map map) { this.packageNamespaceMap = map; this.javaToXSD.setPackageNamespaceMap(map); } public void setJavaToXSD(JavaToXSDIntf jxsd) { this.javaToXSD = jxsd; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } //************************************************************************ // //**************************PRIVATE METHODS***************************** // //************************************************************************ protected void generateType(QName xmlType, Class javaType, Map elementNames) throws IOException { if(Holder.class.isAssignableFrom(javaType)) javaType = WSDLUtils.getInstance().getJavaTypeForHolder(javaType); JBossXSModel xsModel = javaToXSD.generateForSingleType(xmlType, javaType, elementNames); // Now that the schema object graph is built, // ask JavaToXSD to provide a list of xsmodels to be plugged // into WSDLTypes if (xsModel == null) throw new WSException("XSModel is null"); WSDLTypes wsdlTypes = wsdl.getWsdlTypes(); WSDLUtils.addSchemaModel(wsdlTypes, xmlType.getNamespaceURI(), xsModel); wsdl.registerNamespaceURI(xmlType.getNamespaceURI(), null); //Also get any custom namespaces SchemaCreatorIntf schemaCreator = javaToXSD.getSchemaCreator(); mergeJavaWsdlMapping(schemaCreator.getJavaWsdlMapping()); HashMap map = schemaCreator.getCustomNamespaceMap(); Set keys = map != null ? map.keySet() : null; Iterator iter = (keys != null && !keys.isEmpty()) ? keys.iterator() : null; while (iter != null && iter.hasNext()) { String pref = (String)iter.next(); String ns = (String)map.get(pref); if (ns != null) wsdl.registerNamespaceURI(ns, null); } } private void mergeJavaWsdlMapping(JavaWsdlMapping source) { // For now we just merge types and packages for (PackageMapping packageMapping : source.getPackageMappings()) { String name = packageMapping.getPackageType(); String namespaceURI = packageMapping.getNamespaceURI(); addPackageMapping(name, namespaceURI); } for (JavaXmlTypeMapping type : source.getJavaXmlTypeMappings()) { QName name = type.getRootTypeQName(); if (name == null) name = type.getAnonymousTypeQName(); if (mappedTypes.containsKey(name)) continue; mappedTypes.put(name, type); JavaXmlTypeMapping typeCopy = new JavaXmlTypeMapping(javaWsdlMapping); typeCopy.setQNameScope(type.getQnameScope()); typeCopy.setAnonymousTypeQName(type.getAnonymousTypeQName()); typeCopy.setJavaType(type.getJavaType()); typeCopy.setRootTypeQName(type.getRootTypeQName()); for (VariableMapping variable : type.getVariableMappings()) { VariableMapping variableCopy = new VariableMapping(typeCopy); variableCopy.setDataMember(variable.isDataMember()); variableCopy.setJavaVariableName(variable.getJavaVariableName()); variableCopy.setXmlAttributeName(variable.getXmlAttributeName()); variableCopy.setXmlElementName(variable.getXmlElementName()); variableCopy.setXmlWildcard(variable.getXmlWildcard()); typeCopy.addVariableMapping(variableCopy); } javaWsdlMapping.addJavaXmlTypeMappings(typeCopy); } } private void addPackageMapping(String name, String namespaceURI) { if (mappedPackages.contains(name)) return; mappedPackages.add(name); PackageMapping copy = new PackageMapping(javaWsdlMapping); copy.setPackageType(name); copy.setNamespaceURI(namespaceURI); javaWsdlMapping.addPackageMapping(copy); } protected void generateElement(QName xmlName, QName xmlType) { WSDLTypes types = wsdl.getWsdlTypes(); String namespaceURI = xmlType.getNamespaceURI(); JBossXSModel schemaModel = WSDLUtils.getSchemaModel(types); XSTypeDefinition type; if (Constants.NS_SCHEMA_XSD.equals(namespaceURI)) type = SchemaUtils.getInstance().getSchemaBasicType(xmlType.getLocalPart()); else type = schemaModel.getTypeDefinition(xmlType.getLocalPart(), namespaceURI); WSSchemaUtils utils = WSSchemaUtils.getInstance(schemaModel.getNamespaceRegistry(), null); JBossXSElementDeclaration element = utils.createGlobalXSElementDeclaration(xmlName.getLocalPart(), type, xmlName.getNamespaceURI()); schemaModel.addXSElementDeclaration(element); wsdl.registerNamespaceURI(xmlName.getNamespaceURI(), null); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/HeaderUtil.java0000644000175000017500000000605610631321374030237 0ustar godgod/* * JBoss, Home of Professional Open Source * Copyright 2007, 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.tools; import java.util.ArrayList; import javax.xml.namespace.QName; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader; /** * Collection of static methods required for processing * bound headers in WSDL to Java so they can be re-used for * the JAX-RPC generation. * * @author darran.lofthouse@jboss.com * @since 29 May 2007 */ public class HeaderUtil { public static WSDLBindingOperation getWSDLBindingOperation(final WSDLDefinitions wsdl, final WSDLInterfaceOperation operation) { WSDLBindingOperation bindingOperation = null; WSDLInterface wsdlInterface = operation.getWsdlInterface(); QName operationName = operation.getName(); WSDLBinding binding = wsdl.getBindingByInterfaceName(wsdlInterface.getName()); bindingOperation = binding.getOperationByRef(operationName); return bindingOperation; } public static WSDLSOAPHeader[] getSignatureHeaders(final WSDLBindingMessageReference[] refs) { ArrayList headers = new ArrayList(); if (refs != null) { for (WSDLBindingMessageReference current : refs) { for (WSDLSOAPHeader header : current.getSoapHeaders()) { headers.add(header); } } } return headers.toArray(new WSDLSOAPHeader[headers.size()]); } public static boolean containsMatchingPart(WSDLSOAPHeader[] headers, WSDLSOAPHeader header) { for (WSDLSOAPHeader current : headers) { if (current.getPartName().equals(header.getPartName())) { if (current.getElement().equals(header.getElement())) { return true; } } } return false; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/JavaToXSD.java0000644000175000017500000002400410573471351027753 0ustar godgod/* * 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.tools; // $Id: JavaToXSD.java 2539 2007-03-07 08:08:09Z jason.greene@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.xml.namespace.QName; import org.apache.xerces.impl.xs.SchemaGrammar; import org.apache.xerces.impl.xs.XMLSchemaLoader; import org.apache.xerces.impl.xs.XSModelImpl; import org.apache.xerces.xni.parser.XMLInputSource; import org.apache.xerces.xs.XSModel; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.utils.JBossWSEntityResolver; import org.jboss.ws.core.utils.ResourceURL; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSEntityResolver; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSErrorHandler; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.ws.tools.helpers.JavaToXSDHelper; import org.jboss.ws.tools.interfaces.JavaToXSDIntf; import org.jboss.ws.tools.interfaces.SchemaCreatorIntf; import org.jboss.xb.binding.sunday.unmarshalling.LSInputAdaptor; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.w3c.dom.ls.LSInput; import org.xml.sax.InputSource; /** *

      * Handles the conversion of Java classes to XML Schema * This class is the key class to use for all Java to Schema requirements. *

      *

      * Approach 1: Starting from scratch. * You can generate an empty schema model by providing a target namespace. * To this empty schema model, Complex Types and Global Elements can be added. *
      {@link #createSchema(String typens) createSchema} *

      *

      * Approach 2: You want to generate a complex type as a string given a xmltype and a Java Class. *
      {@link #generateForSingleType(QName xmlType, Class javaType) generateForSingleType} *
      {@link #generateForEndpoint(Class endpointOrServiceInt) generateForEndpoint} *

      * @author Anil Saldhana * @since May 6, 2005 */ public class JavaToXSD implements JavaToXSDIntf { // provide logging private static final Logger log = Logger.getLogger(JavaToXSD.class); protected WSDLUtils utils = WSDLUtils.getInstance(); protected SchemaUtils schemautils = SchemaUtils.getInstance(); protected String jaxrpcAssert = "JAXRPC2.0 Assertion:"; protected JavaToXSDHelper helper = null; /** * Constructor */ public JavaToXSD() { helper = new JavaToXSDHelper(); SchemaCreatorIntf creator = helper.getSchemaCreator(); JBossXSModel xsmodel = creator.getXSModel(); if (xsmodel == null) creator.setXSModel(new JBossXSModel()); } /* * @see org.jboss.ws.tools.interfaces.JavaToXSDIntf#generateForSingleType() */ public JBossXSModel generateForSingleType(QName xmlType, Class javaType) throws IOException { SchemaCreatorIntf creator = helper.getSchemaCreator(); creator.generateType(xmlType, javaType); return creator.getXSModel(); } public JBossXSModel generateForSingleType(QName xmlType, Class javaType, Map elementNames) throws IOException { SchemaCreatorIntf creator = helper.getSchemaCreator(); creator.generateType(xmlType, javaType, elementNames); return creator.getXSModel(); } /* * @see org.jboss.ws.tools.interfaces.JavaToXSDIntf#getSchemaCreator() */ public SchemaCreatorIntf getSchemaCreator() { return helper.getSchemaCreator(); } /** * Given a schema file in a file, return a Schema Model * @param xsdURL Location of the schema file * @return Xerces XSModel which represents the schema */ public JBossXSModel parseSchema(URL xsdURL) { JBossXSErrorHandler xserr = new JBossXSErrorHandler(); JBossWSEntityResolver resolver = new JBossWSEntityResolver(); JBossXSEntityResolver xsresolve = new JBossXSEntityResolver(resolver, new HashMap()); XMLSchemaLoader loader = (XMLSchemaLoader)schemautils.getXSLoader(xserr, xsresolve); XSModel xsmodel = loader.loadURI(xsdURL.toExternalForm()); if (xsmodel == null) throw new WSException("Cannot load schema: " + xsdURL); WSSchemaUtils sutils = WSSchemaUtils.getInstance(null, null); JBossXSModel jbxs = new JBossXSModel(); sutils.copyXSModel(xsmodel, jbxs); return jbxs; } /** * Given a set of schema files, parse them to yield an unified JBossXSModel * @param locs a map of schema namespace to schema location * @return unified JBossXSModel */ public JBossXSModel parseSchema(Map locs) { if (locs == null || locs.size() == 0) throw new IllegalArgumentException("Illegal schema location map"); JBossXSErrorHandler xserr = new JBossXSErrorHandler(); JBossWSEntityResolver resolver = new JBossWSEntityResolver(); JBossXSEntityResolver xsresolve = new JBossXSEntityResolver(resolver, locs); XMLSchemaLoader loader = (XMLSchemaLoader)schemautils.getXSLoader(xserr, xsresolve); int index = 0; SchemaGrammar[] gs = new SchemaGrammar[locs.size()]; Iterator it = locs.keySet().iterator(); while (it.hasNext()) { try { String nsURI = it.next(); URL orgURL = locs.get(nsURI); URL resURL = resolveNamespaceURI(resolver, nsURI); URL url = resURL != null ? resURL : orgURL; log.debug("Load schema: " + nsURI + "=" + url); XMLInputSource inputSource = new XMLInputSource(null, url.toExternalForm(), null); InputSource tmpSrc = resolver.resolveEntity(null, url.toExternalForm()); InputStream in = tmpSrc.getByteStream() != null ? tmpSrc.getByteStream() : new ResourceURL(url).openStream(); inputSource.setByteStream(in); SchemaGrammar grammar = (SchemaGrammar)loader.loadGrammar(inputSource); if (grammar == null) throw new IllegalStateException("Cannot load grammar: " + url); gs[index++] = grammar; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new IllegalStateException("Cannot parse schema", ex); } } XSModel xsmodel = new XSModelImpl(gs); // Convert Xerces XSModel into r/w JBossXSModel WSSchemaUtils sutils = WSSchemaUtils.getInstance(null, null); JBossXSModel jbxs = new JBossXSModel(); sutils.copyXSModel(xsmodel, jbxs); return jbxs; } private URL resolveNamespaceURI(JBossWSEntityResolver resolver, String nsURI) { URL url = null; String resource = (String)resolver.getEntityMap().get(nsURI); if (resource != null) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); url = loader.getResource(resource); if (url == null) { if (resource.endsWith(".dtd")) resource = "dtd/" + resource; else if (resource.endsWith(".xsd")) resource = "schema/" + resource; url = loader.getResource(resource); } } return url; } /** * @see org.jboss.ws.tools.interfaces.JavaToXSDIntf#setPackageNamespaceMap(java.util.Map) */ public void setPackageNamespaceMap(Map map) { helper.setPackageNamespaceMap(map); } /** * Set the WSDL Style */ public void setWSDLStyle(String style) { helper.setWsdlStyle(style); } //****************************************************************** // PRIVATE METHODS //****************************************************************** /** * FIXME: JBXB-33 */ private SchemaBindingResolver getSchemaBindingResolver(final Map map) { return new SchemaBindingResolver() { public String getBaseURI() { throw new UnsupportedOperationException("getBaseURI is not implemented."); } public void setBaseURI(String baseURI) { throw new UnsupportedOperationException("setBaseURI is not implemented."); } public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation) { throw new UnsupportedOperationException("resolve is not implemented."); } public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation) { URL url = map.get(nsUri); if (url != null) try { return new LSInputAdaptor(url.openStream(), null); } catch (IOException e) { log.error("URL is bad for schema parsing"); } return null; } }; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/WSToolsConstants.java0000644000175000017500000000527410542776150031470 0ustar godgod/* * 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.tools; import org.jboss.ws.Constants; /** * A collection of constants relevant to JBossWS Tools * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 01-Aug-2005 */ public interface WSToolsConstants extends Constants { String BASE = "http://www.jboss.org/wstools/"; /** Tools Constants */ /** * Option used to inform the tools subsytems that all the xml types that are generated * should be generated under the xml target namespace, irrespective of the java packages * from where the Java types come */ static final String WSTOOLS_FEATURE_RESTRICT_TO_TARGET_NS = BASE + "restrict_types_to_TargetNamespace"; /** * Should the schema definitions be included in the wsdl file or they should be generated * in different files. */ static final String WSTOOLS_FEATURE_INCLUDE_SCHEMA_IN_WSDL = BASE + "include_schema_in_WSDL"; /** * Flag to tools that the generated Java Artifacts can contain Java Annotations */ static final String WSTOOLS_FEATURE_USE_ANNOTATIONS = BASE + "Use_Annotations"; /** * Constant - Not a feature */ static final String WSTOOLS_CONSTANT_MAPPING_SERVICE_PREFIX = "serviceNS"; /** * Constant - Not a feature */ static final String WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS = "wsdlMsgNS"; /** * Constant - Not a feature */ static final String WSTOOLS_CONSTANT_MAPPING_IN_OUT_HOLDER_PARAM_MODE = "INOUT"; /** * Constant - Not a feature */ static final String WSTOOLS_CONSTANT_MAPPING_OUT_HOLDER_PARAM_MODE = "OUT"; /** * Constant - Not a feature */ static final String WSTOOLS_CONSTANT_MAPPING_IN_PARAM_MODE = "IN"; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/XSDTypeToJava.java0000644000175000017500000006447610712374117030633 0ustar godgod/* * 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.tools; import java.beans.Introspector; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSAttributeDeclaration; import org.apache.xerces.xs.XSAttributeUse; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.apache.xerces.xs.XSWildcard; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.wsf.common.JavaUtils; /** Class that converts a XSD Type into Java class * @author Anil Saldhana * @author mageshbk@jboss.com * @since Apr 4, 2005 */ public class XSDTypeToJava { protected LiteralTypeMapping typeMapping = null; protected WSDLUtils utils = WSDLUtils.getInstance(); protected SchemaUtils schemautils = SchemaUtils.getInstance(); protected WSDLUtils wsdlUtils = WSDLUtils.getInstance(); protected JavaWriter jwriter = new JavaWriter(); //Additional variables protected String containingElement = ""; protected String fname = ""; protected File loc = null; protected String pkgname = ""; private Set generatedFiles = new HashSet(); /** * List that is used for exception inheritance case wherein the variables * obtained from the base class go into the generated constructor alone and * not as accessors */ private Map typeNameToBaseVARList = new HashMap(); public XSDTypeToJava() { } public void createJavaFile(XSComplexTypeDefinition type, File loc, String pkgname, XSModel schema) throws IOException { if (typeMapping == null) throw new WSException("TypeMapping has not been set"); this.fname = type.getName(); if (fname == null) throw new WSException("File Name is null"); this.loc = loc; this.pkgname = pkgname; createJavaFile(type, schema, false); } public void createJavaFile(XSComplexTypeDefinition type, String containingElement, File loc, String pkgname, XSModel schema, boolean isExceptionType) throws IOException { if (typeMapping == null) throw new WSException("TypeMapping has not been set"); this.fname = type.getName(); this.containingElement = containingElement; if (fname == null) fname = containingElement; this.loc = loc; this.pkgname = pkgname; createJavaFile(type, schema, isExceptionType); } public void createJavaFile(XSSimpleTypeDefinition type, File loc, String pkgname, XSModel schema) throws IOException { if (typeMapping == null) throw new WSException("TypeMapping has not been set"); this.fname = type.getName(); this.loc = loc; this.pkgname = pkgname; createJavaFile(type, schema); } public void createJavaFile(XSComplexTypeDefinition type, XSModel schema, boolean isExceptionType) throws IOException { if (typeMapping == null) throw new WSException("TypeMapping has not been set"); XSTypeDefinition baseType = type.getBaseType(); // Ensure the characters in the name are valid fname = ToolsUtils.convertInvalidCharacters(fname); //Ensure that the first character is uppercase fname = utils.firstLetterUpperCase(fname); List vars = new ArrayList(); String baseName = getBaseTypeName(type); if (baseName != null && baseType != null && !generatedFiles.contains(baseName)) { if (baseType instanceof XSComplexTypeDefinition) { generatedFiles.add(baseName); String pushName = fname; fname = baseName; this.createJavaFile((XSComplexTypeDefinition)baseType, schema, isExceptionType); fname = pushName; } } vars = this.getVARList(type, schema, isExceptionType); if (baseName == null && isExceptionType) baseName = "Exception"; jwriter.createJavaFile(loc, fname, pkgname, vars, null, baseName, isExceptionType, typeNameToBaseVARList); } public void createJavaFile(XSSimpleTypeDefinition xsSimple, XSModel schema) throws IOException { if (typeMapping == null) throw new WSException("TypeMapping has not been set"); XSTypeDefinition baseType = xsSimple.getBaseType(); short variety = xsSimple.getVariety(); if (XSSimpleTypeDefinition.VARIETY_ATOMIC == variety) { //If the simple type has an enumerated list, then just use its type StringList slist = xsSimple.getLexicalEnumeration(); if (slist != null && slist.getLength() > 0) { //Enumerated List jwriter.createJavaFileForEnumeratedValues(fname, slist, loc, pkgname, xsSimple); } else { if (Constants.NS_SCHEMA_XSD.equals(xsSimple.getNamespace())) return; //TODO: Take care of other cases return; } } } public List getVARList(XSComplexTypeDefinition type, XSModel schema, boolean isExceptionType) throws IOException { if (typeMapping == null) throw new WSException("TypeMapping has not been set"); XSTypeDefinition baseType = type.getBaseType(); List vars = new ArrayList(); vars = handleAttributes(type, vars); //TODO:Handle xsd:group short contentType = type.getContentType(); //simplecontenttype if (XSComplexTypeDefinition.CONTENTTYPE_SIMPLE == contentType) { short der = type.getDerivationMethod(); if (XSConstants.DERIVATION_EXTENSION == der) { XSSimpleTypeDefinition xssimple = type.getSimpleType(); QName q = new QName(xssimple.getNamespace(), xssimple.getName()); QName qn = schemautils.patchXSDQName(q); Class javaType = typeMapping.getJavaType(qn); String jtype = null; if (javaType.isArray()) { jtype = JavaUtils.getSourceName(javaType); } else { jtype = javaType.getName(); } VAR v = new VAR("_value", jtype, false); vars.add(v); } } else if (XSComplexTypeDefinition.CONTENTTYPE_EMPTY == contentType) { short der = type.getDerivationMethod(); if (XSConstants.DERIVATION_RESTRICTION == der) { vars.addAll(createVARsforXSParticle(type, schema)); } } else if (XSComplexTypeDefinition.CONTENTTYPE_ELEMENT == contentType) { //Element Only content type if (!utils.isBaseTypeIgnorable(baseType, type)) { short der = type.getDerivationMethod(); if (XSConstants.DERIVATION_NONE == der) { handleContentTypeElementsWithDerivationNone(type, schema, isExceptionType, vars, type.getParticle()); } if (XSConstants.DERIVATION_EXTENSION == der) { handleContentTypeElementsWithDerivationExtension(type, schema, isExceptionType, vars, type.getParticle()); } else if (XSConstants.DERIVATION_RESTRICTION == der) { handleContentTypeElementsWithDerivationRestriction(type, schema, vars, type.getParticle()); } } else { //Base Type is ignorable vars.addAll(createVARsforXSParticle(type, schema)); } } return vars; } public void setPackageName(String packageName) { this.pkgname = packageName; } public void setTypeMapping(LiteralTypeMapping tm) { this.typeMapping = tm; } //PRIVATE METHODS private void handleContentTypeElementsWithDerivationRestriction(XSComplexTypeDefinition type, XSModel schema, List vars, XSParticle xsparticle) throws IOException { if (xsparticle != null) { XSTerm xsterm = xsparticle.getTerm(); if (xsterm instanceof XSModelGroup) { XSModelGroup xsm = (XSModelGroup)xsterm; XSObjectList xparts = xsm.getParticles(); //Ignore the first item - that will be a modelgroup for basetype XSParticle xspar = (XSParticle)xparts.item(1); XSTerm xterm = xspar.getTerm(); if (xterm instanceof XSElementDeclaration) { vars.addAll(createVARforXSElementDeclaration(xterm, schemautils.isArrayType(xspar), schema, type)); } else if (xterm instanceof XSModelGroup) { XSModelGroup xsmodelgrp = (XSModelGroup)xterm; vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type)); } } } } private void handleContentTypeElementsWithDerivationExtension(XSComplexTypeDefinition type, XSModel schema, boolean isExceptionType, List vars, XSParticle xsparticle) throws IOException { if (xsparticle != null) { XSTerm xsterm = xsparticle.getTerm(); if (xsterm instanceof XSModelGroup) { XSModelGroup xsm = (XSModelGroup)xsterm; XSObjectList xparts = xsm.getParticles(); int length = xparts.getLength(); XSTypeDefinition baseType = type.getBaseType(); if (baseType instanceof XSComplexTypeDefinition && ((XSComplexTypeDefinition)baseType).getContentType() != XSComplexTypeDefinition.CONTENTTYPE_EMPTY) { XSTerm baseTerm = ((XSComplexTypeDefinition)baseType).getParticle().getTerm(); if (isExceptionType && baseTerm instanceof XSModelGroup) { typeNameToBaseVARList.put(type.getName(), createVARsforXSModelGroup((XSModelGroup)baseTerm, schema, type)); } // HACK - The only way to know what elements are local to the subclass, and not inherited, is to compare to the base class // THIS TIES US TO XERCES if (baseType instanceof XSComplexTypeDefinition == false || ((XSComplexTypeDefinition)baseType).getParticle().getTerm() == xsterm) return; } XSParticle xspar; if (baseType instanceof XSComplexTypeDefinition && ((XSComplexTypeDefinition)baseType).getContentType() == XSComplexTypeDefinition.CONTENTTYPE_EMPTY) { // If the base type is empty there will not have been a particle to ignore. xspar = xsparticle; } else { xspar = (XSParticle)xparts.item(length - 1); } XSTerm xsparTerm = xspar.getTerm(); if (xsparTerm instanceof XSModelGroup) { XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm(); vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type)); } else if (xsparTerm instanceof XSElementDeclaration) vars.addAll(createVARforXSElementDeclaration(xsparTerm, schemautils.isArrayType(xspar), schema, type)); } } } private void handleContentTypeElementsWithDerivationNone(XSComplexTypeDefinition type, XSModel schema, boolean isExceptionType, List vars, XSParticle xsparticle) throws IOException { if (xsparticle != null) { XSTerm xsterm = xsparticle.getTerm(); if (xsterm instanceof XSModelGroup) { XSModelGroup xsm = (XSModelGroup)xsterm; XSObjectList xparts = xsm.getParticles(); int len = xparts != null ? xparts.getLength() : 0; int diff = len - 0; for (int i = 0; i < len; i++) { if (isExceptionType && type.getBaseType() != null) { List baseList = new ArrayList(); //The first few xsterms are modelgroups for base class for (int j = 0; j < diff - 1; j++) { XSParticle xspar = (XSParticle)xparts.item(j); XSTerm xsparTerm = xspar.getTerm(); if (xsparTerm instanceof XSModelGroup) { XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm(); baseList.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type)); } } if (baseList.size() > 0) this.typeNameToBaseVARList.put(type.getName(), baseList); //Now take the modelgroup for the type in question XSParticle xspar = (XSParticle)xparts.item(len - 1); XSTerm xsparTerm = xspar.getTerm(); if (xsparTerm instanceof XSModelGroup) { XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm(); vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type)); } break; } XSParticle xspar = (XSParticle)xparts.item(i); XSTerm xsparTerm = xspar.getTerm(); if (xsparTerm instanceof XSModelGroup) { XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm(); vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type)); } else if (xsparTerm instanceof XSElementDeclaration) vars.addAll(createVARforXSElementDeclaration(xsparTerm, schemautils.isArrayType(xspar), schema, type)); } } else if (xsterm instanceof XSElementDeclaration) { vars.addAll(createVARforXSElementDeclaration(xsterm, schemautils.isArrayType(xsparticle), schema, type)); } else throw new WSException("Unhandled Type"); } } private List handleAttributes(XSComplexTypeDefinition type, List vars) { XSObjectList xsobjlist = type.getAttributeUses(); if (xsobjlist != null) { int len = xsobjlist.getLength(); for (int i = 0; i < len; i++) { XSAttributeUse obj = (XSAttributeUse)xsobjlist.item(i); XSAttributeDeclaration att = obj.getAttrDeclaration(); XSSimpleTypeDefinition xstype = att.getTypeDefinition(); QName qn = SchemaUtils.handleSimpleType(xstype); boolean primitive = obj.getRequired(); VAR v = createVAR(qn, att.getName(), pkgname, primitive); if (vars == null) vars = new ArrayList(); vars.add(v); } } return vars; } private List createVARsforXSParticle(XSComplexTypeDefinition type, XSModel schema) throws IOException { List list = new ArrayList(); XSParticle xsparticle = type.getParticle(); if (xsparticle != null) { short xsptype = xsparticle.getType(); XSTerm xsterm = xsparticle.getTerm(); if (xsptype == XSConstants.ELEMENT_DECLARATION) { } else if (xsterm instanceof XSModelGroup) { XSModelGroup xsm = (XSModelGroup)xsterm; XSObjectList xparts = xsm.getParticles(); list.addAll(createVARsForElements(xparts, schema, type)); } } return list; } private List createVARsforXSModelGroup(XSModelGroup xsm, XSModel schema, XSComplexTypeDefinition origType) throws IOException { List vars = new ArrayList(); short compositor = xsm.getCompositor(); if (XSModelGroup.COMPOSITOR_SEQUENCE == compositor) { XSObjectList xsobjlist = xsm.getParticles(); int len = xsobjlist.getLength(); for (int i = 0; i < len; i++) { XSParticle xsparticle = (XSParticle)xsobjlist.item(i); XSTerm term = xsparticle.getTerm(); if (term instanceof XSElementDeclaration) { vars.addAll(createVARforXSElementDeclaration(term, schemautils.isArrayType(xsparticle), schema, origType)); } else if (term instanceof XSModelGroup) { vars.addAll(createVARsforXSModelGroup((XSModelGroup)term, schema, origType)); } } } return vars; } private VAR createVAR(QName qn, String varstr, String pkgname, boolean primitive) { String clname = ""; Class cls = typeMapping.getJavaType(qn); VAR v = null; if (cls != null) { clname = cls.getName(); if (primitive) { String primName = utils.getPrimitive(clname); if (primName != null) clname = primName; } } else { if (qn != null) { if (!Constants.NS_SCHEMA_XSD.equals(qn.getNamespaceURI())) clname = pkgname + "."; clname += qn.getLocalPart(); } } v = new VAR(varstr, clname, false); return v; } private List createVARsForElements(XSObjectList xsobjlist, XSModel schema, XSComplexTypeDefinition origType) throws IOException { List list = new ArrayList(); int len = xsobjlist.getLength(); for (int i = 0; i < len; i++) { XSParticle xsparticle = (XSParticle)xsobjlist.item(i); XSTerm xsterm = xsparticle.getTerm(); list.addAll(createVARforXSElementDeclaration(xsterm, schemautils.isArrayType(xsparticle), schema, origType)); continue; } return list; } private List createVARforXSElementDeclaration(XSTerm xsterm, boolean arrayType, XSModel schema, XSComplexTypeDefinition origType) throws IOException { List vars = new ArrayList(); // Handle xsd:any elements if (xsterm instanceof XSWildcard) { VAR v = new VAR("_any", "javax.xml.soap.SOAPElement", arrayType); vars.add(v); return vars; } // Handle xsd:group if (xsterm instanceof XSModelGroup) { vars.addAll(createVARsforXSModelGroup((XSModelGroup)xsterm, schema, origType)); return vars; } XSElementDeclaration elem = (XSElementDeclaration)xsterm; // TODO: Check if the element contains any anon complex type // TODO: If yes, create class that is ComplexTypeName+ElementName // TODO: ItemsItem If the elem contains anon simpletype // TODO: No need to create seperate Java class String tname = elem.getName(); XSTypeDefinition xstypedef = elem.getTypeDefinition(); String xstypename = xstypedef.getName(); // Check if it is a composite type if (xstypename != null && xstypedef.getName().equals(origType.getName()) && xstypedef.getNamespace().equals(origType.getNamespace())) { // it is a composite type QName qn = new QName(origType.getNamespace(), origType.getName()); VAR vr = createVAR(qn, elem, (XSComplexTypeDefinition)xstypedef, tname, pkgname, arrayType); vars.add(vr); return vars; } else if (xstypename == null && xstypedef instanceof XSComplexTypeDefinition) { XSComplexTypeDefinition xsc = (XSComplexTypeDefinition)xstypedef; String subname = utils.firstLetterUpperCase(tname); // Save the fname in a temp var String tempfname = this.fname; // it will be an anonymous type if (containingElement == null || containingElement.length() == 0) containingElement = origType.getName(); String anonName; if (elem.getScope() == XSConstants.SCOPE_GLOBAL) { anonName = subname; } else { anonName = containingElement + subname; } anonName = utils.firstLetterUpperCase(anonName); this.fname = anonName; if (!generatedFiles.contains(this.fname)) { generatedFiles.add(this.fname); this.createJavaFile((XSComplexTypeDefinition)xstypedef, schema, false); } // Restore the fname this.fname = tempfname; // Bypass rest of processing QName anonqn = new QName(anonName); VAR vr = createVAR(anonqn, elem, xsc, tname, pkgname, arrayType); vars.add(vr); return vars; } else { String temp = this.fname; // Unwrap any array wrappers if (SchemaUtils.isWrapperArrayType(xstypedef)) { XSComplexTypeDefinition complex = (XSComplexTypeDefinition)xstypedef; XSModelGroup group = (XSModelGroup)complex.getParticle().getTerm(); XSElementDeclaration element = (XSElementDeclaration)((XSParticle)group.getParticles().item(0)).getTerm(); xstypedef = element.getTypeDefinition(); xstypename = xstypedef.getName(); arrayType = true; } QName qn = null; if (xstypedef instanceof XSSimpleTypeDefinition) { qn = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xstypedef); } else { qn = new QName(xstypedef.getNamespace(), xstypename); } if (xstypename != null && xstypedef instanceof XSComplexTypeDefinition) { this.fname = ToolsUtils.convertInvalidCharacters(utils.firstLetterUpperCase(xstypename)); if (!generatedFiles.contains(this.fname)) { generatedFiles.add(this.fname); this.createJavaFile((XSComplexTypeDefinition)xstypedef, schema, false); } this.fname = temp; } VAR v = createVAR(qn, elem, xstypedef, tname, pkgname, arrayType); vars.add(v); } return vars; } private VAR createVAR(QName qn, XSElementDeclaration elem, XSTypeDefinition t, String varstr, String pkgname, boolean arrayType) { if (t instanceof XSSimpleTypeDefinition) { QName tempqn = schemautils.handleSimpleType((XSSimpleTypeDefinition)t); if (tempqn != null) qn = tempqn; } String qualifiedClassName = ""; Class cls = typeMapping.getJavaType(qn); VAR v = null; if (cls != null) { qualifiedClassName = JavaUtils.getSourceName(cls); String primitive = utils.getPrimitive(qualifiedClassName); if ((!elem.getNillable()) && primitive != null) qualifiedClassName = primitive; } else { QName typename = null; if (t.getName() == null) typename = qn; else typename = new QName(t.getName()); if (typename != null) { String nsuri = typename.getNamespaceURI(); if (!nsuri.equals(Constants.NS_SCHEMA_XSD)) qualifiedClassName = pkgname + "."; String className = wsdlUtils.firstLetterUpperCase(ToolsUtils.convertInvalidCharacters(typename.getLocalPart())); qualifiedClassName += className; } else if (qn != null) qualifiedClassName = qn.getLocalPart(); } v = new VAR(Introspector.decapitalize(varstr), qualifiedClassName, arrayType); return v; } private String getBaseTypeName(XSComplexTypeDefinition type) { String baseName = null; XSTypeDefinition baseType = null; if (type instanceof XSComplexTypeDefinition) { XSComplexTypeDefinition t = (XSComplexTypeDefinition)type; baseType = t.getBaseType(); //Check baseType is xsd:anyType if (baseType != null) { if (baseType.getNamespace() == Constants.NS_SCHEMA_XSD && baseType.getName().equals("anyType")) baseType = null; //Ignore this baseType } if (XSComplexTypeDefinition.CONTENTTYPE_SIMPLE == t.getContentType()) { baseType = null; //ComplexType has a simplecontent } } if (baseName == null && baseType != null) baseName = ToolsUtils.firstLetterUpperCase(baseType.getName()); return baseName; } /** * Inner Class that just stores a custom object called VAR * that is used in creating of the Java class */ public static class VAR { String varname; String vartype; boolean isArrayType = false; public VAR(String varname, String vartype, boolean arrayType) { this.varname = varname; this.vartype = vartype; isArrayType = arrayType; } public String getVarname() { return varname; } public void setVarname(String varname) { this.varname = varname; } public String getVartype() { return vartype; } public void setVartype(String vartype) { this.vartype = vartype; } public boolean isArrayType() { return isArrayType; } public void setArrayType(boolean arrayType) { isArrayType = arrayType; } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/RPCSignature.java0000755000175000017500000000637310542776150030533 0ustar godgod/* * 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.tools; import java.util.ArrayList; import java.util.Collection; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLRPCPart; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction; public class RPCSignature { private Collection parameters = new ArrayList(); private WSDLRPCPart returnParameter; public Collection parameters() { return parameters; } public WSDLRPCPart returnParameter() { return returnParameter; } public RPCSignature(WSDLInterfaceOperation operation) { WSDLInterfaceOperationInput input = WSDLUtils.getWsdl11Input(operation); WSDLInterfaceOperationOutput output = WSDLUtils.getWsdl11Output(operation); for (WSDLRPCSignatureItem item : operation.getRpcSignatureItems()) { if (item.getDirection() == Direction.RETURN) { if (output != null) returnParameter = output.getChildPart(item.getName()); continue; } WSDLRPCPart part = null; if (input != null) part = input.getChildPart(item.getName()); if (output != null && part == null) part = output.getChildPart(item.getName()); if (part != null) parameters.add(part); } for (WSDLRPCPart part : input.getChildParts()) { if (operation.getRpcSignatureitem(part.getName()) == null) parameters.add(part); } if (output != null) { for (WSDLRPCPart part : output.getChildParts()) { if (operation.getRpcSignatureitem(part.getName()) == null) { // Filter in-outs if (input.getChildPart(part.getName()) != null) continue; if (returnParameter == null) { returnParameter = part; } else { parameters.add(part); } } } } } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/Configuration.java0000644000175000017500000001217010542776150031021 0ustar godgod/* * 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.tools; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; /** * Configuration driving jbossws * @author Anil Saldhana * @since Aug 11, 2005 */ public class Configuration { private JavaToWSDLConfig j2wc; private WSDLToJavaConfig w2jc; private GlobalConfig globalConfig; public Configuration() { } public JavaToWSDLConfig getJavaToWSDLConfig(boolean createNew) { if (createNew && j2wc == null) j2wc = new JavaToWSDLConfig(); return j2wc; } public WSDLToJavaConfig getWSDLToJavaConfig(boolean createNew) { if (createNew && w2jc == null) w2jc = new WSDLToJavaConfig(); return w2jc; } /** * @return Returns the globalConfig. */ public GlobalConfig getGlobalConfig(boolean createNew) { if (createNew && globalConfig == null) globalConfig = new GlobalConfig(); return globalConfig; } public void setGlobalConfig(GlobalConfig globalConfig) { this.globalConfig = globalConfig; } public void setJavaToWSDLConfig(JavaToWSDLConfig j2wc2) { this.j2wc = j2wc2; } public void setWSDLToJavaConfig(WSDLToJavaConfig wsdl2jc) { w2jc = wsdl2jc; } /** * Configuration for JavaToWSDL */ public class JavaToWSDLConfig { // Is a jaxrpc-mapping file needed? public boolean mappingFileNeeded; // Name of the jaxrpc-mapping file public String mappingFileName; // Need webservices.xml file? public boolean wsxmlFileNeeded; // Target Namespace public String targetNamespace; // Type Namespace public String typeNamespace; // Service Name public String serviceName; // Endpoint Name public String endpointName; // Style of WSDL. {"rpc","doc"} public String wsdlStyle = "document"; // Parameter style {"wrapped", "bare"} public String parameterStyle = "wrapped"; // WSDL Version {"1.1","2.0"} public String wsdlVersion = "1.1"; // Should Schema be included in the wsdl public boolean includeSchemaInWSDL = true; public boolean restrictSchemaToTargetNS; public String servletLink; public String ejbLink; public boolean wsxmlFileAppend; public Map> operations = new HashMap>(); public OperationConfig createOperationConfig() { return new OperationConfig(); } /**Configuration at the operation level*/ /*public OperationConfig opConfig; public OperationConfig getOperationConfig(boolean createNew) { if(j2wc.opConfig == null) j2wc.opConfig = new OperationConfig(); return j2wc.opConfig; }*/ } /** * Configuration for WSDL To Java */ public class WSDLToJavaConfig { public String wsdlLocation; // Parameter style {"wrapped", "bare"} public String parameterStyle = "wrapped"; // Is a jaxrpc-mapping file needed? public boolean mappingFileNeeded; // Name of the jaxrpc-mapping file public String mappingFileName; // Need webservices.xml file? public boolean wsxmlFileNeeded; public String servletLink; public String ejbLink; } /** * Global Configuration */ public class GlobalConfig { public String nscollide = "Array"; public Map packageNamespaceMap = new HashMap(); } /** * Configuration at the operation/method level */ public class OperationConfig { public String name; public boolean isOneWay = false; public List params = new ArrayList(); public QName returnXmlName; public ParameterConfig createParameterConfig() { return new ParameterConfig(); } } /** * A ParameterConfig. */ public class ParameterConfig { public String javaType; public QName xmlName; public String mode; public boolean header; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/0000755000175000017500000000000010755000263026306 5ustar godgod././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/JBossWSDLFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/JBossWSDLFactoryI0000644000175000017500000000502210631535033031404 0ustar godgod/* * 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.tools.wsdl; import com.ibm.wsdl.DefinitionImpl; import com.ibm.wsdl.extensions.PopulatedExtensionRegistry; import com.ibm.wsdl.xml.WSDLWriterImpl; import javax.wsdl.Definition; import javax.wsdl.extensions.ExtensionRegistry; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLReader; import javax.wsdl.xml.WSDLWriter; /** * A fork of the original wsdl4j 1.6.2 package * that delegates to the {@link JBossWSDLReaderImpl}. *

      * Original author: Matthew J. Duftler (duftler@us.ibm.com) * * @version $Revision: 3472 $ */ public class JBossWSDLFactoryImpl extends WSDLFactory { /** * Create a new instance of a Definition, with an instance * of a PopulatedExtensionRegistry as its ExtensionRegistry. * * @see com.ibm.wsdl.extensions.PopulatedExtensionRegistry */ public Definition newDefinition() { Definition def = new DefinitionImpl(); ExtensionRegistry extReg = newPopulatedExtensionRegistry(); def.setExtensionRegistry(extReg); return def; } /** * Create a new instance of a WSDLReader. */ public WSDLReader newWSDLReader() { return new JBossWSDLReaderImpl(); } public WSDLWriter newWSDLWriter() { return new WSDLWriterImpl(); } /** * Create a new instance of an ExtensionRegistry with pre-registered * serializers/deserializers for the SOAP, HTTP and MIME * extensions. Java extensionTypes are also mapped for all * the SOAP, HTTP and MIME extensions. */ public ExtensionRegistry newPopulatedExtensionRegistry() { return new PopulatedExtensionRegistry(); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/JBossWSDLReaderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/JBossWSDLReaderIm0000644000175000017500000017075210631535033031371 0ustar godgod/* * 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.tools.wsdl; import com.ibm.wsdl.Constants; import com.ibm.wsdl.extensions.schema.SchemaConstants; import com.ibm.wsdl.util.StringUtils; import com.ibm.wsdl.util.xml.DOMUtils; import com.ibm.wsdl.util.xml.QNameUtils; import com.ibm.wsdl.util.xml.XPathUtils; import org.jboss.ws.core.utils.JBossWSEntityResolver; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.xml.sax.InputSource; import javax.wsdl.*; import javax.wsdl.extensions.AttributeExtensible; import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.ExtensionDeserializer; import javax.wsdl.extensions.ExtensionRegistry; import javax.wsdl.extensions.schema.Schema; import javax.wsdl.extensions.schema.SchemaReference; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLLocator; import javax.wsdl.xml.WSDLReader; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; import java.net.URL; import java.util.*; /** * A WSDLReader fork of the original wsdl4j 1.6.2 package * that delegates to the JBossWSEntityResolver in * private static Document getDocument(InputSource inputSource,String desc) *

      * Original authors: Matthew J. Duftler,Nirmal Mukhi * * @version $Revision: 3472 $ */ public class JBossWSDLReaderImpl implements WSDLReader { // Used for determining the style of operations. private static final List STYLE_ONE_WAY = Arrays.asList(new String[]{Constants.ELEM_INPUT}); private static final List STYLE_REQUEST_RESPONSE = Arrays.asList(new String[]{Constants.ELEM_INPUT, Constants.ELEM_OUTPUT}); private static final List STYLE_SOLICIT_RESPONSE = Arrays.asList(new String[]{Constants.ELEM_OUTPUT, Constants.ELEM_INPUT}); private static final List STYLE_NOTIFICATION = Arrays.asList(new String[]{Constants.ELEM_OUTPUT}); protected boolean verbose = true; protected boolean importDocuments = true; protected ExtensionRegistry extReg = null; protected String factoryImplName = null; protected WSDLLocator loc = null; protected WSDLFactory factory = null; //Contains all schemas used by this wsdl, either in-line or nested //via wsdl imports or schema imports, includes or redefines protected Map allSchemas = new Hashtable(); /** * Sets the specified feature to the specified value. *

      * The supported features are: *

      * * * * * * * * * * * * * * * * *
      NameDescriptionDefault Value
      javax.wsdl.verbose
      If set to true, status messages will be displayed.
      true
      javax.wsdl.importDocuments
      If set to true, imported WSDL documents will be * retrieved and processed.
      true
      *

      * All feature names must be fully-qualified, Java package style. All * names starting with javax.wsdl. are reserved for features defined * by the JWSDL specification. It is recommended that implementation- * specific features be fully-qualified to match the package name * of that implementation. For example: com.abc.featureName * * @param name the name of the feature to be set. * @param value the value to set the feature to. * @throws IllegalArgumentException if the feature name is not recognized. * @see #getFeature(String) */ public void setFeature(String name, boolean value) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("Feature name must not be null."); } if (name.equals(Constants.FEATURE_VERBOSE)) { verbose = value; } else if (name.equals(Constants.FEATURE_IMPORT_DOCUMENTS)) { importDocuments = value; } else { throw new IllegalArgumentException("Feature name '" + name + "' not recognized."); } } /** * Gets the value of the specified feature. * * @param name the name of the feature to get the value of. * @return the value of the feature. * @throws IllegalArgumentException if the feature name is not recognized. * @see #setFeature(String, boolean) */ public boolean getFeature(String name) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("Feature name must not be null."); } if (name.equals(Constants.FEATURE_VERBOSE)) { return verbose; } else if (name.equals(Constants.FEATURE_IMPORT_DOCUMENTS)) { return importDocuments; } else { throw new IllegalArgumentException("Feature name '" + name + "' not recognized."); } } /** * Set the extension registry to be used when reading * WSDL documents into a WSDL definition. If an * extension registry is set, that is the extension * registry that will be set as the extensionRegistry * property of the definitions resulting from invoking * readWSDL(...). Default is null. * * @param extReg the extension registry to use for new * definitions */ public void setExtensionRegistry(ExtensionRegistry extReg) { this.extReg = extReg; } /** * Get the extension registry, if one was set. Default is * null. */ public ExtensionRegistry getExtensionRegistry() { return extReg; } /** * Get the WSDLFactory object cached in the reader, or use lazy * instantiation if it is not cached yet. */ protected WSDLFactory getWSDLFactory() throws WSDLException { if (factory == null) { factory = (factoryImplName != null) ? WSDLFactory.newInstance(factoryImplName) : WSDLFactory.newInstance(); } return factory; } /** * Set a different factory implementation to use for * creating definitions when reading WSDL documents. * As some WSDLReader implementations may only be * capable of creating definitions using the same * factory implementation from which the reader was * obtained, this method is optional. Default is null. * * @param factoryImplName the fully-qualified class name of the * class which provides a concrete implementation of the abstract * class WSDLFactory. * @throws UnsupportedOperationException if this method * is invoked on an implementation which does not * support it. */ public void setFactoryImplName(String factoryImplName) throws UnsupportedOperationException { //check to see if we really need to change the factory name and clear the cache if((this.factoryImplName == null && factoryImplName != null) || (this.factoryImplName != null && !this.factoryImplName.equals(factoryImplName))) { //the factory object is cached in the reader so set it //to null if the factory impl name is reset. this.factory = null; this.factoryImplName = factoryImplName; //if(verbose) System.out.println("WSDLFactory Impl Name set to : "+factoryImplName); } } /** * Get the factoryImplName, if one was set. Default is null. */ public String getFactoryImplName() { return factoryImplName; } protected Definition parseDefinitions(String documentBaseURI, Element defEl, Map importedDefs) throws WSDLException { checkElementName(defEl, Constants.Q_ELEM_DEFINITIONS); WSDLFactory factory = getWSDLFactory(); Definition def = factory.newDefinition(); if (extReg != null) { def.setExtensionRegistry(extReg); } String name = DOMUtils.getAttribute(defEl, Constants.ATTR_NAME); String targetNamespace = DOMUtils.getAttribute(defEl, Constants.ATTR_TARGET_NAMESPACE); NamedNodeMap attrs = defEl.getAttributes(); if (importedDefs == null) { importedDefs = new Hashtable(); } if (documentBaseURI != null) { def.setDocumentBaseURI(documentBaseURI); importedDefs.put(documentBaseURI, def); } if (name != null) { def.setQName(new QName(targetNamespace, name)); } if (targetNamespace != null) { def.setTargetNamespace(targetNamespace); } int size = attrs.getLength(); for (int i = 0; i < size; i++) { Attr attr = (Attr)attrs.item(i); String namespaceURI = attr.getNamespaceURI(); String localPart = attr.getLocalName(); String value = attr.getValue(); if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS)) { if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS)) { def.addNamespace(localPart, value); } else { def.addNamespace(null, value); } } } Element tempEl = DOMUtils.getFirstChildElement(defEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_IMPORT, tempEl)) { def.addImport(parseImport(tempEl, def, importedDefs)); } else if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { def.setDocumentationElement(tempEl); } else if (QNameUtils.matches(Constants.Q_ELEM_TYPES, tempEl)) { def.setTypes(parseTypes(tempEl, def)); } else if (QNameUtils.matches(Constants.Q_ELEM_MESSAGE, tempEl)) { def.addMessage(parseMessage(tempEl, def)); } else if (QNameUtils.matches(Constants.Q_ELEM_PORT_TYPE, tempEl)) { def.addPortType(parsePortType(tempEl, def)); } else if (QNameUtils.matches(Constants.Q_ELEM_BINDING, tempEl)) { def.addBinding(parseBinding(tempEl, def)); } else if (QNameUtils.matches(Constants.Q_ELEM_SERVICE, tempEl)) { def.addService(parseService(tempEl, def)); } else { def.addExtensibilityElement( parseExtensibilityElement(Definition.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(defEl, Definition.class, def, def); return def; } protected Import parseImport(Element importEl, Definition def, Map importedDefs) throws WSDLException { Import importDef = def.createImport(); try { String namespaceURI = DOMUtils.getAttribute(importEl, Constants.ATTR_NAMESPACE); String locationURI = DOMUtils.getAttribute(importEl, Constants.ATTR_LOCATION); String contextURI = null; if (namespaceURI != null) { importDef.setNamespaceURI(namespaceURI); } if (locationURI != null) { importDef.setLocationURI(locationURI); if (importDocuments) { try { contextURI = def.getDocumentBaseURI(); Definition importedDef = null; InputStream inputStream = null; InputSource inputSource = null; URL url = null; if (loc != null) { inputSource = loc.getImportInputSource(contextURI, locationURI); /* We now have available the latest import URI. This might differ from the locationURI so check the importedDefs for it since it is this that we pass as the documentBaseURI later. */ String liu = loc.getLatestImportURI(); importedDef = (Definition)importedDefs.get(liu); inputSource.setSystemId(liu); } else { URL contextURL = (contextURI != null) ? StringUtils.getURL(null, contextURI) : null; url = StringUtils.getURL(contextURL, locationURI); importedDef = (Definition)importedDefs.get(url.toString()); if (importedDef == null) { inputStream = StringUtils.getContentAsInputStream(url); if (inputStream != null) { inputSource = new InputSource(inputStream); inputSource.setSystemId(url.toString()); } } } if (importedDef == null) { if (inputSource == null) { throw new WSDLException(WSDLException.OTHER_ERROR, "Unable to locate imported document " + "at '" + locationURI + "'" + (contextURI == null ? "." : ", relative to '" + contextURI + "'.")); } Document doc = getDocument(inputSource, inputSource.getSystemId()); if (inputStream != null) { inputStream.close(); } Element documentElement = doc.getDocumentElement(); /* Check if it's a wsdl document. If it's not, don't retrieve and process it. This should later be extended to allow other types of documents to be retrieved and processed, such as schema documents (".xsd"), etc... */ if (QNameUtils.matches(Constants.Q_ELEM_DEFINITIONS, documentElement)) { if (verbose) { System.out.println("Retrieving document at '" + locationURI + "'" + (contextURI == null ? "." : ", relative to '" + contextURI + "'.")); } String urlString = (loc != null) ? loc.getLatestImportURI() : (url != null) ? url.toString() : locationURI; importedDef = readWSDL(urlString, documentElement, importedDefs); } else { QName docElementQName = QNameUtils.newQName(documentElement); if (SchemaConstants.XSD_QNAME_LIST.contains(docElementQName)) { if (verbose) { System.out.println("Retrieving schema wsdl:imported from '" + locationURI + "'" + (contextURI == null ? "." : ", relative to '" + contextURI + "'.")); } WSDLFactory factory = getWSDLFactory(); importedDef = factory.newDefinition(); if (extReg != null) { importedDef.setExtensionRegistry(extReg); } String urlString = (loc != null) ? loc.getLatestImportURI() : (url != null) ? url.toString() : locationURI; importedDef.setDocumentBaseURI(urlString); Types types = importedDef.createTypes(); types.addExtensibilityElement( parseSchema(Types.class, documentElement, importedDef)); importedDef.setTypes(types); } } } if (importedDef != null) { importDef.setDefinition(importedDef); } } catch (WSDLException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new WSDLException(WSDLException.OTHER_ERROR, "Unable to resolve imported document at '" + locationURI + (contextURI == null ? "'." : "', relative to '" + contextURI + "'") , e); } } //end importDocs } //end locationURI } catch (WSDLException e) { if (e.getLocation() == null) { e.setLocation(XPathUtils.getXPathExprFromNode(importEl)); } else { //If definitions are being parsed recursively for nested imports //the exception location must be built up recursively too so //prepend this element's xpath to exception location. String loc = XPathUtils.getXPathExprFromNode(importEl) + e.getLocation(); e.setLocation(loc); } throw e; } //register any NS decls with the Definition NamedNodeMap attrs = importEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(importEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { importDef.setDocumentationElement(tempEl); } else { importDef.addExtensibilityElement( parseExtensibilityElement(Import.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(importEl, Import.class, importDef, def); return importDef; } protected Types parseTypes(Element typesEl, Definition def) throws WSDLException { //register any NS decls with the Definition NamedNodeMap attrs = typesEl.getAttributes(); registerNSDeclarations(attrs, def); Types types = def.createTypes(); Element tempEl = DOMUtils.getFirstChildElement(typesEl); QName tempElType; while (tempEl != null) { tempElType = QNameUtils.newQName(tempEl); if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { types.setDocumentationElement(tempEl); } else if ((SchemaConstants.XSD_QNAME_LIST).contains(tempElType)) { //the element qname indicates it is a schema. types.addExtensibilityElement( parseSchema(Types.class, tempEl, def)); } else { types.addExtensibilityElement( parseExtensibilityElement(Types.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(typesEl, Types.class, types, def); return types; } protected ExtensibilityElement parseSchema( Class parentType, Element el, Definition def) throws WSDLException { QName elementType = null; ExtensionRegistry extReg = null; try { extReg = def.getExtensionRegistry(); if (extReg == null) { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "No ExtensionRegistry set for this " + "Definition, so unable to deserialize " + "a '" + elementType + "' element in the " + "context of a '" + parentType.getName() + "'."); } return parseSchema(parentType, el, def, extReg); } catch (WSDLException e) { if (e.getLocation() == null) { e.setLocation(XPathUtils.getXPathExprFromNode(el)); } throw e; } } protected ExtensibilityElement parseSchema( Class parentType, Element el, Definition def, ExtensionRegistry extReg) throws WSDLException { /* * This method returns ExtensibilityElement rather than Schema because we * do not insist that a suitable XSD schema deserializer is registered. * PopulatedExtensionRegistry registers SchemaDeserializer by default, but * if the user chooses not to register a suitable deserializer then the * UnknownDeserializer will be used, returning an UnknownExtensibilityElement. */ Schema schema = null; SchemaReference schemaRef = null; try { QName elementType = QNameUtils.newQName(el); ExtensionDeserializer exDS = extReg.queryDeserializer(parentType, elementType); //Now unmarshall the DOM element. ExtensibilityElement ee = exDS.unmarshall(parentType, elementType, el, def, extReg); if (ee instanceof Schema) { schema = (Schema) ee; } else { //Unknown extensibility element, so don't do any more schema parsing on it. return ee; } //Keep track of parsed schemas to avoid duplicating Schema objects //through duplicate or circular references (eg: A imports B imports A). if (schema.getDocumentBaseURI() != null) { this.allSchemas.put(schema.getDocumentBaseURI(), schema); } //At this point, any SchemaReference objects held by the schema will not //yet point to their referenced schemas, so we must now retrieve these //schemas and set the schema references. //First, combine the schema references for imports, includes and redefines //into a single list ArrayList allSchemaRefs = new ArrayList(); Collection ic = schema.getImports().values(); Iterator importsIterator = ic.iterator(); while(importsIterator.hasNext()) { allSchemaRefs.addAll( (Collection) importsIterator.next() ); } allSchemaRefs.addAll(schema.getIncludes()); allSchemaRefs.addAll(schema.getRedefines()); //Then, retrieve the schema referred to by each schema reference. If the //schema has been read in previously, use the existing schema object. //Otherwise unmarshall the DOM element into a new schema object. ListIterator schemaRefIterator = allSchemaRefs.listIterator(); while(schemaRefIterator.hasNext()) { try { schemaRef = (SchemaReference) schemaRefIterator.next(); if (schemaRef.getSchemaLocationURI() == null) { //cannot get the referenced schema, so ignore this schema reference continue; } if (verbose) { System.out.println("Retrieving schema at '" + schemaRef.getSchemaLocationURI() + (schema.getDocumentBaseURI() == null ? "'." : "', relative to '" + schema.getDocumentBaseURI() + "'.")); } InputStream inputStream = null; InputSource inputSource = null; //This is the child schema referred to by the schemaReference Schema referencedSchema = null; //This is the child schema's location obtained from the WSDLLocator or the URL String location = null; if (loc != null) { //Try to get the referenced schema using the wsdl locator inputSource = loc.getImportInputSource( schema.getDocumentBaseURI(), schemaRef.getSchemaLocationURI()); if (inputSource == null) { throw new WSDLException(WSDLException.OTHER_ERROR, "Unable to locate with a locator " + "the schema referenced at '" + schemaRef.getSchemaLocationURI() + "' relative to document base '" + schema.getDocumentBaseURI() + "'"); } location = loc.getLatestImportURI(); //if a schema from this location has been read previously, use it. referencedSchema = (Schema) this.allSchemas.get(location); } else { // We don't have a wsdl locator, so try to retrieve the schema by its URL String contextURI = schema.getDocumentBaseURI(); URL contextURL = (contextURI != null) ? StringUtils.getURL(null, contextURI) : null; URL url = StringUtils.getURL(contextURL, schemaRef.getSchemaLocationURI()); location = url.toExternalForm(); //if a schema from this location has been retrieved previously, use it. referencedSchema = (Schema) this.allSchemas.get(location); if (referencedSchema == null) { // We haven't read this schema in before so do it now inputStream = StringUtils.getContentAsInputStream(url); if (inputStream != null) { inputSource = new InputSource(inputStream); } if (inputSource == null) { throw new WSDLException(WSDLException.OTHER_ERROR, "Unable to locate with a url " + "the document referenced at '" + schemaRef.getSchemaLocationURI() + "'" + (contextURI == null ? "." : ", relative to '" + contextURI + "'.")); } } } //end if loc // If we have not previously read the schema, get its DOM element now. if (referencedSchema == null) { inputSource.setSystemId(location); Document doc = getDocument(inputSource, location); if (inputStream != null) { inputStream.close(); } Element documentElement = doc.getDocumentElement(); // If it's a schema doc process it, otherwise the schema reference remains null QName docElementQName = QNameUtils.newQName(documentElement); if (SchemaConstants.XSD_QNAME_LIST.contains(docElementQName)) { //We now need to call parseSchema recursively to parse the referenced //schema. The document base URI of the referenced schema will be set to //the document base URI of the current schema plus the schemaLocation in //the schemaRef. We cannot explicitly pass in a new document base URI //to the schema deserializer, so instead we will create a dummy //Definition and set its documentBaseURI to the new document base URI. //We can leave the other definition fields empty because we know //that the SchemaDeserializer.unmarshall method uses the definition //parameter only to get its documentBaseURI. If the unmarshall method //implementation changes (ie: its use of definition changes) we may need //to rethink this approach. WSDLFactory factory = getWSDLFactory(); Definition dummyDef = factory.newDefinition(); dummyDef.setDocumentBaseURI(location); //By this point, we know we have a SchemaDeserializer registered //so we can safely cast the ExtensibilityElement to a Schema. referencedSchema = (Schema) parseSchema( parentType, documentElement, dummyDef, extReg); } } //end if referencedSchema schemaRef.setReferencedSchema(referencedSchema); } catch (WSDLException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new WSDLException(WSDLException.OTHER_ERROR, "An error occurred trying to resolve schema referenced at '" + schemaRef.getSchemaLocationURI() + "'" + (schema.getDocumentBaseURI() == null ? "." : ", relative to '" + schema.getDocumentBaseURI() + "'."), e); } } //end while loop return schema; } catch (WSDLException e) { if (e.getLocation() == null) { e.setLocation(XPathUtils.getXPathExprFromNode(el)); } else { //If this method has been called recursively for nested schemas //the exception location must be built up recursively too so //prepend this element's xpath to exception location. String loc = XPathUtils.getXPathExprFromNode(el) + e.getLocation(); e.setLocation(loc); } throw e; } } protected Binding parseBinding(Element bindingEl, Definition def) throws WSDLException { Binding binding = null; List remainingAttrs = DOMUtils.getAttributes(bindingEl); String name = DOMUtils.getAttribute(bindingEl, Constants.ATTR_NAME, remainingAttrs); QName portTypeName = getQualifiedAttributeValue(bindingEl, Constants.ATTR_TYPE, Constants.ELEM_BINDING, def, remainingAttrs); PortType portType = null; if (name != null) { QName bindingName = new QName(def.getTargetNamespace(), name); binding = def.getBinding(bindingName); if (binding == null) { binding = def.createBinding(); binding.setQName(bindingName); } } else { binding = def.createBinding(); } // Whether it was retrieved or created, the definition has been found. binding.setUndefined(false); if (portTypeName != null) { portType = def.getPortType(portTypeName); if (portType == null) { portType = def.createPortType(); portType.setQName(portTypeName); def.addPortType(portType); } binding.setPortType(portType); } //register any NS decls with the Definition NamedNodeMap attrs = bindingEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(bindingEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { binding.setDocumentationElement(tempEl); } else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl)) { binding.addBindingOperation(parseBindingOperation(tempEl, portType, def)); } else { binding.addExtensibilityElement(parseExtensibilityElement( Binding.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } return binding; } protected BindingOperation parseBindingOperation( Element bindingOperationEl, PortType portType, Definition def) throws WSDLException { BindingOperation bindingOperation = def.createBindingOperation(); List remainingAttrs = DOMUtils.getAttributes(bindingOperationEl); String name = DOMUtils.getAttribute(bindingOperationEl, Constants.ATTR_NAME, remainingAttrs); if (name != null) { bindingOperation.setName(name); } //register any NS decls with the Definition NamedNodeMap attrs = bindingOperationEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(bindingOperationEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { bindingOperation.setDocumentationElement(tempEl); } else if (QNameUtils.matches(Constants.Q_ELEM_INPUT, tempEl)) { bindingOperation.setBindingInput(parseBindingInput(tempEl, def)); } else if (QNameUtils.matches(Constants.Q_ELEM_OUTPUT, tempEl)) { bindingOperation.setBindingOutput(parseBindingOutput(tempEl, def)); } else if (QNameUtils.matches(Constants.Q_ELEM_FAULT, tempEl)) { bindingOperation.addBindingFault(parseBindingFault(tempEl, def)); } else { bindingOperation.addExtensibilityElement( parseExtensibilityElement(BindingOperation.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } if (portType != null) { BindingInput bindingInput = bindingOperation.getBindingInput(); BindingOutput bindingOutput = bindingOperation.getBindingOutput(); String inputName = (bindingInput != null ? (bindingInput.getName() != null ? bindingInput.getName() : Constants.NONE) : null); String outputName = (bindingOutput != null ? (bindingOutput.getName() != null ? bindingOutput.getName() : Constants.NONE) : null); Operation op = portType.getOperation(name, inputName, outputName); /* * If the bindingOp input or output message names are null we will search first * for a porttypeOp with corresponding unnamed input or output messages (using * Constants.NONE for inputName or outputName, as above). * However, input and output message names need not be used at all if operation * overloading is not used, so if no match was found we will try again ignoring * these unnamed messages from the search criteria (i.e. using null instead of * Constants.NONE for inputName or outputName). */ if(op == null) { if(Constants.NONE.equals(inputName) && Constants.NONE.equals(outputName)) { //There was no porttype op with unnamed input and output messages, //so ignore input and output name and search on the op name only. op = portType.getOperation(name, null, null); } else if(Constants.NONE.equals(inputName)) { //There was no porttype op with an unnamed input message, //so ignore input name and search on the op name and output name only. op = portType.getOperation(name, null, outputName); } else if(Constants.NONE.equals(outputName)) { //There was no porttype op with an unnamed output message, //so ignore output name and search on the op name and input name only. op = portType.getOperation(name, inputName, null); } } if (op == null) { Input input = def.createInput(); Output output = def.createOutput(); op = def.createOperation(); op.setName(name); input.setName(inputName); output.setName(outputName); op.setInput(input); op.setOutput(output); portType.addOperation(op); } bindingOperation.setOperation(op); } parseExtensibilityAttributes(bindingOperationEl, BindingOperation.class, bindingOperation, def); return bindingOperation; } protected BindingInput parseBindingInput(Element bindingInputEl, Definition def) throws WSDLException { BindingInput bindingInput = def.createBindingInput(); List remainingAttrs = DOMUtils.getAttributes(bindingInputEl); String name = DOMUtils.getAttribute(bindingInputEl, Constants.ATTR_NAME, remainingAttrs); if (name != null) { bindingInput.setName(name); } //register any NS decls with the Definition NamedNodeMap attrs = bindingInputEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(bindingInputEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { bindingInput.setDocumentationElement(tempEl); } else { bindingInput.addExtensibilityElement( parseExtensibilityElement(BindingInput.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } return bindingInput; } protected BindingOutput parseBindingOutput(Element bindingOutputEl, Definition def) throws WSDLException { BindingOutput bindingOutput = def.createBindingOutput(); List remainingAttrs = DOMUtils.getAttributes(bindingOutputEl); String name = DOMUtils.getAttribute(bindingOutputEl, Constants.ATTR_NAME, remainingAttrs); if (name != null) { bindingOutput.setName(name); } //register any NS decls with the Definition NamedNodeMap attrs = bindingOutputEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(bindingOutputEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { bindingOutput.setDocumentationElement(tempEl); } else { bindingOutput.addExtensibilityElement( parseExtensibilityElement(BindingOutput.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } return bindingOutput; } protected BindingFault parseBindingFault(Element bindingFaultEl, Definition def) throws WSDLException { BindingFault bindingFault = def.createBindingFault(); List remainingAttrs = DOMUtils.getAttributes(bindingFaultEl); String name = DOMUtils.getAttribute(bindingFaultEl, Constants.ATTR_NAME, remainingAttrs); if (name != null) { bindingFault.setName(name); } //register any NS decls with the Definition NamedNodeMap attrs = bindingFaultEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(bindingFaultEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { bindingFault.setDocumentationElement(tempEl); } else { bindingFault.addExtensibilityElement( parseExtensibilityElement(BindingFault.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(bindingFaultEl, BindingFault.class, bindingFault, def); return bindingFault; } protected Message parseMessage(Element msgEl, Definition def) throws WSDLException { Message msg = null; List remainingAttrs = DOMUtils.getAttributes(msgEl); String name = DOMUtils.getAttribute(msgEl, Constants.ATTR_NAME, remainingAttrs); if (name != null) { QName messageName = new QName(def.getTargetNamespace(), name); msg = def.getMessage(messageName); if (msg == null) { msg = def.createMessage(); msg.setQName(messageName); } } else { msg = def.createMessage(); } // Whether it was retrieved or created, the definition has been found. msg.setUndefined(false); //register any NS decls with the Definition NamedNodeMap attrs = msgEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(msgEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { msg.setDocumentationElement(tempEl); } else if (QNameUtils.matches(Constants.Q_ELEM_PART, tempEl)) { msg.addPart(parsePart(tempEl, def)); } else { msg.addExtensibilityElement( parseExtensibilityElement(Message.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(msgEl, Message.class, msg, def); return msg; } protected Part parsePart(Element partEl, Definition def) throws WSDLException { Part part = def.createPart(); String name = DOMUtils.getAttribute(partEl, Constants.ATTR_NAME); QName elementName = getQualifiedAttributeValue(partEl, Constants.ATTR_ELEMENT, Constants.ELEM_MESSAGE, def); QName typeName = getQualifiedAttributeValue(partEl, Constants.ATTR_TYPE, Constants.ELEM_MESSAGE, def); if (name != null) { part.setName(name); } if (elementName != null) { part.setElementName(elementName); } if (typeName != null) { part.setTypeName(typeName); } //register any NS decls with the Definition NamedNodeMap attrs = partEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(partEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { part.setDocumentationElement(tempEl); } else { part.addExtensibilityElement( parseExtensibilityElement(Part.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(partEl, Part.class, part, def); return part; } protected void parseExtensibilityAttributes(Element el, Class parentType, AttributeExtensible attrExt, Definition def) throws WSDLException { List nativeAttributeNames = attrExt.getNativeAttributeNames(); NamedNodeMap nodeMap = el.getAttributes(); int length = nodeMap.getLength(); for (int i = 0; i < length; i++) { Attr attribute = (Attr)nodeMap.item(i); String localName = attribute.getLocalName(); String namespaceURI = attribute.getNamespaceURI(); String prefix = attribute.getPrefix(); QName qname = new QName(namespaceURI, localName); if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL)) { if (!namespaceURI.equals(Constants.NS_URI_XMLNS)) { DOMUtils.registerUniquePrefix(prefix, namespaceURI, def); String strValue = attribute.getValue(); int attrType = AttributeExtensible.NO_DECLARED_TYPE; ExtensionRegistry extReg = def.getExtensionRegistry(); if (extReg != null) { attrType = extReg.queryExtensionAttributeType(parentType, qname); } Object val = parseExtensibilityAttribute(el, attrType, strValue, def); attrExt.setExtensionAttribute(qname, val); } } else if (!nativeAttributeNames.contains(localName)) { WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Encountered illegal " + "extension attribute '" + qname + "'. Extension " + "attributes must be in " + "a namespace other than " + "WSDL's."); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el)); throw wsdlExc; } } } protected Object parseExtensibilityAttribute(Element el, int attrType, String attrValue, Definition def) throws WSDLException { if (attrType == AttributeExtensible.QNAME_TYPE) { return DOMUtils.getQName(attrValue, el, def); } else if (attrType == AttributeExtensible.LIST_OF_STRINGS_TYPE) { return StringUtils.parseNMTokens(attrValue); } else if (attrType == AttributeExtensible.LIST_OF_QNAMES_TYPE) { List oldList = StringUtils.parseNMTokens(attrValue); int size = oldList.size(); List newList = new Vector(size); for (int i = 0; i < size; i++) { String str = (String)oldList.get(i); QName qValue = DOMUtils.getQName(str, el, def); newList.add(qValue); } return newList; } else if (attrType == AttributeExtensible.STRING_TYPE) { return attrValue; } else { QName qValue = null; try { qValue = DOMUtils.getQName(attrValue, el, def); } catch (WSDLException e) { qValue = new QName(attrValue); } return qValue; } } protected PortType parsePortType(Element portTypeEl, Definition def) throws WSDLException { PortType portType = null; String name = DOMUtils.getAttribute(portTypeEl, Constants.ATTR_NAME); if (name != null) { QName portTypeName = new QName(def.getTargetNamespace(), name); portType = def.getPortType(portTypeName); if (portType == null) { portType = def.createPortType(); portType.setQName(portTypeName); } } else { portType = def.createPortType(); } // Whether it was retrieved or created, the definition has been found. portType.setUndefined(false); //register any NS decls with the Definition NamedNodeMap attrs = portTypeEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(portTypeEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { portType.setDocumentationElement(tempEl); } else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl)) { Operation op = parseOperation(tempEl, portType, def); if (op != null) { portType.addOperation(op); } } else { portType.addExtensibilityElement( parseExtensibilityElement(PortType.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(portTypeEl, PortType.class, portType, def); return portType; } protected Operation parseOperation(Element opEl, PortType portType, Definition def) throws WSDLException { Operation op = null; List remainingAttrs = DOMUtils.getAttributes(opEl); String name = DOMUtils.getAttribute(opEl, Constants.ATTR_NAME, remainingAttrs); String parameterOrderStr = DOMUtils.getAttribute(opEl, Constants.ATTR_PARAMETER_ORDER, remainingAttrs); //register any NS decls with the Definition NamedNodeMap attrs = opEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(opEl); List messageOrder = new Vector(); Element docEl = null; Input input = null; Output output = null; List faults = new Vector(); List extElements = new Vector(); boolean retrieved = true; while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { docEl = tempEl; } else if (QNameUtils.matches(Constants.Q_ELEM_INPUT, tempEl)) { input = parseInput(tempEl, def); messageOrder.add(Constants.ELEM_INPUT); } else if (QNameUtils.matches(Constants.Q_ELEM_OUTPUT, tempEl)) { output = parseOutput(tempEl, def); messageOrder.add(Constants.ELEM_OUTPUT); } else if (QNameUtils.matches(Constants.Q_ELEM_FAULT, tempEl)) { faults.add(parseFault(tempEl, def)); } else { extElements.add( parseExtensibilityElement(Operation.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } if (name != null) { String inputName = (input != null ? (input.getName() != null ? input.getName() : Constants.NONE) : null); String outputName = (output != null ? (output.getName() != null ? output.getName() : Constants.NONE) : null); op = portType.getOperation(name, inputName, outputName); if (op != null && !op.isUndefined()) { op = null; } if (op != null) { if (inputName == null) { Input tempIn = op.getInput(); if (tempIn != null) { if (tempIn.getName() != null) { op = null; } } } } if (op != null) { if (outputName == null) { Output tempOut = op.getOutput(); if (tempOut != null) { if (tempOut.getName() != null) { op = null; } } } } if (op == null) { op = def.createOperation(); op.setName(name); retrieved = false; } } else { op = def.createOperation(); retrieved = false; } // Whether it was retrieved or created, the definition has been found. op.setUndefined(false); if (parameterOrderStr != null) { op.setParameterOrdering(StringUtils.parseNMTokens(parameterOrderStr)); } if (docEl != null) { op.setDocumentationElement(docEl); } if (input != null) { op.setInput(input); } if (output != null) { op.setOutput(output); } if (faults.size() > 0) { Iterator faultIterator = faults.iterator(); while (faultIterator.hasNext()) { op.addFault((Fault)faultIterator.next()); } } if (extElements.size() > 0) { Iterator eeIterator = extElements.iterator(); while (eeIterator.hasNext()) { op.addExtensibilityElement( (ExtensibilityElement) eeIterator.next() ); } } OperationType style = null; if (messageOrder.equals(STYLE_ONE_WAY)) { style = OperationType.ONE_WAY; } else if (messageOrder.equals(STYLE_REQUEST_RESPONSE)) { style = OperationType.REQUEST_RESPONSE; } else if (messageOrder.equals(STYLE_SOLICIT_RESPONSE)) { style = OperationType.SOLICIT_RESPONSE; } else if (messageOrder.equals(STYLE_NOTIFICATION)) { style = OperationType.NOTIFICATION; } if (style != null) { op.setStyle(style); } if (retrieved) { op = null; } parseExtensibilityAttributes(opEl, Operation.class, op, def); return op; } protected Service parseService(Element serviceEl, Definition def) throws WSDLException { Service service = def.createService(); List remainingAttrs = DOMUtils.getAttributes(serviceEl); String name = DOMUtils.getAttribute(serviceEl, Constants.ATTR_NAME, remainingAttrs); if (name != null) { service.setQName(new QName(def.getTargetNamespace(), name)); } //register any NS decls with the Definition NamedNodeMap attrs = serviceEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(serviceEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { service.setDocumentationElement(tempEl); } else if (QNameUtils.matches(Constants.Q_ELEM_PORT, tempEl)) { service.addPort(parsePort(tempEl, def)); } else { service.addExtensibilityElement( parseExtensibilityElement(Service.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(serviceEl, Service.class, service, def); return service; } protected Port parsePort(Element portEl, Definition def) throws WSDLException { Port port = def.createPort(); List remainingAttrs = DOMUtils.getAttributes(portEl); String name = DOMUtils.getAttribute(portEl, Constants.ATTR_NAME, remainingAttrs); QName bindingStr = getQualifiedAttributeValue(portEl, Constants.ATTR_BINDING, Constants.ELEM_PORT, def, remainingAttrs); if (name != null) { port.setName(name); } if (bindingStr != null) { Binding binding = def.getBinding(bindingStr); if (binding == null) { binding = def.createBinding(); binding.setQName(bindingStr); def.addBinding(binding); } port.setBinding(binding); } //register any NS decls with the Definition NamedNodeMap attrs = portEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(portEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { port.setDocumentationElement(tempEl); } else { port.addExtensibilityElement(parseExtensibilityElement(Port.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(portEl, Port.class, port, def); return port; } protected ExtensibilityElement parseExtensibilityElement( Class parentType, Element el, Definition def) throws WSDLException { QName elementType = QNameUtils.newQName(el); String namespaceURI = el.getNamespaceURI(); try { if (namespaceURI == null || namespaceURI.equals(Constants.NS_URI_WSDL)) { throw new WSDLException(WSDLException.INVALID_WSDL, "Encountered illegal extension element '" + elementType + "' in the context of a '" + parentType.getName() + "'. Extension elements must be in " + "a namespace other than WSDL's."); } ExtensionRegistry extReg = def.getExtensionRegistry(); if (extReg == null) { throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "No ExtensionRegistry set for this " + "Definition, so unable to deserialize " + "a '" + elementType + "' element in the " + "context of a '" + parentType.getName() + "'."); } ExtensionDeserializer extDS = extReg.queryDeserializer(parentType, elementType); return extDS.unmarshall(parentType, elementType, el, def, extReg); } catch (WSDLException e) { if (e.getLocation() == null) { e.setLocation(XPathUtils.getXPathExprFromNode(el)); } throw e; } } protected Input parseInput(Element inputEl, Definition def) throws WSDLException { Input input = def.createInput(); String name = DOMUtils.getAttribute(inputEl, Constants.ATTR_NAME); QName messageName = getQualifiedAttributeValue(inputEl, Constants.ATTR_MESSAGE, Constants.ELEM_INPUT, def); if (name != null) { input.setName(name); } if (messageName != null) { Message message = def.getMessage(messageName); if (message == null) { message = def.createMessage(); message.setQName(messageName); def.addMessage(message); } input.setMessage(message); } //register any NS decls with the Definition NamedNodeMap attrs = inputEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(inputEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { input.setDocumentationElement(tempEl); } else { input.addExtensibilityElement( parseExtensibilityElement(Input.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(inputEl, Input.class, input, def); return input; } protected Output parseOutput(Element outputEl, Definition def) throws WSDLException { Output output = def.createOutput(); String name = DOMUtils.getAttribute(outputEl, Constants.ATTR_NAME); QName messageName = getQualifiedAttributeValue(outputEl, Constants.ATTR_MESSAGE, Constants.ELEM_OUTPUT, def); if (name != null) { output.setName(name); } if (messageName != null) { Message message = def.getMessage(messageName); if (message == null) { message = def.createMessage(); message.setQName(messageName); def.addMessage(message); } output.setMessage(message); } //register any NS decls with the Definition NamedNodeMap attrs = outputEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(outputEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { output.setDocumentationElement(tempEl); } else { output.addExtensibilityElement( parseExtensibilityElement(Output.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(outputEl, Output.class, output, def); return output; } protected Fault parseFault(Element faultEl, Definition def) throws WSDLException { Fault fault = def.createFault(); String name = DOMUtils.getAttribute(faultEl, Constants.ATTR_NAME); QName messageName = getQualifiedAttributeValue(faultEl, Constants.ATTR_MESSAGE, Constants.ELEM_FAULT, def); if (name != null) { fault.setName(name); } if (messageName != null) { Message message = def.getMessage(messageName); if (message == null) { message = def.createMessage(); message.setQName(messageName); def.addMessage(message); } fault.setMessage(message); } //register any NS decls with the Definition NamedNodeMap attrs = faultEl.getAttributes(); registerNSDeclarations(attrs, def); Element tempEl = DOMUtils.getFirstChildElement(faultEl); while (tempEl != null) { if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) { fault.setDocumentationElement(tempEl); } else { fault.addExtensibilityElement( parseExtensibilityElement(Fault.class, tempEl, def)); } tempEl = DOMUtils.getNextSiblingElement(tempEl); } parseExtensibilityAttributes(faultEl, Fault.class, fault, def); return fault; } /** * This method should be used for elements that support extension * attributes because it does not track unexpected remaining attributes. */ private static QName getQualifiedAttributeValue(Element el, String attrName, String elDesc, Definition def) throws WSDLException { try { return DOMUtils.getQualifiedAttributeValue(el, attrName, elDesc, false, def); } catch (WSDLException e) { if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED)) { String attrValue = DOMUtils.getAttribute(el, attrName); return new QName(attrValue); } else { throw e; } } } /** * This method should be used for elements that do not support extension * attributes because it tracks unexpected remaining attributes. */ private static QName getQualifiedAttributeValue(Element el, String attrName, String elDesc, Definition def, List remainingAttrs) throws WSDLException { try { return DOMUtils.getQualifiedAttributeValue(el, attrName, elDesc, false, def, remainingAttrs); } catch (WSDLException e) { if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED)) { String attrValue = DOMUtils.getAttribute(el, attrName, remainingAttrs); return new QName(attrValue); } else { throw e; } } } private static void checkElementName(Element el, QName qname) throws WSDLException { if (!QNameUtils.matches(qname, el)) { WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Expected element '" + qname + "'."); wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el)); throw wsdlExc; } } private static Document getDocument(InputSource inputSource, String desc) throws WSDLException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(false); try { DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver( new JBossWSEntityResolver() ); Document doc = builder.parse(inputSource); return doc; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new WSDLException(WSDLException.PARSER_ERROR, "Problem parsing '" + desc + "'.", e); } } private static void registerNSDeclarations(NamedNodeMap attrs, Definition def) { int size = attrs.getLength(); for (int i = 0; i < size; i++) { Attr attr = (Attr)attrs.item(i); String namespaceURI = attr.getNamespaceURI(); String localPart = attr.getLocalName(); String value = attr.getValue(); if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS)) { if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS)) { DOMUtils.registerUniquePrefix(localPart, value, def); } else { DOMUtils.registerUniquePrefix(null, value, def); } } } } /** * Read the WSDL document accessible via the specified * URI into a WSDL definition. * * @param wsdlURI a URI (can be a filename or URL) pointing to a * WSDL XML definition. * @return the definition. */ public Definition readWSDL(String wsdlURI) throws WSDLException { return readWSDL(null, wsdlURI); } /** * Read the WSDL document accessible via the specified * URI into a WSDL definition. * * @param contextURI the context in which to resolve the * wsdlURI, if the wsdlURI is relative. Can be null, in which * case it will be ignored. * @param wsdlURI a URI (can be a filename or URL) pointing to a * WSDL XML definition. * @return the definition. */ public Definition readWSDL(String contextURI, String wsdlURI) throws WSDLException { try { if (verbose) { System.out.println("Retrieving document at '" + wsdlURI + "'" + (contextURI == null ? "." : ", relative to '" + contextURI + "'.")); } URL contextURL = (contextURI != null) ? StringUtils.getURL(null, contextURI) : null; URL url = StringUtils.getURL(contextURL, wsdlURI); InputStream inputStream = StringUtils.getContentAsInputStream(url); InputSource inputSource = new InputSource(inputStream); inputSource.setSystemId(url.toString()); Document doc = getDocument(inputSource, url.toString()); inputStream.close(); Definition def = readWSDL(url.toString(), doc); return def; } catch (WSDLException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new WSDLException(WSDLException.OTHER_ERROR, "Unable to resolve imported document at '" + wsdlURI + (contextURI == null ? "'." : "', relative to '" + contextURI + "'.") , e); } } /** * Read the specified <wsdl:definitions> element into a WSDL * definition. * * @param documentBaseURI the document base URI of the WSDL definition * described by the element. Will be set as the documentBaseURI * of the returned Definition. Can be null, in which case it * will be ignored. * @param definitionsElement the <wsdl:definitions> element * @return the definition described by the element. */ public Definition readWSDL(String documentBaseURI, Element definitionsElement) throws WSDLException { return readWSDL(documentBaseURI, definitionsElement, null); } /** * Read the specified <wsdl:definitions> element into a WSDL * definition. The WSDLLocator is used to provide the document * base URIs. The InputSource of the WSDLLocator is ignored, instead * the WSDL is parsed from the given Element. * * @param locator A WSDLLocator object used to provide * the document base URI of the WSDL definition described by the * element. * @param definitionsElement the <wsdl:definitions> element * @return the definition described by the element. */ public Definition readWSDL(WSDLLocator locator, Element definitionsElement) throws WSDLException { try { this.loc = locator; return readWSDL(locator.getBaseURI(), definitionsElement, null); } finally { locator.close(); this.loc = null; } } protected Definition readWSDL(String documentBaseURI, Element definitionsElement, Map importedDefs) throws WSDLException { return parseDefinitions(documentBaseURI, definitionsElement, importedDefs); } /** * Read the specified WSDL document into a WSDL definition. * * @param documentBaseURI the document base URI of the WSDL definition * described by the document. Will be set as the documentBaseURI * of the returned Definition. Can be null, in which case it * will be ignored. * @param wsdlDocument the WSDL document, an XML * document obeying the WSDL schema. * @return the definition described in the document. */ public Definition readWSDL(String documentBaseURI, Document wsdlDocument) throws WSDLException { return readWSDL(documentBaseURI, wsdlDocument.getDocumentElement()); } /** * Read a WSDL document into a WSDL definition. * * @param documentBaseURI the document base URI of the WSDL definition * described by the document. Will be set as the documentBaseURI * of the returned Definition. Can be null, in which case it * will be ignored. * @param inputSource an InputSource pointing to the * WSDL document, an XML document obeying the WSDL schema. * @return the definition described in the document pointed to * by the InputSource. */ public Definition readWSDL(String documentBaseURI, InputSource inputSource) throws WSDLException { String location = (inputSource.getSystemId() != null ? inputSource.getSystemId() : "- WSDL Document -"); return readWSDL(documentBaseURI, getDocument(inputSource, location)); } /** * Read a WSDL document into a WSDL definition. * * @param locator A WSDLLocator object used to provide InputSources * pointing to the wsdl file. * @return the definition described in the document */ public Definition readWSDL(WSDLLocator locator) throws WSDLException { InputSource is = locator.getBaseInputSource(); String base = locator.getBaseURI(); if (is == null) { throw new WSDLException(WSDLException.OTHER_ERROR, "Unable to locate document at '" + base + "'."); } is.setSystemId(base); this.loc = locator; if (verbose) { System.out.println("Retrieving document at '" + base + "'."); } try { return readWSDL(base, is); } finally { this.loc.close(); this.loc = null; } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLLocatorImpl.j0000644000175000017500000001140110566046204031402 0ustar godgod/* * 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.tools.wsdl; // $Id: WSDLLocatorImpl.java 2397 2007-02-18 12:54:28Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import javax.wsdl.xml.WSDLLocator; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.utils.ResourceURL; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; /* A WSDLLocator that can handle wsdl imports */ class WSDLLocatorImpl implements WSDLLocator { // provide logging private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class); private EntityResolver entityResolver; private URL wsdlLocation; private String latestImportURI; public WSDLLocatorImpl(EntityResolver entityResolver, URL wsdlLocation) { if (wsdlLocation == null) throw new IllegalArgumentException("WSDL file argument cannot be null"); this.entityResolver = entityResolver; this.wsdlLocation = wsdlLocation; } public InputSource getBaseInputSource() { log.trace("getBaseInputSource [wsdlUrl=" + wsdlLocation + "]"); try { InputStream inputStream = new ResourceURL(wsdlLocation).openStream(); if (inputStream == null) throw new IllegalArgumentException("Cannot obtain wsdl from [" + wsdlLocation + "]"); return new InputSource(inputStream); } catch (IOException e) { throw new RuntimeException("Cannot access wsdl from [" + wsdlLocation + "], " + e.getMessage()); } } public String getBaseURI() { return wsdlLocation.toExternalForm(); } public InputSource getImportInputSource(String parent, String resource) { log.trace("getImportInputSource [parent=" + parent + ",resource=" + resource + "]"); URL parentURL = null; try { parentURL = new URL(parent); } catch (MalformedURLException e) { log.error("Not a valid URL: " + parent); return null; } String wsdlImport = null; String external = parentURL.toExternalForm(); // An external URL if (resource.startsWith("http://") || resource.startsWith("https://")) { wsdlImport = resource; } // Absolute path else if (resource.startsWith("/")) { String beforePath = external.substring(0, external.indexOf(parentURL.getPath())); wsdlImport = beforePath + resource; } // A relative path else { String parentDir = external.substring(0, external.lastIndexOf("/")); // remove references to current dir while (resource.startsWith("./")) resource = resource.substring(2); // remove references to parentdir while (resource.startsWith("../")) { parentDir = parentDir.substring(0, parentDir.lastIndexOf("/")); resource = resource.substring(3); } wsdlImport = parentDir + "/" + resource; } try { log.trace("Trying to resolve: " + wsdlImport); InputSource inputSource = entityResolver.resolveEntity(wsdlImport, wsdlImport); if (inputSource != null) { latestImportURI = wsdlImport; } else { throw new IllegalArgumentException("Cannot resolve imported resource: " + wsdlImport); } return inputSource; } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new WSException("Cannot access imported wsdl [" + wsdlImport + "], " + e.getMessage()); } } public String getLatestImportURI() { return latestImportURI; } public void close() { } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLGenerator.jav0000755000175000017500000004370410743173754031460 0ustar godgod/* * 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.tools.wsdl; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.ws.soap.SOAPBinding; import org.apache.ws.policy.Policy; import org.apache.ws.policy.util.PolicyFactory; import org.apache.ws.policy.util.PolicyWriter; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.Style; import org.jboss.ws.extensions.policy.PolicyScopeLevel; import org.jboss.ws.extensions.policy.metadata.PolicyMetaExtension; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.MetaDataExtension; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.wsdl.Extendable; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLBindingFault; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLBindingOperationInput; import org.jboss.ws.metadata.wsdl.WSDLBindingOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLDocumentation; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLExtensibilityElement; import org.jboss.ws.metadata.wsdl.WSDLImport; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLProperty; import org.jboss.ws.metadata.wsdl.WSDLRPCPart; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem; import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Element; /** * Generates a WSDL object model. * * @author Jason T. Greene * @version $Revision: 5471 $ */ public abstract class WSDLGenerator { protected WSDLDefinitions wsdl; protected abstract void processTypes(); protected void processEndpoint(WSDLService service, EndpointMetaData endpoint) { WSDLEndpoint wsdlEndpoint = new WSDLEndpoint(service, endpoint.getPortName()); String address = endpoint.getEndpointAddress(); wsdlEndpoint.setAddress(address == null ? "REPLACE_WITH_ACTUAL_URL" : address); service.addEndpoint(wsdlEndpoint); QName interfaceQName = endpoint.getPortTypeName(); WSDLInterface wsdlInterface = new WSDLInterface(wsdl, interfaceQName); wsdl.addInterface(wsdlInterface); // Add imports if (!interfaceQName.getNamespaceURI().equals(endpoint.getServiceMetaData().getServiceName().getNamespaceURI())) { WSDLImport wsdlImport = new WSDLImport(wsdl); wsdlImport.setLocation(interfaceQName.getLocalPart() + "_PortType"); wsdlImport.setNamespace(interfaceQName.getNamespaceURI()); wsdl.addImport(wsdlImport); wsdl.registerNamespaceURI(interfaceQName.getNamespaceURI(), null); } QName bindingQName = new QName(interfaceQName.getNamespaceURI(), interfaceQName.getLocalPart() + "Binding"); WSDLBinding wsdlBinding = new WSDLBinding(wsdl, bindingQName); wsdlBinding.setInterfaceName(interfaceQName); wsdlBinding.setType(endpoint.getBindingId()); wsdl.addBinding(wsdlBinding); wsdlEndpoint.setBinding(bindingQName); if (endpoint.getDocumentation() != null) { wsdlInterface.setDocumentationElement(new WSDLDocumentation(endpoint.getDocumentation())); } for (OperationMetaData operation : endpoint.getOperations()) { processOperation(wsdlInterface, wsdlBinding, operation); } //Policies MetaDataExtension ext = endpoint.getExtension(Constants.URI_WS_POLICY); if (ext != null) { PolicyMetaExtension policyExt = (PolicyMetaExtension)ext; for (Policy policy : policyExt.getPolicies(PolicyScopeLevel.WSDL_PORT)) { addPolicyDefinition(policy); addPolicyReference(policy, wsdlEndpoint); } for (Policy policy : policyExt.getPolicies(PolicyScopeLevel.WSDL_PORT_TYPE)) { addPolicyDefinition(policy); addPolicyURIAttribute(policy, wsdlInterface); } for (Policy policy : policyExt.getPolicies(PolicyScopeLevel.WSDL_BINDING)) { addPolicyDefinition(policy); addPolicyReference(policy, wsdlBinding); } } } protected void addPolicyDefinition(Policy policy) { try { PolicyWriter writer = PolicyFactory.getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); writer.writePolicy(policy, outputStream); Element element = DOMUtils.parse(outputStream.toString(Constants.DEFAULT_XML_CHARSET)); WSDLExtensibilityElement ext = new WSDLExtensibilityElement(Constants.WSDL_ELEMENT_POLICY, element); wsdl.addExtensibilityElement(ext); //optional: to obtain a better looking wsdl, register ws-policy //prefix in wsdl:definitions if it is not defined there yet if (wsdl.getPrefix(element.getNamespaceURI())==null) { wsdl.registerNamespaceURI(element.getNamespaceURI(),element.getPrefix()); } } catch (IOException ioe) { throw new WSException("Error while converting policy to element!"); } } protected void addPolicyReference(Policy policy, Extendable extendable) { QName policyRefQName = Constants.WSDL_ELEMENT_WSP_POLICYREFERENCE; String prefix = wsdl.getPrefix(policyRefQName.getNamespaceURI()); if (prefix == null) { prefix = "wsp"; wsdl.registerNamespaceURI(policyRefQName.getNamespaceURI(), prefix); } Element element = DOMUtils.createElement(policyRefQName.getLocalPart(), prefix); element.setAttribute("URI", policy.getPolicyURI()); //TODO!! we need to understand if the policy is local or not... WSDLExtensibilityElement ext = new WSDLExtensibilityElement(Constants.WSDL_ELEMENT_POLICYREFERENCE, element); extendable.addExtensibilityElement(ext); } protected void addPolicyURIAttribute(Policy policy, Extendable extendable) { //TODO!! we need to understand if the policy is local or not... WSDLProperty prop = extendable.getProperty(Constants.WSDL_PROPERTY_POLICYURIS); if (prop == null) { extendable.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_POLICYURIS, policy.getPolicyURI())); } else { //PolicyURIs ships a comma separated list of URIs... prop.setValue(prop.getValue() + "," + policy.getPolicyURI()); } } protected void processOperation(WSDLInterface wsdlInterface, WSDLBinding wsdlBinding, OperationMetaData operation) { WSDLInterfaceOperation interfaceOperation = new WSDLInterfaceOperation(wsdlInterface, operation.getQName()); WSDLBindingOperation bindingOperation = new WSDLBindingOperation(wsdlBinding); interfaceOperation.setPattern(operation.isOneWay() ? Constants.WSDL20_PATTERN_IN_ONLY : Constants.WSDL20_PATTERN_IN_OUT); bindingOperation.setRef(operation.getQName()); bindingOperation.setSOAPAction(operation.getSOAPAction()); if (operation.getStyle() == Style.DOCUMENT) processOperationDOC(interfaceOperation, bindingOperation, operation); else processOperationRPC(interfaceOperation, bindingOperation, operation); for (FaultMetaData fault : operation.getFaults()) { QName faultName = new QName(operation.getQName().getNamespaceURI(), fault.getXmlName().getLocalPart()); WSDLInterfaceFault interfaceFault = new WSDLInterfaceFault(wsdlInterface, faultName); interfaceFault.setElement(fault.getXmlName()); wsdlInterface.addFault(interfaceFault); WSDLInterfaceOperationOutfault outfault = new WSDLInterfaceOperationOutfault(interfaceOperation); outfault.setRef(faultName); interfaceOperation.addOutfault(outfault); WSDLBindingFault bindingFault = new WSDLBindingFault(wsdlBinding); bindingFault.setRef(faultName); wsdlBinding.addFault(bindingFault); } // process optional documentation if (operation.getDocumentation() != null) { interfaceOperation.setDocumentationElement(new WSDLDocumentation(operation.getDocumentation())); } wsdlInterface.addOperation(interfaceOperation); wsdlBinding.addOperation(bindingOperation); } protected void addSignatureItem(WSDLInterfaceOperation operation, ParameterMetaData param, boolean isReturn) { Direction direction; if (isReturn) { direction = Direction.RETURN; } else if (param.getMode() == ParameterMode.INOUT) { direction = Direction.INOUT; } else if (param.getMode() == ParameterMode.OUT) { direction = Direction.OUT; } else { direction = Direction.IN; } operation.addRpcSignatureItem(new WSDLRPCSignatureItem(param.getPartName(), direction)); } protected void processOperationDOC(WSDLInterfaceOperation interfaceOperation, WSDLBindingOperation bindingOperation, OperationMetaData operation) { interfaceOperation.setStyle(Constants.URI_STYLE_DOCUMENT); WSDLInterfaceOperationInput input = new WSDLInterfaceOperationInput(interfaceOperation); WSDLBindingOperationInput bindingInput = new WSDLBindingOperationInput(bindingOperation); WSDLInterfaceOperationOutput output = null; WSDLBindingOperationOutput bindingOutput = null; boolean twoWay = !operation.isOneWay(); if (twoWay) { output = new WSDLInterfaceOperationOutput(interfaceOperation); bindingOutput = new WSDLBindingOperationOutput(bindingOperation); ParameterMetaData returnParameter = operation.getReturnParameter(); if (returnParameter != null) { QName xmlName = returnParameter.getXmlName(); String partName = returnParameter.getPartName(); if (returnParameter.isInHeader()) { WSDLSOAPHeader header = new WSDLSOAPHeader(xmlName, partName); header.setIncludeInSignature(true); bindingOutput.addSoapHeader(header); } else { output.setElement(xmlName); output.setPartName(partName); } addSignatureItem(interfaceOperation, returnParameter, true); } // If there is no return parameter, it will most likely be set later with an INOUT or OUT parameter. // Otherwise, a null element means there is a 0 body element part, which is allowed by BP 1.0 interfaceOperation.addOutput(output); bindingOperation.addOutput(bindingOutput); } for (ParameterMetaData param : operation.getParameters()) { if (param.isInHeader()) { WSDLSOAPHeader header = new WSDLSOAPHeader(param.getXmlName(), param.getPartName()); header.setIncludeInSignature(true); if (param.getMode() != ParameterMode.OUT) bindingInput.addSoapHeader(header); if (twoWay && param.getMode() != ParameterMode.IN) bindingOutput.addSoapHeader(header); } else { if (param.getMode() != ParameterMode.OUT) { input.setElement(param.getXmlName()); input.setPartName(param.getPartName()); } if (twoWay && param.getMode() != ParameterMode.IN) { output.setElement(param.getXmlName()); output.setPartName(param.getPartName()); } } addSignatureItem(interfaceOperation, param, false); } interfaceOperation.addInput(input); bindingOperation.addInput(bindingInput); } protected void processOperationRPC(WSDLInterfaceOperation interfaceOperation, WSDLBindingOperation bindingOperation, OperationMetaData operation) { interfaceOperation.setStyle(Constants.URI_STYLE_RPC); WSDLInterfaceOperationInput input = new WSDLInterfaceOperationInput(interfaceOperation); WSDLBindingOperationInput bindingInput = new WSDLBindingOperationInput(bindingOperation); QName operationName = operation.getQName(); input.setElement(operationName); WSDLInterfaceOperationOutput output = null; WSDLBindingOperationOutput bindingOutput = null; boolean twoWay = !operation.isOneWay(); if (twoWay) { output = new WSDLInterfaceOperationOutput(interfaceOperation); bindingOutput = new WSDLBindingOperationOutput(bindingOperation); output.setElement(new QName(operationName.getNamespaceURI(), operationName.getLocalPart() + "Response")); ParameterMetaData returnParameter = operation.getReturnParameter(); if (returnParameter != null) { QName xmlName = returnParameter.getXmlName(); String partName = returnParameter.getPartName(); if (returnParameter.isInHeader()) { WSDLSOAPHeader header = new WSDLSOAPHeader(xmlName, partName); header.setIncludeInSignature(true); bindingOutput.addSoapHeader(header); } else { WSDLRPCPart part = new WSDLRPCPart(returnParameter.getPartName(), returnParameter.getXmlType()); output.addChildPart(part); } addSignatureItem(interfaceOperation, returnParameter, true); } interfaceOperation.addOutput(output); bindingOperation.addOutput(bindingOutput); } for (ParameterMetaData param : operation.getParameters()) { if (param.isInHeader()) { WSDLSOAPHeader header = new WSDLSOAPHeader(param.getXmlName(), param.getPartName()); header.setIncludeInSignature(true); if (param.getMode() != ParameterMode.OUT) bindingInput.addSoapHeader(header); if (twoWay && param.getMode() != ParameterMode.IN) bindingOutput.addSoapHeader(header); } else { WSDLRPCPart part = new WSDLRPCPart(param.getPartName(), param.getXmlType()); if (param.getMode() != ParameterMode.OUT) input.addChildPart(part); if (twoWay && param.getMode() != ParameterMode.IN) output.addChildPart(part); } addSignatureItem(interfaceOperation, param, false); } interfaceOperation.addInput(input); bindingOperation.addInput(bindingInput); } protected void processService(ServiceMetaData service) { WSDLService wsdlService = new WSDLService(wsdl, service.getServiceName()); wsdl.addService(wsdlService); EndpointMetaData endpoint = null; for (Iterator iter = service.getEndpoints().iterator(); iter.hasNext();) { endpoint = iter.next(); processEndpoint(wsdlService, endpoint); } if (endpoint == null) throw new IllegalStateException("A service must have an endpoint"); wsdlService.setInterfaceName(endpoint.getPortName()); } /** * Generate a WSDL object model from the passed in ServiceMetaData. * * @param service the service * @return the WSDL object model */ public WSDLDefinitions generate(ServiceMetaData service) { // For now only WSDL 1.1 wsdl = new WSDLDefinitions(); wsdl.setWsdlNamespace(Constants.NS_WSDL11); // One WSDL per service String ns = service.getServiceName().getNamespaceURI(); wsdl.setTargetNamespace(ns); wsdl.registerNamespaceURI(ns, "tns"); wsdl.registerNamespaceURI(Constants.NS_SCHEMA_XSD, "xsd"); String soapURI = null; String soapPrefix = null; for (EndpointMetaData ep : service.getEndpoints()) { String bindingId = ep.getBindingId(); if (bindingId.startsWith(SOAPBinding.SOAP11HTTP_BINDING)) { soapPrefix = "soap"; soapURI = Constants.NS_SOAP11; } else if (bindingId.startsWith(SOAPBinding.SOAP12HTTP_BINDING)) { soapPrefix = "soap12"; soapURI = Constants.NS_SOAP12; } } if (soapURI != null && soapPrefix != null) wsdl.registerNamespaceURI(soapURI, soapPrefix); processTypes(); processService(service); return wsdl; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLWriterResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLWriterResolve0000644000175000017500000000301610542776150031550 0ustar godgod/* * 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.tools.wsdl; // $Id: WSDLWriterResolver.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.Writer; /** * A helper that writes out a WSDL definition * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 10-Oct-2004 */ public abstract class WSDLWriterResolver { public String actualFile; public String charset; public Writer writer; public abstract WSDLWriterResolver resolve(String suggestedFile) throws IOException; } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator0000755000175000017500000000765710626770234031351 0ustar godgod/* * 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.tools.wsdl; import com.sun.xml.bind.api.JAXBRIContext; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.extensions.security.Util; import org.jboss.ws.metadata.wsdl.DOMTypes; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.bind.SchemaOutputResolver; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Result; import javax.xml.transform.dom.DOMResult; import java.io.IOException; /** * JAXBWSDLGenerator provides a JAXB based WSDLGenerator. * * @author Jason T. Greene */ public class JAXBWSDLGenerator extends WSDLGenerator { private JAXBRIContext ctx; public JAXBWSDLGenerator(JAXBRIContext ctx) { super(); this.ctx = ctx; } /** * Delegate schema generation to JAXB RI */ protected void processTypes() { // Register namespaces for (String ns : ctx.getKnownNamespaceURIs()) if (ns.length() > 0) wsdl.registerNamespaceURI(ns, null); try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.newDocument(); DOMTypes types = new DOMTypes(doc); final Element element = types.getElement(); final Element throwAway = doc.createElement("throw-away"); ctx.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespace, String file) throws IOException { // JBWS-1295, getKnownNamespaceURIs is not accurate if (namespace.length() > 0 && wsdl.getPrefix(namespace) == null) wsdl.registerNamespaceURI(namespace, null); // JAXB creates an empty namespace due to type references, ignore it DOMResult result = new DOMResult((namespace == null || namespace.length() == 0) ? throwAway : element); result.setSystemId("replace-me"); return result; } }); // Until we stop inlining schema, we will need to filter schemaLocations since JAXB requires them removeSchemaLocations(element); wsdl.setWsdlTypes(types); } catch (Exception exception) { throw new WSException("Could not generate schema: " + exception.getMessage(), exception); } } private void removeSchemaLocations(Element element) { for (Element child = Util.getFirstChildElement(element); child != null; child = Util.getNextSiblingElement(child)) { if ("import".equals(child.getLocalName()) && Constants.NS_SCHEMA_XSD.equals(child.getNamespaceURI()) && "replace-me".equals(child.getAttribute("schemaLocation"))) { child.removeAttribute("schemaLocation"); } else { removeSchemaLocations(child); } } } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLWriter.java0000644000175000017500000001523010703174553031127 0ustar godgod/* * 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.tools.wsdl; // $Id: WSDLWriter.java 4730 2007-10-10 16:10:19Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.Writer; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.DOMTypes; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLTypes; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.XSModelTypes; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * A helper that writes out a WSDL definition * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 10-Oct-2004 */ public class WSDLWriter { // provide logging protected static final Logger log = Logger.getLogger(WSDLWriter.class); protected WSDLDefinitions wsdl; protected WSDLUtils utils = WSDLUtils.getInstance(); // The soap prefix protected String soapPrefix = "soap"; /** * Include or import WSDL Types */ protected boolean includeSchemaInWSDL = true; public WSDLWriter(WSDLDefinitions wsdl) { if (wsdl == null) throw new IllegalArgumentException("WSDL definitions is NULL"); this.wsdl = wsdl; } /** Write the wsdl definition to the given writer, clients should not care about the wsdl version. */ public void write(Writer writer, String charset) throws IOException { write(writer, charset, null); } public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws IOException { String wsdlNamespace = wsdl.getWsdlNamespace(); if (Constants.NS_WSDL11.equals(wsdlNamespace)) { WSDL11Writer wsdl11Writer = new WSDL11Writer(wsdl); wsdl11Writer.write(writer, charset, resolver); } else { throw new WSException("Unsupported wsdl version: " + wsdlNamespace); } } public void write(Writer writer) throws IOException { StringBuilder buffer = new StringBuilder(); buffer.append(Constants.XML_HEADER); appendDefinitions(buffer, wsdl.getTargetNamespace()); appendTypes(buffer, wsdl.getTargetNamespace()); appendInterfaces(buffer, wsdl.getTargetNamespace()); appendBindings(buffer, wsdl.getTargetNamespace()); appendServices(buffer, wsdl.getTargetNamespace()); buffer.append(""); Element element = DOMUtils.parse(buffer.toString()); new DOMWriter(writer).setPrettyprint(true).print(element); } protected void appendDefinitions(StringBuilder buffer, String namespace) { buffer.append(" 0) { buffer.append(" xmlns:" + prefix + "='" + namespaceURI + "'"); if (prefix.startsWith("soap")) soapPrefix = prefix; } } buffer.append(">"); } protected void appendTypes(StringBuilder buffer, String namespace) { WSDLTypes wsdlTypes = wsdl.getWsdlTypes(); // If the type section is bound to a particular namespace, verify it mataches, otherwise skip if (wsdlTypes.getNamespace() != null && !wsdlTypes.getNamespace().equals(namespace)) return; if (wsdlTypes instanceof XSModelTypes) { buffer.append(""); JBossXSModel xsM = WSDLUtils.getSchemaModel(wsdlTypes); String schema = xsM.serialize(); buffer.append(schema); buffer.append(""); } else if (wsdlTypes instanceof DOMTypes) { synchronized (wsdlTypes) { buffer.append(DOMWriter.printNode(((DOMTypes)wsdlTypes).getElement(), true)); } } } protected void appendInterfaces(StringBuilder buffer, String namespace) { } protected void appendBindings(StringBuilder buffer, String namespace) { } protected void appendServices(StringBuilder buffer, String namespace) { } /** Get a prefixed name of form prefix:localPart */ protected String getQNameRef(QName qname) { String retStr = qname.getLocalPart(); String prefix = qname.getPrefix(); String nsURI = qname.getNamespaceURI(); if (prefix.length() == 0 && nsURI.length() > 0) { qname = wsdl.registerQName(qname); prefix = qname.getPrefix(); } if (prefix.length() > 0) retStr = prefix + ":" + retStr; return retStr; } public WSDLDefinitions getWsdl() { return wsdl; } public void setWsdl(WSDLDefinitions wsdl) { this.wsdl = wsdl; } public boolean isIncludeTypesInWSDL() { return includeSchemaInWSDL; } public void logException(Exception e) { if (log.isTraceEnabled()) { log.trace(e); } } public void logMessage(String msg) { if (log.isTraceEnabled()) { log.trace(msg); } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDL11Writer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDL11Writer.java0000644000175000017500000006055010743173754031304 0ustar godgod/* * 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.tools.wsdl; import java.io.IOException; import java.io.Writer; import java.util.Arrays; import java.util.HashSet; import javax.wsdl.Definition; import javax.wsdl.WSDLException; import javax.wsdl.factory.WSDLFactory; import javax.xml.namespace.QName; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.Extendable; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLBindingOperationInput; import org.jboss.ws.metadata.wsdl.WSDLBindingOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLDocumentation; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLExtensibilityElement; import org.jboss.ws.metadata.wsdl.WSDLImport; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceMessageReference; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLProperty; import org.jboss.ws.metadata.wsdl.WSDLRPCPart; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem; import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * A WSDL Writer that writes a WSDL 1.1 file. It works off * of the WSDL20 Object Graph. * @author Anil Saldhana */ public class WSDL11Writer extends WSDLWriter { //Used Internally private String wsdlStyle = Constants.RPC_LITERAL; // Used to prevent duplicates private HashSet writtenFaultMessages = new HashSet(); /** Use WSDLDefinitions.writeWSDL instead. */ public WSDL11Writer(WSDLDefinitions wsdl) { super(wsdl); } public void write(Writer writer) throws IOException { write(writer, null); } public void write(Writer writer, String charset) throws IOException { write(writer, charset, null); } public void write(Writer writer, String charset, WSDLWriterResolver resolver) throws IOException { // Write out the wsdl-1.1 represention (only path to obtain is from WSDL11Reader) if (wsdl.getWsdlOneOneDefinition() != null) { Definition wsdlDefinition = wsdl.getWsdlOneOneDefinition(); try { WSDLFactory wsdlFactory = WSDLFactory.newInstance(); javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); wsdlWriter.writeWSDL(wsdlDefinition, writer); } catch (WSDLException e) { this.logException(e); throw new IOException(e.toString()); } } else { StringBuilder buffer = new StringBuilder(); //Detect the WSDL Style early wsdlStyle = utils.getWSDLStyle(wsdl); StringBuilder importBuffer = new StringBuilder(); for (WSDLImport wsdlImport : wsdl.getImports()) { if (resolver == null) continue; WSDLWriterResolver resolved = resolver.resolve(wsdlImport.getLocation()); if (resolved == null) continue; String namespace = wsdlImport.getNamespace(); importBuffer.append(""); if (resolved != null) { StringBuilder builder = new StringBuilder(); appendDefinitions(builder, namespace); appendBody(builder, namespace); writeBuilder(builder, resolved.writer, resolved.charset); resolved.writer.close(); } } appendDefinitions(buffer, wsdl.getTargetNamespace()); if (importBuffer.length() > 0) buffer.append(importBuffer); appendBody(buffer, wsdl.getTargetNamespace()); writeBuilder(buffer, writer, charset); } } private void writeBuilder(StringBuilder builder, Writer writer, String charset) throws IOException { Element element = DOMUtils.parse(builder.toString()); if (charset != null) writer.write("\n"); new DOMWriter(writer).setPrettyprint(true).print(element); } protected void appendBody(StringBuilder builder, String namespace) { writtenFaultMessages.clear(); appendTypes(builder, namespace); appendUnknownExtensibilityElements(builder, wsdl); appendMessages(builder, namespace); appendInterfaces(builder, namespace); appendBindings(builder, namespace); appendServices(builder, namespace); builder.append(""); } protected void appendUnknownExtensibilityElements(StringBuilder builder, Extendable extendable) { for (WSDLExtensibilityElement ext : extendable.getAllExtensibilityElements()) { appendPolicyElements(builder, ext); //add processing of further extensibility element types below } } private void appendPolicyElements(StringBuilder builder, WSDLExtensibilityElement extElem) { if (Constants.WSDL_ELEMENT_POLICY.equalsIgnoreCase(extElem.getUri()) || Constants.WSDL_ELEMENT_POLICYREFERENCE.equalsIgnoreCase(extElem.getUri())) { appendElementSkippingKnownNs(builder, extElem.getElement()); } } private void appendElementSkippingKnownNs(StringBuilder builder, Element el) { builder.append("<"+el.getNodeName()); NamedNodeMap attributes = el.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Attr attr = (Attr)attributes.item(i); if (attr.getName().startsWith("xmlns:") && attr.getValue()!=null) { String prefix = attr.getName().substring(6); if (attr.getValue().equalsIgnoreCase(wsdl.getNamespaceURI(prefix))) continue; } builder.append(" "+attr.getName()+"='"+attr.getValue()+"'"); } builder.append(">"); NodeList childrenList = el.getChildNodes(); for (int i=0; i"); } protected void appendMessages(StringBuilder buffer, String namespace) { WSDLInterface[] interfaces = wsdl.getInterfaces(); int len = interfaces != null ? interfaces.length : 0; for (int i = 0; i < len; i++) { WSDLInterface intf = interfaces[i]; if (! namespace.equals(intf.getName().getNamespaceURI())) continue; WSDLInterfaceOperation[] operations = intf.getSortedOperations(); int lenOps = operations.length; for (int j = 0; j < lenOps; j++) { appendMessage(buffer, operations[j]); appendMessagesForExceptions(buffer, operations[j]); } } } private void appendMessage(StringBuilder buffer, WSDLInterfaceOperation operation) { String opname = operation.getName().getLocalPart(); //Determine the style of the wsdl if (Constants.URI_STYLE_RPC.equals(operation.getStyle()) == false) wsdlStyle = Constants.DOCUMENT_LITERAL; //Not RPC/Literal String interfaceName = operation.getWsdlInterface().getName().getLocalPart(); buffer.append(""); for (WSDLInterfaceOperationInput input : operation.getInputs()) { appendUnknownExtensibilityElements(buffer, input); //only one may contain extensibility elements appendMessageParts(buffer, input); } buffer.append(""); if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern())) { buffer.append(""); WSDLInterfaceOperationOutput[] outputs = operation.getOutputs(); for (WSDLInterfaceOperationOutput output : outputs) appendMessageParts(buffer, output); buffer.append(""); } } private void appendMessagesForExceptions(StringBuilder buffer, WSDLInterfaceOperation operation) { //Get the outfaults WSDLInterfaceOperationOutfault[] faults = operation.getOutfaults(); int len = faults != null ? faults.length : 0; for (int i = 0; i < len; i++) { WSDLInterfaceOperationOutfault fault = faults[i]; String exceptionName = fault.getRef().getLocalPart(); if (writtenFaultMessages.contains(exceptionName)) continue; WSDLInterfaceFault interfaceFault = operation.getWsdlInterface().getFault(fault.getRef()); QName xmlName = interfaceFault.getElement(); buffer.append(""); String prefix = wsdl.getPrefix(xmlName.getNamespaceURI()); String xmlNameStr = prefix + ":" + xmlName.getLocalPart(); buffer.append(""); buffer.append(""); writtenFaultMessages.add(exceptionName); } } private String getReferenceString(QName name) { String namespaceURI = name.getNamespaceURI(); String prefix = wsdl.getPrefix(namespaceURI); if (prefix == null) throw new WSException("Prefix not bound for namespace: " + namespaceURI); return prefix + ":" + name.getLocalPart(); } private void appendMessageParts(StringBuilder buffer, WSDLInterfaceMessageReference reference) { if (wsdlStyle.equals(Constants.RPC_LITERAL)) { for (WSDLRPCPart part : reference.getChildParts()) { buffer.append(""); } } else { QName element = reference.getElement(); // Null represents empty message if (element != null) { buffer.append(""); } } WSDLBindingMessageReference bindingReference = getBindingReference(reference); if (bindingReference == null) return; for (WSDLSOAPHeader header : bindingReference.getSoapHeaders()) { if (header.isIncludeInSignature()); { QName element = header.getElement(); buffer.append(""); } } } private WSDLBindingMessageReference getBindingReference(WSDLInterfaceMessageReference reference) { WSDLInterfaceOperation wsdlOperation = reference.getWsdlOperation(); WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface(); WSDLBinding binding = wsdlInterface.getWsdlDefinitions().getBindingByInterfaceName(wsdlInterface.getName()); WSDLBindingOperation bindingOperation = binding.getOperationByRef(wsdlOperation.getName()); WSDLBindingMessageReference[] bindingReferences; if (reference instanceof WSDLInterfaceOperationInput) bindingReferences = bindingOperation.getInputs(); else bindingReferences = bindingOperation.getOutputs(); if (bindingReferences.length > 1) throw new IllegalArgumentException("WSDl 1.1 only supports In-Only, and In-Out MEPS, more than reference input found"); if (bindingReferences.length == 1) return bindingReferences[0]; return null; } protected void appendInterfaces(StringBuilder buffer, String namespace) { WSDLInterface[] intfs = wsdl.getInterfaces(); for (int i = 0; i < intfs.length; i++) { WSDLInterface intf = intfs[i]; if (!namespace.equals(intf.getName().getNamespaceURI())) continue; buffer.append(""); appendDocumentation(buffer, intf.getDocumentationElement()); appendPortOperations(buffer, intf); buffer.append(""); } } private String getParameterOrder(WSDLInterfaceOperation operation) { StringBuilder builder = new StringBuilder(); for (WSDLRPCSignatureItem item : operation.getRpcSignatureItems()) { if (item.getDirection() != Direction.RETURN) { if (builder.length() > 0) builder.append(' '); builder.append(item.getName()); } } return builder.toString(); } protected void appendPortOperations(StringBuilder buffer, WSDLInterface intf) { String prefix = wsdl.getPrefix(intf.getName().getNamespaceURI()); WSDLInterfaceOperation[] operations = intf.getSortedOperations(); for (int i = 0; i < operations.length; i++) { WSDLInterfaceOperation operation = operations[i]; buffer.append(" 0) buffer.append(" parameterOrder='").append(parameterOrder).append("'"); } buffer.append(">"); appendDocumentation(buffer, operation.getDocumentationElement()); appendUnknownExtensibilityElements(buffer, operation); String opname = operation.getName().getLocalPart(); String interfaceName = operation.getWsdlInterface().getName().getLocalPart(); String msgEl = prefix + ":" + interfaceName + "_" + opname; buffer.append("").append(""); if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(operation.getPattern())) { buffer.append(""); buffer.append(""); } //Append the Faults for (WSDLInterfaceOperationOutfault fault : operation.getOutfaults()) { QName element = fault.getRef(); String faultPrefix = wsdl.getPrefix(element.getNamespaceURI()); buffer.append(""); } buffer.append(""); } } protected void appendDocumentation(StringBuilder buffer, WSDLDocumentation documentation) { if (documentation != null && documentation.getContent() != null) { buffer.append(""); buffer.append(documentation.getContent()); buffer.append(""); } } protected void appendBindings(StringBuilder buffer, String namespace) { WSDLBinding[] bindings = wsdl.getBindings(); for (int i = 0; i < bindings.length; i++) { WSDLBinding binding = bindings[i]; if (!namespace.equals(binding.getName().getNamespaceURI())) continue; buffer.append(""); //TODO:Need to derive the WSDLStyle from the Style attribute of InterfaceOperation if (wsdlStyle == null) throw new IllegalArgumentException("WSDL Style is null (should be rpc or document"); String style = "rpc"; if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL)) style = "document"; appendUnknownExtensibilityElements(buffer, binding); // The value of the REQUIRED transport attribute (of type xs:anyURI) indicates which transport of SOAP this binding corresponds to. // The URI value "http://schemas.xmlsoap.org/soap/http" corresponds to the HTTP binding. // Other URIs may be used here to indicate other transports (such as SMTP, FTP, etc.). buffer.append("<" + soapPrefix + ":binding transport='" + Constants.URI_SOAP_HTTP + "' style='" + style + "'/>"); appendBindingOperations(buffer, binding); buffer.append(""); } } protected void appendBindingOperations(StringBuilder buffer, WSDLBinding binding) { WSDLBindingOperation[] operations = binding.getOperations(); Arrays.sort(operations); for (int i = 0; i < operations.length; i++) { WSDLBindingOperation operation = operations[i]; QName interfaceName = operation.getWsdlBinding().getInterfaceName(); WSDLInterface wsdlInterface = wsdl.getInterface(interfaceName); if (wsdlInterface == null) throw new WSException("WSDL Interface should not be null"); WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(operation.getRef()); buffer.append(""); String soapAction = (operation.getSOAPAction() != null ? operation.getSOAPAction() : ""); appendUnknownExtensibilityElements(buffer, operation); buffer.append("<" + soapPrefix + ":operation soapAction=\"" + soapAction + "\"/>"); WSDLBindingOperationInput[] inputs = operation.getInputs(); if (inputs.length != 1) throw new WSException("WSDl 1.1 only supports In-Only, and In-Out MEPS."); buffer.append(""); appendUnknownExtensibilityElements(buffer, inputs[0]); appendSOAPBinding(buffer, wsdlInterface, operation, inputs); buffer.append(""); if (! Constants.WSDL20_PATTERN_IN_ONLY.equals(getBindingOperationPattern(operation))) { buffer.append(""); WSDLBindingOperationOutput[] outputs = operation.getOutputs(); appendSOAPBinding(buffer, wsdlInterface, operation, outputs); buffer.append(""); } //Append faults WSDLInterfaceOperationOutfault[] faults = interfaceOperation.getOutfaults(); if (faults != null) { for (WSDLInterfaceOperationOutfault fault : faults) { String n = "name='" + fault.getRef().getLocalPart() + "'"; buffer.append(""); buffer.append("<" + soapPrefix + ":fault " + n + " use='literal' />"); buffer.append(""); } buffer.append(""); } } } private void appendSOAPBinding(StringBuilder buffer, WSDLInterface wsdlInterface, WSDLBindingOperation operation, WSDLBindingMessageReference[] inputs) { String tns = wsdl.getTargetNamespace(); WSDLInterfaceOperation interfaceOperation = wsdlInterface.getOperation(operation.getRef()); WSDLInterfaceMessageReference reference = (inputs instanceof WSDLBindingOperationInput[]) ? interfaceOperation.getInputs()[0] : interfaceOperation.getOutputs()[0]; StringBuilder bodyParts = new StringBuilder(); if (Constants.DOCUMENT_LITERAL == wsdlStyle) { // Empty bare body if (reference.getPartName() != null) bodyParts.append(reference.getPartName()); } else { for (WSDLRPCPart part : reference.getChildParts()) { if (bodyParts.length() > 0) bodyParts.append(" "); bodyParts.append(part.getName()); } } StringBuilder soapHeader = new StringBuilder(); for (WSDLSOAPHeader header : inputs[0].getSoapHeaders()) { if (header.isIncludeInSignature()) { String messageName = wsdlInterface.getName().getLocalPart() + "_" + operation.getRef().getLocalPart(); if (reference instanceof WSDLInterfaceOperationOutput) messageName += "Response"; soapHeader.append("<").append(soapPrefix).append(":header use='literal' message='tns:").append(messageName); soapHeader.append("' part='").append(header.getPartName()).append("'/>"); } } buffer.append("<" + soapPrefix + ":body use='literal'"); if (wsdlStyle != Constants.DOCUMENT_LITERAL) buffer.append(" namespace='" + tns + "'"); if (soapHeader.length() > 0) { buffer.append(" parts='").append(bodyParts).append("'/>"); buffer.append(soapHeader); } else { buffer.append("/>"); } } private String getBindingOperationPattern(WSDLBindingOperation operation) { WSDLBinding binding = operation.getWsdlBinding(); String pattern = binding.getInterface().getOperation(operation.getRef()).getPattern(); return pattern; } protected void appendServices(StringBuilder buffer, String namespace) { WSDLService[] services = wsdl.getServices(); int len = services.length; for (int i = 0; i < len; i++) { WSDLService service = services[i]; if (!namespace.equals(service.getName().getNamespaceURI())) continue; buffer.append(""); appendUnknownExtensibilityElements(buffer, service); WSDLEndpoint[] endpoints = service.getEndpoints(); int lenend = endpoints.length; for (int j = 0; j < lenend; j++) { WSDLEndpoint endpoint = endpoints[j]; appendServicePort(buffer, endpoint); } buffer.append(""); } } protected void appendServicePort(StringBuilder buffer, WSDLEndpoint endpoint) { String name = endpoint.getName().getLocalPart(); QName endpointBinding = endpoint.getBinding(); String prefix = endpointBinding.getPrefix(); prefix = wsdl.getPrefix(endpointBinding.getNamespaceURI()); String ebname = prefix + ":" + endpointBinding.getLocalPart(); buffer.append(""); buffer.append("<" + soapPrefix + ":address location='" + endpoint.getAddress() + "'/>"); appendUnknownExtensibilityElements(buffer, endpoint); buffer.append(""); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDL11DefinitionF0000644000175000017500000000705310602113523031263 0ustar godgod/* * 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.tools.wsdl; // $Id: WSDL11DefinitionFactory.java 2689 2007-03-27 04:02:27Z jason.greene@jboss.com $ import java.net.URL; import javax.wsdl.Definition; import javax.wsdl.WSDLException; import javax.wsdl.extensions.ExtensionRegistry; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLReader; import org.jboss.logging.Logger; import org.jboss.ws.core.utils.JBossWSEntityResolver; import org.xml.sax.EntityResolver; /** * A factory that creates a WSDL-1.1 Definition from an URL. * * @author Thomas.Diesler@jboss.org * @since 15-April-2004 */ public class WSDL11DefinitionFactory { // provide logging private static Logger log = Logger.getLogger(WSDL11DefinitionFactory.class); // This feature is set by default in wsdl4j, it means the object structore contains the imported arguments public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments"; // Set this feature for additional debugging output public static final String FEATURE_VERBOSE = "javax.wsdl.verbose"; // The WSDLReader that is used by this factory private WSDLReader wsdlReader; // Hide constructor private WSDL11DefinitionFactory() throws WSDLException { WSDLFactory wsdlFactory = WSDLFactory.newInstance(); wsdlReader = wsdlFactory.newWSDLReader(); // Allow unknown extensions (jaxws/jaxb binding elements) wsdlReader.setExtensionRegistry(new ExtensionRegistry()); wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false); } /** Create a new instance of a wsdl factory */ public static WSDL11DefinitionFactory newInstance() throws WSDLException { return new WSDL11DefinitionFactory(); } /** Set a feature on the underlying reader */ public void setFeature(String name, boolean value) throws IllegalArgumentException { wsdlReader.setFeature(name, value); } /** * Read the wsdl document from the given URL */ public Definition parse(URL wsdlLocation) throws WSDLException { if (wsdlLocation == null) throw new IllegalArgumentException("URL cannot be null"); log.trace("parse: " + wsdlLocation.toExternalForm()); EntityResolver entityResolver = new JBossWSEntityResolver(); // Set EntityResolver in patched version of wsdl4j-1.5.2jboss // [TODO] show the usecase that needs this // ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver); Definition wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation)); return wsdlDefinition; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLDefinitionsFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDLDefinitionsFa0000644000175000017500000001436510650145103031453 0ustar godgod/* * 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.tools.wsdl; // $Id: WSDLDefinitionsFactory.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.utils.JBossWSEntityResolver; import org.jboss.ws.core.utils.ResourceURL; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLException; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.EntityResolver; import javax.wsdl.Definition; import javax.wsdl.factory.WSDLFactory; import javax.wsdl.xml.WSDLReader; import javax.xml.parsers.DocumentBuilder; import java.io.InputStream; import java.io.StringWriter; import java.net.ConnectException; import java.net.URL; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * A factory that creates a WSDLDefinitions object from an URL. * * This implementations deals with different WSDL versions so that clients of this * factory do need to know about WSDL version specifics. The Java object view of the * WSDL document (WSDLDefinitions) is modeled on WSDL-2.0 * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class WSDLDefinitionsFactory { // provide logging private static final Logger log = Logger.getLogger(WSDLDefinitionsFactory.class); // This feature is set by default in wsdl4j, it means the object structure contains the imported arguments public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments"; // Set this feature for additional debugging output public static final String FEATURE_VERBOSE = "javax.wsdl.verbose"; // The WSDL reader features private Map features = new HashMap(); // Hide constructor private WSDLDefinitionsFactory() { } /** * Create a new instance of a wsdl factory */ public static WSDLDefinitionsFactory newInstance() { return new WSDLDefinitionsFactory(); } /** * Set a feature on the underlying reader */ public void setFeature(String name, boolean value) throws IllegalArgumentException { features.put(name, new Boolean(value)); } /** * Read the wsdl document from the given URL */ public WSDLDefinitions parse(URL wsdlLocation) throws WSDLException { if (wsdlLocation == null) throw new IllegalArgumentException("URL cannot be null"); if (log.isDebugEnabled()) log.debug("parse: " + wsdlLocation.toExternalForm()); EntityResolver entityResolver = new JBossWSEntityResolver(); WSDLDefinitions wsdlDefinitions = null; try { Document wsdlDoc = getDocument(wsdlLocation); String defaultNamespace = getDefaultNamespace(wsdlDoc); if (Constants.NS_WSDL11.equals(defaultNamespace)) { WSDLFactory wsdlFactory = WSDLFactory.newInstance(JBossWSDLFactoryImpl.class.getName()); WSDLReader wsdlReader = wsdlFactory.newWSDLReader(); wsdlReader.setFeature("javax.wsdl.verbose", false); // Setup reader features Iterator it = features.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); String key = (String)entry.getKey(); Boolean flag = (Boolean)entry.getValue(); wsdlReader.setFeature(key, flag.booleanValue()); } Definition definition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver, wsdlLocation)); wsdlDefinitions = new WSDL11Reader().processDefinition(definition, wsdlLocation); wsdlDefinitions.setWsdlDocument(wsdlDoc); } else { throw new WSDLException("Invalid default namespace: " + defaultNamespace); } if (log.isTraceEnabled()) { StringWriter stwr = new StringWriter(); WSDL11Writer wsdlWriter = new WSDL11Writer(wsdlDefinitions); wsdlWriter.write(stwr); log.trace("\n" + stwr.toString()); } } catch (WSDLException e) { throw e; } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new WSDLException(e); } return wsdlDefinitions; } /** Get the WSDL document. */ private Document getDocument(URL wsdlLocation) throws WSDLException { try { InputStream inputStream = new ResourceURL(wsdlLocation).openStream(); try { DocumentBuilder builder = DOMUtils.getDocumentBuilder(); return builder.parse(inputStream); } finally { inputStream.close(); } } catch (ConnectException ex) { throw new WSDLException("Cannot connect to: " + wsdlLocation); } catch (Exception ex) { throw new WSDLException("Cannot parse wsdlLocation: " + wsdlLocation, ex); } } /** Get the default namespace for the given WSDL */ private String getDefaultNamespace(Document wsdlDoc) throws WSDLException { Element root = wsdlDoc.getDocumentElement(); String defaultNamespace = root.getNamespaceURI(); return defaultNamespace; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDL11Reader.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/wsdl/WSDL11Reader.java0000644000175000017500000017606210743173754031240 0ustar godgod/* * 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.tools.wsdl; // $Id: WSDL11Reader.java 5471 2008-01-15 18:14:04Z alessio.soldano@jboss.com $ import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.wsdl.Binding; import javax.wsdl.BindingInput; import javax.wsdl.BindingOperation; import javax.wsdl.BindingOutput; import javax.wsdl.Definition; import javax.wsdl.Fault; import javax.wsdl.Import; import javax.wsdl.Input; import javax.wsdl.Message; import javax.wsdl.Operation; import javax.wsdl.OperationType; import javax.wsdl.Output; import javax.wsdl.Part; import javax.wsdl.Port; import javax.wsdl.PortType; import javax.wsdl.Service; import javax.wsdl.Types; import javax.wsdl.WSDLException; import javax.wsdl.extensions.ElementExtensible; import javax.wsdl.extensions.ExtensibilityElement; import javax.wsdl.extensions.UnknownExtensibilityElement; import javax.wsdl.extensions.http.HTTPBinding; import javax.wsdl.extensions.mime.MIMEContent; import javax.wsdl.extensions.mime.MIMEMultipartRelated; import javax.wsdl.extensions.mime.MIMEPart; import javax.wsdl.extensions.schema.Schema; import javax.wsdl.extensions.soap.SOAPAddress; import javax.wsdl.extensions.soap.SOAPBinding; import javax.wsdl.extensions.soap.SOAPBody; import javax.wsdl.extensions.soap.SOAPHeader; import javax.wsdl.extensions.soap.SOAPOperation; import javax.wsdl.extensions.soap12.SOAP12Address; import javax.wsdl.extensions.soap12.SOAP12Binding; import javax.wsdl.extensions.soap12.SOAP12Body; import javax.wsdl.extensions.soap12.SOAP12Operation; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.utils.ResourceURL; import org.jboss.ws.metadata.wsdl.Extendable; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLBindingOperationInput; import org.jboss.ws.metadata.wsdl.WSDLBindingOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLDocumentation; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLExtensibilityElement; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLMIMEPart; import org.jboss.ws.metadata.wsdl.WSDLProperty; import org.jboss.ws.metadata.wsdl.WSDLRPCPart; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem; import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLTypes; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.XSModelTypes; import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.ws.tools.JavaToXSD; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * A helper that translates a WSDL-1.1 object graph into a WSDL-2.0 object graph. * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @author Jason T. Greene * @since 10-Oct-2004 */ public class WSDL11Reader { // provide logging private static final Logger log = Logger.getLogger(WSDL11Reader.class); private WSDLDefinitions destWsdl; // Maps wsdl message parts to their corresponding element names private Map messagePartToElementMap = new HashMap(); // Map of for schemalocation keyed by namespace private Map schemaLocationsMap = new HashMap(); private LinkedHashMap allBindings; private LinkedHashMap portTypeBindings; // Temporary files used by this reader. private List tempFiles = new ArrayList(); // SWA handling private Map> skippedSWAParts = new HashMap>(); // It is generally unsafe to use the getter for a top level element on another top level element. // For examples Binding.getPortType() returns a PortType which might might be undefined // The lists below only contain "defined" top level elements private Map> servicesByNamespace = new HashMap>(); private Map> bindingsByNamespace = new HashMap>(); private Map> portTypesByNamespace = new HashMap>(); private Map> messagesByNamespace = new HashMap>(); private Set importedDefinitions = new HashSet(); /** * Takes a WSDL11 Definition element and converts into * our object graph that has been developed for WSDL20 * * @param srcWsdl The src WSDL11 definition * @param wsdlLoc The source location, if null we cannot process imports or includes */ public WSDLDefinitions processDefinition(Definition srcWsdl, URL wsdlLoc) throws IOException, WSDLException { log.trace("processDefinition: " + wsdlLoc); destWsdl = new WSDLDefinitions(); destWsdl.setWsdlTypes(new XSModelTypes()); destWsdl.setWsdlOneOneDefinition(srcWsdl); destWsdl.setWsdlNamespace(Constants.NS_WSDL11); processNamespaces(srcWsdl); processTopLevelElements(srcWsdl); processTypes(srcWsdl, wsdlLoc); processUnknownExtensibilityElements(srcWsdl, destWsdl); processServices(srcWsdl); if (getAllDefinedBindings(srcWsdl).size() != destWsdl.getBindings().length) processUnreachableBindings(srcWsdl); cleanupTemporaryFiles(); return destWsdl; } private void processTopLevelElements(Definition srcWsdl) { String targetNS = srcWsdl.getTargetNamespace(); importedDefinitions.add(srcWsdl); // Messages Collection messages = srcWsdl.getMessages().values(); for (Message message : messages) { List list = messagesByNamespace.get(targetNS); if (list == null) { list = new ArrayList(); messagesByNamespace.put(targetNS, list); } if (message.isUndefined() == false) list.add(message); } // PortTypes Collection portTypes = srcWsdl.getPortTypes().values(); for (PortType portType : portTypes) { List list = portTypesByNamespace.get(targetNS); if (list == null) { list = new ArrayList(); portTypesByNamespace.put(targetNS, list); } if (portType.isUndefined() == false) list.add(portType); } // Bindings Collection bindings = srcWsdl.getBindings().values(); for (Binding binding : bindings) { List list = bindingsByNamespace.get(targetNS); if (list == null) { list = new ArrayList(); bindingsByNamespace.put(targetNS, list); } if (binding.isUndefined() == false) list.add(binding); } // Services Collection services = srcWsdl.getServices().values(); for (Service service : services) { List list = servicesByNamespace.get(targetNS); if (list == null) { list = new ArrayList(); servicesByNamespace.put(targetNS, list); } list.add(service); } // Imports Collection> importLists = srcWsdl.getImports().values(); for (List imports : importLists) { for (Import imp : imports) { Definition impWsdl = imp.getDefinition(); if (!importedDefinitions.contains(impWsdl)) { processTopLevelElements(impWsdl); } } } } private void cleanupTemporaryFiles() { for (File current : tempFiles) { current.delete(); } } // process all bindings not within service separetly private void processUnreachableBindings(Definition srcWsdl) throws WSDLException { log.trace("processUnreachableBindings"); Iterator it = getAllDefinedBindings(srcWsdl).values().iterator(); while (it.hasNext()) { Binding srcBinding = (Binding)it.next(); QName srcQName = srcBinding.getQName(); WSDLBinding destBinding = destWsdl.getBinding(srcQName); if (destBinding == null) { processBinding(srcWsdl, srcBinding); } } } private void processNamespaces(Definition srcWsdl) { String targetNS = srcWsdl.getTargetNamespace(); destWsdl.setTargetNamespace(targetNS); // Copy wsdl namespaces Map nsMap = srcWsdl.getNamespaces(); Iterator iter = nsMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); String prefix = (String)entry.getKey(); String nsURI = (String)entry.getValue(); destWsdl.registerNamespaceURI(nsURI, prefix); } } private void processUnknownExtensibilityElements(ElementExtensible src, Extendable dest) throws WSDLException { List extElements = src.getExtensibilityElements(); for (int i = 0; i < extElements.size(); i++) { ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i); processPolicyElements(extElement, dest); //add processing of further extensibility element types below } } private void processPolicyElements(ExtensibilityElement extElement, Extendable dest) { if (extElement instanceof UnknownExtensibilityElement) { Element srcElement = ((UnknownExtensibilityElement)extElement).getElement(); if (Constants.URI_WS_POLICY.equals(srcElement.getNamespaceURI())) { //copy missing namespaces from the source element to our element Element element = (Element)srcElement.cloneNode(true); copyMissingNamespaceDeclarations(element, srcElement); if (element.getLocalName().equals("Policy")) { dest.addExtensibilityElement(new WSDLExtensibilityElement(Constants.WSDL_ELEMENT_POLICY, element)); } else if (element.getLocalName().equals("PolicyReference")) { dest.addExtensibilityElement(new WSDLExtensibilityElement(Constants.WSDL_ELEMENT_POLICYREFERENCE, element)); } } } } private void processTypes(Definition srcWsdl, URL wsdlLoc) throws IOException, WSDLException { log.trace("BEGIN processTypes: " + wsdlLoc); WSDLTypes destTypes = destWsdl.getWsdlTypes(); Types srcTypes = srcWsdl.getTypes(); if (srcTypes != null && srcTypes.getExtensibilityElements().size() > 0) { List extElements = srcTypes.getExtensibilityElements(); int len = extElements.size(); for (int i = 0; i < len; i++) { ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i); Element domElement; if (extElement instanceof Schema) { domElement = ((Schema)extElement).getElement(); } else if (extElement instanceof UnknownExtensibilityElement) { domElement = ((UnknownExtensibilityElement)extElement).getElement(); } else { throw new WSDLException(WSDLException.OTHER_ERROR, "Unsupported extensibility element: " + extElement); } Element domElementClone = (Element)domElement.cloneNode(true); copyParentNamespaceDeclarations(domElementClone, domElement); String localname = domElementClone.getLocalName(); try { if ("import".equals(localname)) { processSchemaImport(destTypes, wsdlLoc, domElementClone); } else if ("schema".equals(localname)) { processSchemaInclude(destTypes, wsdlLoc, domElementClone); } else { throw new IllegalArgumentException("Unsuported schema element: " + localname); } } catch (IOException e) { throw new WSDLException(WSDLException.OTHER_ERROR, "Cannot extract schema definition", e); } } if (len > 0) { JavaToXSD jxsd = new JavaToXSD(); JBossXSModel xsmodel = jxsd.parseSchema(schemaLocationsMap); WSDLUtils.addSchemaModel(destTypes, destWsdl.getTargetNamespace(), xsmodel); } } else { log.trace("Empty wsdl types element, processing imports"); Iterator it = srcWsdl.getImports().values().iterator(); while (it.hasNext()) { List srcImports = (List)it.next(); for (Import srcImport : srcImports) { Definition impDefinition = srcImport.getDefinition(); String impLoc = impDefinition.getDocumentBaseURI(); processTypes(impDefinition, new URL(impLoc)); } } } log.trace("END processTypes: " + wsdlLoc + "\n" + destTypes); } private void copyParentNamespaceDeclarations(Element destElement, Element srcElement) { Node parent = srcElement.getParentNode(); while (parent != null) { if (parent.hasAttributes()) { NamedNodeMap attributes = parent.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Attr attr = (Attr)attributes.item(i); String name = attr.getName(); String value = attr.getValue(); if (name.startsWith("xmlns:") && destElement.hasAttribute(name) == false) destElement.setAttribute(name, value); } } parent = parent.getParentNode(); } } private void copyMissingNamespaceDeclarations(Element destElement, Element srcElement) { String prefix = destElement.getPrefix(); String nsUri; try { nsUri = DOMUtils.getElementQName(destElement).getNamespaceURI(); } catch (IllegalArgumentException e) { nsUri = null; } if (prefix != null && nsUri == null) { destElement.setAttributeNS(Constants.NS_XMLNS, "xmlns:" + prefix, srcElement.lookupNamespaceURI(prefix)); } NamedNodeMap attributes = destElement.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Attr attr = (Attr)attributes.item(i); String attrPrefix = attr.getPrefix(); if (attrPrefix != null && !attr.getName().startsWith("xmlns") && destElement.lookupNamespaceURI(attrPrefix) == null) { destElement.setAttributeNS(Constants.NS_XMLNS, "xmlns:" + attrPrefix, srcElement.lookupNamespaceURI(attrPrefix)); } } NodeList childrenList = destElement.getChildNodes(); for (int i = 0; i < childrenList.getLength(); i++) { Node node = childrenList.item(i); if (node instanceof Element) copyMissingNamespaceDeclarations((Element)node, srcElement); } } private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl) throws IOException, WSDLException { if (wsdlLoc == null) throw new IllegalArgumentException("Cannot process import, parent location not set"); log.trace("processSchemaImport: " + wsdlLoc); String location = getOptionalAttribute(importEl, "schemaLocation"); if (location == null) throw new IllegalArgumentException("schemaLocation is null for xsd:import"); URL locationURL = getLocationURL(wsdlLoc, location); Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream()); URL newloc = processSchemaInclude(types, locationURL, rootElement); if (newloc != null) importEl.setAttribute("schemaLocation", newloc.toExternalForm()); } private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl) throws IOException, WSDLException { if (wsdlLoc == null) throw new IllegalArgumentException("Cannot process iclude, parent location not set"); File tmpFile = null; if (wsdlLoc == null) throw new IllegalArgumentException("Cannot process include, parent location not set"); log.trace("processSchemaInclude: " + wsdlLoc); String schemaPrefix = schemaEl.getPrefix(); String importTag = (schemaPrefix == null) ? "import" : schemaPrefix + ":import"; Element importElement = schemaEl.getOwnerDocument().createElementNS(Constants.NS_SCHEMA_XSD, importTag); importElement.setAttribute("namespace", Constants.URI_SOAP11_ENC); schemaEl.insertBefore(importElement, DOMUtils.getFirstChildElement(schemaEl)); // Handle schema includes Iterator it = DOMUtils.getChildElements(schemaEl, new QName(Constants.NS_SCHEMA_XSD, "include")); while (it.hasNext()) { Element includeEl = (Element)it.next(); String location = getOptionalAttribute(includeEl, "schemaLocation"); if (location == null) throw new IllegalArgumentException("schemaLocation is null for xsd:include"); URL locationURL = getLocationURL(wsdlLoc, location); Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream()); URL newloc = processSchemaInclude(types, locationURL, rootElement); if (newloc != null) includeEl.setAttribute("schemaLocation", newloc.toExternalForm()); } String targetNS = getOptionalAttribute(schemaEl, "targetNamespace"); if (targetNS != null) { log.trace("processSchemaInclude: [targetNS=" + targetNS + ",parentURL=" + wsdlLoc + "]"); tmpFile = SchemaUtils.getSchemaTempFile(targetNS); tempFiles.add(tmpFile); FileWriter fwrite = new FileWriter(tmpFile); new DOMWriter(fwrite).setPrettyprint(true).print(schemaEl); fwrite.close(); schemaLocationsMap.put(targetNS, tmpFile.toURL()); } // schema elements that have no target namespace are skipped // // // // // if (targetNS == null) { log.trace("Schema element without target namespace in: " + wsdlLoc); } handleSchemaImports(schemaEl, wsdlLoc); return tmpFile != null ? tmpFile.toURL() : null; } private void handleSchemaImports(Element schemaEl, URL parentURL) throws WSDLException, IOException { if (parentURL == null) throw new IllegalArgumentException("Cannot process import, parent location not set"); Iterator it = DOMUtils.getChildElements(schemaEl, new QName(Constants.NS_SCHEMA_XSD, "import")); while (it.hasNext()) { Element includeEl = (Element)it.next(); String schemaLocation = getOptionalAttribute(includeEl, "schemaLocation"); String namespace = getOptionalAttribute(includeEl, "namespace"); log.trace("handleSchemaImport: [namespace=" + namespace + ",schemaLocation=" + schemaLocation + "]"); // Skip, let the entity resolver resolve these if (namespace != null && schemaLocation != null) { URL currLoc = getLocationURL(parentURL, schemaLocation); if (schemaLocationsMap.get(namespace) == null) { schemaLocationsMap.put(namespace, currLoc); // Recursively handle schema imports Element importedSchema = DOMUtils.parse(currLoc.openStream()); handleSchemaImports(importedSchema, currLoc); } } else { log.trace("Skip schema import: [namespace=" + namespace + ",schemaLocation=" + schemaLocation + "]"); } } } private URL getLocationURL(URL parentURL, String location) throws MalformedURLException, WSDLException { log.trace("getLocationURL: [location=" + location + ",parent=" + parentURL + "]"); URL locationURL = null; try { locationURL = new URL(location); } catch (MalformedURLException e) { // ignore malformed URL } if (locationURL == null) { if (location.startsWith("/")) location = location.substring(1); String path = parentURL.toExternalForm(); path = path.substring(0, path.lastIndexOf("/")); while (location.startsWith("../")) { path = path.substring(0, path.lastIndexOf("/")); location = location.substring(3); } locationURL = new URL(path + "/" + location); } log.trace("Modified schemaLocation: " + locationURL); return locationURL; } private void processPortType(Definition srcWsdl, PortType srcPortType, WSDLBinding destBinding) throws WSDLException { log.trace("processPortType: " + srcPortType.getQName()); QName qname = srcPortType.getQName(); if (destWsdl.getInterface(qname) == null) { WSDLInterface destInterface = new WSDLInterface(destWsdl, qname); //policy extensions QName policyURIsProp = (QName)srcPortType.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSP_POLICYURIS); if (policyURIsProp != null && !"".equalsIgnoreCase(policyURIsProp.getLocalPart())) { destInterface.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_POLICYURIS, policyURIsProp.getLocalPart())); } // eventing extensions QName eventSourceProp = (QName)srcPortType.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSE_EVENTSOURCE); if (eventSourceProp != null && eventSourceProp.getLocalPart().equals(Boolean.TRUE.toString())) { destInterface.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_EVENTSOURCE, eventSourceProp.getLocalPart())); } // documentation Element documentationElement = srcPortType.getDocumentationElement(); if (documentationElement != null && documentationElement.getTextContent() != null) { destInterface.setDocumentationElement(new WSDLDocumentation(documentationElement.getTextContent())); } destWsdl.addInterface(destInterface); processPortTypeOperations(srcWsdl, destInterface, srcPortType, destBinding); } } private void processPortTypeOperations(Definition srcWsdl, WSDLInterface destInterface, PortType srcPortType, WSDLBinding destBinding) throws WSDLException { Iterator itOperations = srcPortType.getOperations().iterator(); while (itOperations.hasNext()) { Operation srcOperation = (Operation)itOperations.next(); WSDLInterfaceOperation destOperation = new WSDLInterfaceOperation(destInterface, srcOperation.getName()); processUnknownExtensibilityElements(srcOperation, destOperation); destOperation.setStyle(getOperationStyle(srcWsdl, srcPortType, srcOperation)); if (srcOperation.getStyle() != null && false == OperationType.NOTIFICATION.equals(srcOperation.getStyle())) { processPortTypeOperationInput(srcWsdl, srcOperation, destOperation, srcPortType, destBinding); } processPortTypeOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType, destBinding); processPortTypeOperationFaults(srcOperation, destOperation, destInterface, destBinding); // documentation Element documentationElement = srcOperation.getDocumentationElement(); if (documentationElement != null && documentationElement.getTextContent() != null) { destOperation.setDocumentationElement(new WSDLDocumentation(documentationElement.getTextContent())); } destInterface.addOperation(destOperation); } } private void processPortTypeOperationInput(Definition srcWsdl, Operation srcOperation, WSDLInterfaceOperation destOperation, PortType srcPortType, WSDLBinding destBinding) throws WSDLException { Input srcInput = srcOperation.getInput(); if (srcInput != null) { Message srcMessage = srcInput.getMessage(); if (srcMessage == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find input message on operation " + srcOperation.getName() + " on port type: " + srcPortType.getQName()); log.trace("processOperationInput: " + srcMessage.getQName()); QName wsaAction = (QName)srcInput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION); if (wsaAction != null) destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_IN, wsaAction.getLocalPart())); List paramOrder = (List)srcOperation.getParameterOrdering(); if (paramOrder != null) { for (String name : paramOrder) { if (srcMessage.getPart(name) != null) destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name)); } } WSDLInterfaceOperationInput rpcInput = new WSDLInterfaceOperationInput(destOperation); for (Part srcPart : (List)srcMessage.getOrderedParts(paramOrder)) { // Skip SWA attachment parts if (ignorePart(srcPortType, srcPart)) continue; if (Constants.URI_STYLE_DOCUMENT == destOperation.getStyle()) { WSDLInterfaceOperationInput destInput = new WSDLInterfaceOperationInput(destOperation); QName elementName = messagePartToElementName(srcMessage, srcPart, destOperation, destBinding); destInput.setElement(elementName); //Lets remember the Message name destInput.setMessageName(srcMessage.getQName()); destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN, srcMessage.getQName().getLocalPart())); destInput.setPartName(srcPart.getName()); processUnknownExtensibilityElements(srcMessage, destInput); destOperation.addInput(destInput); } else { // If we don't have a type then we aren't a valid RPC parameter // This could happen on a header element, in which case the // binding will pick it up QName xmlType = srcPart.getTypeName(); if (xmlType != null) { rpcInput.addChildPart(new WSDLRPCPart(srcPart.getName(), destWsdl.registerQName(xmlType))); } else { messagePartToElementName(srcMessage, srcPart, destOperation, destBinding); } } } if (Constants.URI_STYLE_RPC == destOperation.getStyle()) { // This is really a place holder, but also the actual value used in // WSDL 2.0 RPC bindings rpcInput.setElement(destOperation.getName()); rpcInput.setMessageName(srcMessage.getQName()); processUnknownExtensibilityElements(srcMessage, rpcInput); destOperation.addInput(rpcInput); } } } private boolean ignorePart(PortType srcPortType, Part srcPart) { boolean canBeSkipped = false; QName parentName = srcPortType.getQName(); if (skippedSWAParts.containsKey(parentName)) { if (skippedSWAParts.get(parentName).contains(srcPart.getName())) { log.trace("Skip attachment part: " + parentName + "->" + srcPart.getName()); canBeSkipped = true; } } return canBeSkipped; } private void processPortTypeOperationOutput(Definition srcWsdl, Operation srcOperation, WSDLInterfaceOperation destOperation, PortType srcPortType, WSDLBinding destBinding) throws WSDLException { Output srcOutput = srcOperation.getOutput(); if (srcOutput == null) { destOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY); return; } Message srcMessage = srcOutput.getMessage(); if (srcMessage == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find output message on operation " + srcOperation.getName() + " on port type: " + srcPortType.getQName()); log.trace("processOperationOutput: " + srcMessage.getQName()); destOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT); QName wsaAction = (QName)srcOutput.getExtensionAttribute(Constants.WSDL_ATTRIBUTE_WSA_ACTION); if (wsaAction != null) destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_ACTION_OUT, wsaAction.getLocalPart())); List paramOrder = (List)srcOperation.getParameterOrdering(); if (paramOrder != null) { for (String name : paramOrder) { if (srcMessage.getPart(name) != null) { WSDLRPCSignatureItem item = destOperation.getRpcSignatureitem(name); if (item != null) item.setDirection(Direction.INOUT); else destOperation.addRpcSignatureItem(new WSDLRPCSignatureItem(name, Direction.OUT)); } } } WSDLInterfaceOperationOutput rpcOutput = new WSDLInterfaceOperationOutput(destOperation); for (Part srcPart : (List)srcMessage.getOrderedParts(null)) { // Skip SWA attachment parts if (ignorePart(srcPortType, srcPart)) continue; if (Constants.URI_STYLE_DOCUMENT == destOperation.getStyle()) { WSDLInterfaceOperationOutput destOutput = new WSDLInterfaceOperationOutput(destOperation); QName elementName = messagePartToElementName(srcMessage, srcPart, destOperation, destBinding); destOutput.setElement(elementName); // Lets remember the Message name destOutput.setMessageName(srcMessage.getQName()); destOperation.addProperty(new WSDLProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT, srcMessage.getQName().getLocalPart())); // Remember the original part name destOutput.setPartName(srcPart.getName()); destOperation.addOutput(destOutput); } else { // If we don't have a type then we aren't a valid RPC parameter // This could happen on a header element, in which case the // binding will pick it up QName xmlType = srcPart.getTypeName(); if (xmlType != null) rpcOutput.addChildPart(new WSDLRPCPart(srcPart.getName(), destWsdl.registerQName(xmlType))); else messagePartToElementName(srcMessage, srcPart, destOperation, destBinding); } } if (Constants.URI_STYLE_RPC == destOperation.getStyle()) { // This is really a place holder, but also the actual value used in // WSDL 2.0 RPC bindings QName name = destOperation.getName(); rpcOutput.setElement(new QName(name.getNamespaceURI(), name.getLocalPart() + "Response")); rpcOutput.setMessageName(srcMessage.getQName()); destOperation.addOutput(rpcOutput); } } private void processPortTypeOperationFaults(Operation srcOperation, WSDLInterfaceOperation destOperation, WSDLInterface destInterface, WSDLBinding destBinding) throws WSDLException { Map faults = srcOperation.getFaults(); Iterator itFaults = faults.values().iterator(); while (itFaults.hasNext()) { Fault srcFault = (Fault)itFaults.next(); processOperationFault(destOperation, destInterface, srcFault); } } private void processOperationFault(WSDLInterfaceOperation destOperation, WSDLInterface destInterface, Fault srcFault) throws WSDLException { String faultName = srcFault.getName(); log.trace("processOperationFault: " + faultName); WSDLInterfaceFault destFault = new WSDLInterfaceFault(destInterface, faultName); Message message = srcFault.getMessage(); QName messageName = message.getQName(); Map partsMap = message.getParts(); if (partsMap.size() != 1) throw new WSDLException(WSDLException.INVALID_WSDL, "Unsupported number of fault parts in message " + messageName); Part part = (Part)partsMap.values().iterator().next(); QName xmlName = part.getElementName(); if (xmlName != null) { destFault.setElement(xmlName); } else { destFault.setElement(messageName); log.warn("Unsupported fault message part in message: " + messageName); } // Add the fault to the interface destInterface.addFault(destFault); // Add the fault refererence to the operation WSDLInterfaceOperationOutfault opOutFault = new WSDLInterfaceOperationOutfault(destOperation); opOutFault.setRef(destFault.getName()); destOperation.addOutfault(opOutFault); } /** Translate the message part name into an XML element name. */ private QName messagePartToElementName(Message srcMessage, Part srcPart, WSDLInterfaceOperation destOperation, WSDLBinding destBinding) throws WSDLException { QName xmlName = null; // R2306 A wsdl:message in a DESCRIPTION MUST NOT specify both type and element attributes on the same wsdl:part if (srcPart.getTypeName() != null && srcPart.getElementName() != null) throw new WSDLException(WSDLException.INVALID_WSDL, "Message parts must not define an element name and type name: " + srcMessage.getQName()); String bindingType = destBinding.getType(); if (Constants.NS_HTTP.equals(bindingType)) { xmlName = new QName(srcPart.getName()); } String style = destOperation.getStyle(); if (xmlName == null && Constants.URI_STYLE_RPC.equals(style)) { // R2203 An rpc-literal binding in a DESCRIPTION MUST refer, in its soapbind:body element(s), // only to wsdl:part element(s) that have been defined using the type attribute. if (srcPart.getName() == null) throw new WSDLException(WSDLException.INVALID_WSDL, "RPC style message parts must define a typy name: " + srcMessage.getQName()); // // Headers do have an element name even in rpc xmlName = srcPart.getElementName(); // if (xmlName == null) xmlName = new QName(srcPart.getName()); } if (xmlName == null && Constants.URI_STYLE_DOCUMENT.equals(style)) { // R2204 A document-literal binding in a DESCRIPTION MUST refer, in each of its soapbind:body element(s), // only to wsdl:part element(s) that have been defined using the element attribute // [hb] do this only for non swa porttypes if (srcPart.getElementName() == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Document style message parts must define an element name: " + srcMessage.getQName()); // xmlName = srcPart.getElementName(); } if (xmlName == null) throw new IllegalStateException("Cannot name for wsdl part: " + srcPart); xmlName = destWsdl.registerQName(xmlName); String key = srcMessage.getQName() + "->" + srcPart.getName(); messagePartToElementMap.put(key, xmlName); return xmlName; } private BindingOperation getBindingOperation(Definition srcWsdl, PortType srcPortType, Operation srcOperation) throws WSDLException { Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName()); if (srcBinding == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find binding for: " + srcPortType.getQName()); String srcOperationName = srcOperation.getName(); BindingOperation srcBindingOperation = srcBinding.getBindingOperation(srcOperationName, null, null); if (srcBindingOperation == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find binding operation for: " + srcOperationName); return srcBindingOperation; } private String getOperationStyle(Definition srcWsdl, PortType srcPortType, Operation srcOperation) throws WSDLException { Binding srcBinding = getPortTypeBindings(srcWsdl).get(srcPortType.getQName()); BindingOperation srcBindingOperation = getBindingOperation(srcWsdl, srcPortType, srcOperation); String operationStyle = null; List extList = srcBindingOperation.getExtensibilityElements(); for (ExtensibilityElement extElement : extList) { QName elementType = extElement.getElementType(); if (extElement instanceof SOAPOperation) { SOAPOperation soapOp = (SOAPOperation)extElement; operationStyle = soapOp.getStyle(); } else if (extElement instanceof SOAP12Operation) { SOAP12Operation soapOp = (SOAP12Operation)extElement; operationStyle = soapOp.getStyle(); } } if (operationStyle == null) { for (ExtensibilityElement extElement : (List)srcBinding.getExtensibilityElements()) { QName elementType = extElement.getElementType(); if (extElement instanceof SOAPBinding) { SOAPBinding soapBinding = (SOAPBinding)extElement; operationStyle = soapBinding.getStyle(); } else if (extElement instanceof SOAP12Binding) { SOAP12Binding soapBinding = (SOAP12Binding)extElement; operationStyle = soapBinding.getStyle(); } } } return ("rpc".equals(operationStyle)) ? Constants.URI_STYLE_RPC : Constants.URI_STYLE_DOCUMENT; } private WSDLBinding processBinding(Definition srcWsdl, Binding srcBinding) throws WSDLException { QName srcBindingQName = srcBinding.getQName(); log.trace("processBinding: " + srcBindingQName); WSDLBinding destBinding = destWsdl.getBinding(srcBindingQName); if (destBinding == null) { PortType srcPortType = getDefinedPortType(srcBinding); String bindingType = null; List extList = srcBinding.getExtensibilityElements(); for (ExtensibilityElement extElement : extList) { QName elementType = extElement.getElementType(); if (extElement instanceof SOAPBinding) { bindingType = Constants.NS_SOAP11; } else if (extElement instanceof SOAP12Binding) { bindingType = Constants.NS_SOAP12; } else if (extElement instanceof HTTPBinding) { bindingType = Constants.NS_HTTP; } else if ("binding".equals(elementType.getLocalPart())) { log.warn("Unsupported binding: " + elementType); bindingType = elementType.getNamespaceURI(); } } if (bindingType == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot obtain binding type for: " + srcBindingQName); if (Constants.NS_SOAP11.equals(bindingType) || Constants.NS_SOAP12.equals(bindingType) || Constants.NS_HTTP.equals(bindingType)) { destBinding = new WSDLBinding(destWsdl, srcBindingQName); destBinding.setInterfaceName(srcPortType.getQName()); destBinding.setType(bindingType); processUnknownExtensibilityElements(srcBinding, destBinding); destWsdl.addBinding(destBinding); preProcessSWAParts(srcBinding, srcWsdl); processPortType(srcWsdl, srcPortType, destBinding); String bindingStyle = Style.getDefaultStyle().toString(); for (ExtensibilityElement extElement : extList) { if (extElement instanceof SOAPBinding) { SOAPBinding soapBinding = (SOAPBinding)extElement; bindingStyle = soapBinding.getStyle(); } else if (extElement instanceof SOAP12Binding) { SOAP12Binding soapBinding = (SOAP12Binding)extElement; bindingStyle = soapBinding.getStyle(); } } processBindingOperations(srcWsdl, destBinding, srcBinding, bindingStyle); } } return destBinding; } /** The port might reference a binding which is defined in another wsdl */ private Binding getDefinedBinding(Port srcPort) throws WSDLException { Binding srcBinding = srcPort.getBinding(); if (srcBinding == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find binding for port: " + srcPort.getName()); QName srcBindingName = srcBinding.getQName(); if (srcBinding.isUndefined()) { String nsURI = srcBindingName.getNamespaceURI(); List bindings = bindingsByNamespace.get(nsURI); if (bindings == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find bindings for namespace: " + nsURI); for (Binding auxBinding : bindings) { if (srcBindingName.equals(auxBinding.getQName())) { srcBinding = auxBinding; break; } } } return srcBinding; } /** The binding might reference a port type which is defined in another wsdl */ private PortType getDefinedPortType(Binding srcBinding) throws WSDLException { QName srcBindingQName = srcBinding.getQName(); PortType srcPortType = srcBinding.getPortType(); if (srcPortType == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find port type for binding: " + srcBindingQName); QName srcPortTypeName = srcPortType.getQName(); if (srcPortType.isUndefined()) { String nsURI = srcPortTypeName.getNamespaceURI(); List portTypes = portTypesByNamespace.get(nsURI); if (portTypes == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find port types for namespace: " + nsURI); for (PortType auxPortType : portTypes) { if (srcPortTypeName.equals(auxPortType.getQName())) { srcPortType = auxPortType; break; } } } return srcPortType; } /** * Identify and mark message parts that belong to * an SWA binding and can be skipped when processing this WSDL */ private void preProcessSWAParts(Binding srcBinding, Definition srcWsdl) throws WSDLException { Iterator opIt = srcBinding.getBindingOperations().iterator(); while (opIt.hasNext()) { BindingOperation bindingOperation = (BindingOperation)opIt.next(); // Input if (bindingOperation.getBindingInput() != null) markSWAParts(bindingOperation.getBindingInput().getExtensibilityElements(), srcBinding, srcWsdl); // Output if (bindingOperation.getBindingOutput() != null) markSWAParts(bindingOperation.getBindingOutput().getExtensibilityElements(), srcBinding, srcWsdl); } } private void markSWAParts(List extensions, Binding srcBinding, Definition srcWsdl) throws WSDLException { Iterator extIt = extensions.iterator(); while (extIt.hasNext()) { Object o = extIt.next(); if (o instanceof MIMEMultipartRelated) { QName portTypeName = getDefinedPortType(srcBinding).getQName(); if (log.isTraceEnabled()) log.trace("SWA found on portType" + portTypeName); MIMEMultipartRelated mrel = (MIMEMultipartRelated)o; Iterator mimePartIt = mrel.getMIMEParts().iterator(); while (mimePartIt.hasNext()) { MIMEPart mimePartDesc = (MIMEPart)mimePartIt.next(); List mimePartExt = mimePartDesc.getExtensibilityElements(); if (!mimePartExt.isEmpty() && (mimePartExt.get(0) instanceof MIMEContent)) { MIMEContent mimeContent = (MIMEContent)mimePartExt.get(0); if (skippedSWAParts.get(portTypeName) == null) skippedSWAParts.put(portTypeName, new ArrayList()); skippedSWAParts.get(portTypeName).add(mimeContent.getPart()); } } break; } } } private Map getPortTypeBindings(Definition srcWsdl) throws WSDLException { getAllDefinedBindings(srcWsdl); return portTypeBindings; } private Map getAllDefinedBindings(Definition srcWsdl) throws WSDLException { if (allBindings != null) return allBindings; allBindings = new LinkedHashMap(); portTypeBindings = new LinkedHashMap(); Map srcBindings = srcWsdl.getBindings(); Iterator itBinding = srcBindings.values().iterator(); while (itBinding.hasNext()) { Binding srcBinding = (Binding)itBinding.next(); allBindings.put(srcBinding.getQName(), srcBinding); portTypeBindings.put(getDefinedPortType(srcBinding).getQName(), srcBinding); } // Bindings not available when pulled in through // http://sourceforge.net/tracker/index.php?func=detail&aid=1240323&group_id=128811&atid=712792 Iterator itService = srcWsdl.getServices().values().iterator(); while (itService.hasNext()) { Service srcService = (Service)itService.next(); Iterator itPort = srcService.getPorts().values().iterator(); while (itPort.hasNext()) { Port srcPort = (Port)itPort.next(); Binding srcBinding = srcPort.getBinding(); allBindings.put(srcBinding.getQName(), srcBinding); portTypeBindings.put(getDefinedPortType(srcBinding).getQName(), srcBinding); } } return allBindings; } private void processBindingOperations(Definition srcWsdl, WSDLBinding destBinding, Binding srcBinding, String bindingStyle) throws WSDLException { Iterator it = srcBinding.getBindingOperations().iterator(); while (it.hasNext()) { BindingOperation srcBindingOperation = (BindingOperation)it.next(); processBindingOperation(srcWsdl, destBinding, bindingStyle, srcBindingOperation); } } private void processBindingOperation(Definition srcWsdl, WSDLBinding destBinding, String bindingStyle, BindingOperation srcBindingOperation) throws WSDLException { String srcOperationName = srcBindingOperation.getName(); log.trace("processBindingOperation: " + srcOperationName); WSDLInterface destInterface = destBinding.getInterface(); String namespaceURI = destInterface.getName().getNamespaceURI(); WSDLBindingOperation destBindingOperation = new WSDLBindingOperation(destBinding); QName refQName = new QName(namespaceURI, srcOperationName); destBindingOperation.setRef(refQName); processUnknownExtensibilityElements(srcBindingOperation, destBindingOperation); destBinding.addOperation(destBindingOperation); String opName = srcOperationName; WSDLInterfaceOperation destIntfOperation = destInterface.getOperation(opName); // Process soap:operation@soapAction, soap:operation@style List extList = srcBindingOperation.getExtensibilityElements(); for (ExtensibilityElement extElement : extList) { if (extElement instanceof SOAPOperation) { SOAPOperation soapOp = (SOAPOperation)extElement; destBindingOperation.setSOAPAction(soapOp.getSoapActionURI()); } else if (extElement instanceof SOAP12Operation) { SOAP12Operation soapOp = (SOAP12Operation)extElement; destBindingOperation.setSOAPAction(soapOp.getSoapActionURI()); } } BindingInput srcBindingInput = srcBindingOperation.getBindingInput(); if (srcBindingInput != null) { processBindingInput(srcWsdl, destBindingOperation, destIntfOperation, srcBindingOperation, srcBindingInput); } BindingOutput srcBindingOutput = srcBindingOperation.getBindingOutput(); if (srcBindingOutput != null) { processBindingOutput(srcWsdl, destBindingOperation, destIntfOperation, srcBindingOperation, srcBindingOutput); } } interface ReferenceCallback { void removeReference(QName element); void removeRPCPart(String partName); QName getXmlType(String partName); } private void processBindingInput(Definition srcWsdl, WSDLBindingOperation destBindingOperation, final WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation, BindingInput srcBindingInput) throws WSDLException { log.trace("processBindingInput"); List extList = srcBindingInput.getExtensibilityElements(); WSDLBindingOperationInput input = new WSDLBindingOperationInput(destBindingOperation); processUnknownExtensibilityElements(srcBindingInput, input); destBindingOperation.addInput(input); ReferenceCallback cb = new ReferenceCallback() { public QName getXmlType(String partName) { return srcBindingOperation.getOperation().getInput().getMessage().getPart(partName).getTypeName(); } public void removeReference(QName element) { WSDLInterfaceOperationInput destIntfInput = destIntfOperation.getInput(element); if (destIntfInput != null) destIntfOperation.removeInput(element); } public void removeRPCPart(String partName) { WSDLInterfaceOperationInput operationInput = destIntfOperation.getInput(destIntfOperation.getName()); operationInput.removeChildPart(partName); } }; processBindingReference(srcWsdl, destBindingOperation, destIntfOperation, extList, input, srcBindingOperation, cb); } private void processBindingOutput(Definition srcWsdl, WSDLBindingOperation destBindingOperation, final WSDLInterfaceOperation destIntfOperation, final BindingOperation srcBindingOperation, BindingOutput srcBindingOutput) throws WSDLException { log.trace("processBindingInput"); List extList = srcBindingOutput.getExtensibilityElements(); WSDLBindingOperationOutput output = new WSDLBindingOperationOutput(destBindingOperation); destBindingOperation.addOutput(output); ReferenceCallback cb = new ReferenceCallback() { public QName getXmlType(String partName) { return srcBindingOperation.getOperation().getOutput().getMessage().getPart(partName).getTypeName(); } public void removeReference(QName element) { WSDLInterfaceOperationOutput destIntfOutput = destIntfOperation.getOutput(element); if (destIntfOutput != null) destIntfOperation.removeOutput(element); } public void removeRPCPart(String partName) { QName name = destIntfOperation.getName(); WSDLInterfaceOperationOutput operationOutput = destIntfOperation.getOutput(new QName(name.getNamespaceURI(), name.getLocalPart() + "Response")); operationOutput.removeChildPart(partName); } }; processBindingReference(srcWsdl, destBindingOperation, destIntfOperation, extList, output, srcBindingOperation, cb); } private void processBindingReference(Definition srcWsdl, WSDLBindingOperation destBindingOperation, WSDLInterfaceOperation destIntfOperation, List extList, WSDLBindingMessageReference reference, BindingOperation srcBindingOperation, ReferenceCallback callback) throws WSDLException { for (ExtensibilityElement extElement : extList) { if (extElement instanceof SOAPBody) { SOAPBody body = (SOAPBody)extElement; processEncodingStyle(body, destBindingOperation); // String namespaceURI = body.getNamespaceURI(); destBindingOperation.setNamespaceURI(namespaceURI); } else if (extElement instanceof SOAP12Body) { SOAP12Body body = (SOAP12Body)extElement; processEncodingStyle(body, destBindingOperation); String namespaceURI = body.getNamespaceURI(); destBindingOperation.setNamespaceURI(namespaceURI); } else if (extElement instanceof SOAPHeader) { SOAPHeader header = (SOAPHeader)extElement; QName headerMessageName = header.getMessage(); String headerPartName = header.getPart(); String key = headerMessageName + "->" + headerPartName; QName elementName = (QName)messagePartToElementMap.get(key); // The message may not have been reachable from a port type operation boolean isImplicitHeader = false; Message srcMessage = srcWsdl.getMessage(headerMessageName); if (elementName == null && srcMessage != null) { Iterator itParts = srcMessage.getParts().values().iterator(); while (itParts.hasNext()) { Part srcPart = (Part)itParts.next(); String partName = srcPart.getName(); if (partName.equals(headerPartName)) { isImplicitHeader = true; elementName = srcPart.getElementName(); } } } if (elementName == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Could not determine element name from header: " + key); WSDLSOAPHeader soapHeader = new WSDLSOAPHeader(elementName, headerPartName); soapHeader.setIncludeInSignature(!isImplicitHeader); reference.addSoapHeader(soapHeader); if (Constants.URI_STYLE_DOCUMENT == destIntfOperation.getStyle()) { callback.removeReference(elementName); } else { // Just in case callback.removeRPCPart(headerPartName); } } else if (extElement instanceof MIMEMultipartRelated) { MIMEMultipartRelated related = (MIMEMultipartRelated)extElement; Iterator i = related.getMIMEParts().iterator(); while (i.hasNext()) { MIMEPart part = (MIMEPart)i.next(); Iterator j = part.getExtensibilityElements().iterator(); String name = null; String types = null; while (j.hasNext()) { ExtensibilityElement inner = (ExtensibilityElement)j.next(); if (inner instanceof MIMEContent) { MIMEContent content = (MIMEContent)inner; name = content.getPart(); if (types == null) { types = content.getType(); } else { types += "," + content.getType(); } } } if (name != null) { QName xmlType = callback.getXmlType(name); reference.addMimePart(new WSDLMIMEPart(name, xmlType, types)); if (Constants.URI_STYLE_DOCUMENT == destIntfOperation.getStyle()) { // A mime part must be defined as callback.removeReference(new QName(name)); } else { callback.removeRPCPart(name); } } } } } } private void processEncodingStyle(ExtensibilityElement extElement, WSDLBindingOperation destBindingOperation) { log.trace("processEncodingStyle"); String encStyle = null; if (extElement instanceof SOAPBody) { SOAPBody body = (SOAPBody)extElement; List encStyleList = body.getEncodingStyles(); if (encStyleList != null) { if (encStyleList.size() > 1) log.warn("Multiple encoding styles not supported: " + encStyleList); if (encStyleList.size() > 0) { encStyle = (String)encStyleList.get(0); } } } else if (extElement instanceof SOAP12Body) { SOAP12Body body = (SOAP12Body)extElement; encStyle = body.getEncodingStyle(); } if (encStyle != null) { String setStyle = destBindingOperation.getEncodingStyle(); if (encStyle.equals(setStyle) == false) log.warn("Encoding style '" + encStyle + "' not supported for: " + destBindingOperation.getRef()); destBindingOperation.setEncodingStyle(encStyle); } } private void processServices(Definition srcWsdl) throws WSDLException { log.trace("BEGIN processServices: " + srcWsdl.getDocumentBaseURI()); // Each definition needs a clear binding cache allBindings = null; if (srcWsdl.getServices().size() > 0) { Iterator it = srcWsdl.getServices().values().iterator(); while (it.hasNext()) { Service srcService = (Service)it.next(); QName qname = srcService.getQName(); WSDLService destService = new WSDLService(destWsdl, qname); processUnknownExtensibilityElements(srcService, destService); destWsdl.addService(destService); processPorts(srcWsdl, destService, srcService); } } else { log.trace("Empty wsdl services, processing imports"); Iterator it = srcWsdl.getImports().values().iterator(); while (it.hasNext()) { List srcImports = (List)it.next(); for (Import srcImport : srcImports) { Definition importDefinition = srcImport.getDefinition(); processServices(importDefinition); } } // The binding cache must be clear after imports, so that undefined bindings can be located allBindings = null; } log.trace("END processServices: " + srcWsdl.getDocumentBaseURI()); } private void processPorts(Definition srcWsdl, WSDLService destService, Service srcService) throws WSDLException { Iterator it = srcService.getPorts().values().iterator(); while (it.hasNext()) { Port srcPort = (Port)it.next(); processPort(srcWsdl, destService, srcPort); } } private void processPort(Definition srcWsdl, WSDLService destService, Port srcPort) throws WSDLException { log.trace("processPort: " + srcPort.getName()); Binding srcBinding = getDefinedBinding(srcPort); QName endpointName = new QName(srcWsdl.getTargetNamespace(), srcPort.getName()); WSDLEndpoint destEndpoint = new WSDLEndpoint(destService, endpointName); destEndpoint.setBinding(srcBinding.getQName()); destEndpoint.setAddress(getSOAPAddress(srcPort)); processUnknownExtensibilityElements(srcPort, destEndpoint); WSDLBinding destBinding = processBinding(srcWsdl, srcBinding); if (destBinding != null) destService.addEndpoint(destEndpoint); } /** Get the endpoint address from the ports extensible element */ private String getSOAPAddress(Port srcPort) throws WSDLException { String soapAddress = "dummy"; Iterator it = srcPort.getExtensibilityElements().iterator(); while (it.hasNext()) { ExtensibilityElement extElement = (ExtensibilityElement)it.next(); QName elementType = extElement.getElementType(); if (extElement instanceof SOAPAddress) { SOAPAddress addr = (SOAPAddress)extElement; soapAddress = addr.getLocationURI(); break; } else if (extElement instanceof SOAP12Address) { SOAP12Address addr = (SOAP12Address)extElement; soapAddress = addr.getLocationURI(); break; } else if ("address".equals(elementType.getLocalPart())) { log.warn("Unprocessed extension element: " + elementType); } } if (soapAddress == null) throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot obtain SOAP address"); return soapAddress; } private String getOptionalAttribute(Element domElement, String attrName) { String attrValue = domElement.getAttribute(attrName); return (attrValue.length() > 0 ? attrValue : null); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/0000755000175000017500000000000010755000263027115 5ustar godgod././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/ToolsUnifiedM0000644000175000017500000001132710654422410031565 0ustar godgod/* * 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.tools.metadata; // $Id: ToolsUnifiedMetaDataBuilder.java 4119 2007-08-02 18:40:08Z thomas.diesler@jboss.com $ import java.rmi.Remote; import java.util.List; import java.util.Map; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.Style; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.tools.Configuration.OperationConfig; import org.jboss.wsf.common.ResourceLoaderAdapter; /** * Builder class that builds the Tools Meta Data * @author Anil Saldhana * @since Oct 6, 2005 */ public class ToolsUnifiedMetaDataBuilder { private static Logger log = Logger.getLogger(ToolsUnifiedMetaDataBuilder.class); private Class seiClass; private UnifiedMetaData um; private String targetNamespace = null; private String typeNamespace = null; private String serviceName = null; private Map> operationMap = null; private Style style; private ParameterStyle parameterStyle; public ToolsUnifiedMetaDataBuilder(Class epClass, String targetNamespace, String typeNamespace, String serviceName, Style style, ParameterStyle parameterStyle, Map> operationMap) { this.seiClass = epClass; this.targetNamespace = targetNamespace; this.typeNamespace = typeNamespace != null ? typeNamespace : targetNamespace; this.serviceName = serviceName; this.style = style; this.parameterStyle = parameterStyle; this.operationMap = operationMap; buildMetaData(); } public UnifiedMetaData getUnifiedMetaData() { return um; } //PRIVATE METHODS private void buildMetaData() { //Check if it extends Remote Interface if (!Remote.class.isAssignableFrom(seiClass)) throw new WSException("A service endpoint interface should extend Remote"); ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); ResourceLoaderAdapter vfsRoot = new ResourceLoaderAdapter(); um = new UnifiedMetaData(vfsRoot); um.setClassLoader(contextClassLoader); String seiName = WSDLUtils.getInstance().getJustClassName(seiClass.getName()); if (serviceName == null) serviceName = seiName + "Service"; um.addService(getServiceMetaData(um, targetNamespace, serviceName, seiName, seiClass)); generateOperationMetaData(seiClass); } private void generateOperationMetaData(Class seiClass) { ServiceMetaData sm = um.getServices().get(0); ToolsEndpointMetaData em = (ToolsEndpointMetaData)sm.getEndpointByServiceEndpointInterface(seiClass.getName()); if (em == null) throw new WSException("EndpointMetadata is null"); ReflectiveMetaDataBuilder rmb = new ReflectiveMetaDataBuilder(em); rmb.setOperationMap(operationMap); em = rmb.generate(); } private ServiceMetaData getServiceMetaData(UnifiedMetaData um, String targetNamespace, String serviceName, String portTypeName, Class seiClass) { ServiceMetaData sm = new ServiceMetaData(um, new QName(targetNamespace,serviceName)); QName name = new QName(targetNamespace, portTypeName + "Port"); QName interfaceName = new QName(targetNamespace, portTypeName); ToolsEndpointMetaData tm = new ToolsEndpointMetaData(sm, name, interfaceName); tm.typeNamespace = typeNamespace; tm.setServiceEndpointInterfaceName(seiClass.getName()); tm.setStyle(style); tm.setParameterStyle(parameterStyle); sm.addEndpoint(tm); return sm; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/ReflectiveMet0000644000175000017500000003045210650145103031577 0ustar godgod/* * 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.tools.metadata; import java.lang.reflect.Method; import java.rmi.Remote; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.rpc.holders.Holder; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.ParameterWrapping; import org.jboss.ws.core.utils.HolderUtils; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.tools.ToolsUtils; import org.jboss.ws.tools.Configuration.OperationConfig; import org.jboss.wsf.common.JavaUtils; /** * Builds the Tools Endpoint Meta Data using Java Reflection * * @author Anil Saldhana * @since Oct 19, 2005 */ public class ReflectiveMetaDataBuilder { private Class seiClass = null; private ToolsEndpointMetaData tmd = null; private String targetNamespace = null; private Map> operationMap = null; private Map operationNameCount = new HashMap(); public ReflectiveMetaDataBuilder(ToolsEndpointMetaData tmd) { this.seiClass = tmd.getServiceEndpointInterface(); checkServiceEndpointInterface(); this.targetNamespace = tmd.getPortName().getNamespaceURI(); this.tmd = tmd; } public void setOperationMap(Map> operationMap) { this.operationMap = operationMap; } public ToolsEndpointMetaData generate() { generateOperationMetaData(seiClass.getMethods()); return tmd; } // PRIVATE METHODS private void checkServiceEndpointInterface() { if (seiClass == null) throw new IllegalArgumentException("Illegal Null Argument: seiClass"); if (seiClass.isInterface() == false) throw new IllegalArgumentException("Illegal seiClass : not an interface"); if (! Remote.class.isAssignableFrom(seiClass)) throw new WSException("A service endpoint interface MUST extend java.rmi.Remote: " + seiClass.getName()); } private FaultMetaData getFaultMetaData(Class exType, OperationMetaData om) { String exname = WSDLUtils.getInstance().getJustClassName(exType); QName xmlName = new QName(tmd.typeNamespace, exname); FaultMetaData fm = new FaultMetaData(om, xmlName, xmlName, exType.getName()); return fm; } private OperationConfig getOperationConfig(String name, Class[] types) { if (operationMap == null) return null; List configs = operationMap.get(name); if (configs == null) return null; for (OperationConfig config : configs) { if (config.params.size() == types.length) { int i; for (i = 0; i < types.length; i++) { String typeName = config.params.get(i).javaType; if (! JavaUtils.getSourceName(types[i]).equals(typeName)) break; } if (i == types.length) return config; } } return null; } private void generateOperationMetaData(Method[] marr) { if (marr == null) throw new WSException("Number of methods in the seiClass is zero"); for (Method m : marr) { String methodname = m.getName(); Class[] paramTypes = m.getParameterTypes(); int len = paramTypes.length; OperationMetaData om = getOperationMetaData(m); OperationConfig opc = getOperationConfig(methodname, m.getParameterTypes()); if (opc != null) om.setOneWay(opc.isOneWay); ParameterMetaData wrappedParameter = null; List wrappedParameters = null; if (om.isDocumentWrapped()) { QName xmlName = new QName(tmd.typeNamespace, om.getQName().getLocalPart()); QName xmlType = xmlName; wrappedParameter = new ParameterMetaData(om, xmlName, xmlType, null); wrappedParameters = new ArrayList(len); wrappedParameter.setWrappedParameters(wrappedParameters); om.addParameter(wrappedParameter); if (! om.isOneWay()) { xmlType = xmlName = new QName(tmd.typeNamespace, om.getResponseName().getLocalPart()); ParameterMetaData retMetaData = new ParameterMetaData(om, xmlName, xmlType, null); retMetaData.setWrappedParameters(new ArrayList(0)); om.setReturnParameter(retMetaData); } } for (int i = 0; i < len; i++) { Class paramType = paramTypes[i]; /** * Test if method param extends java.rmi.Remote */ if (Remote.class.isAssignableFrom(paramType)) throw new WSException("Param Type " + paramType.getName() + " should not extend java.rmi.Remote"); if (om.isDocumentWrapped() && !isHeaderParameter(opc, i)) { QName xmlName = getXmlName(paramType, opc, i, null); wrappedParameters.add(new WrappedParameter(xmlName, paramType.getName(), convertToProperty(xmlName.getLocalPart()), i)); } else { om.addParameter(getParameterMetaData(paramType, om, opc, i)); } } // Handle return type Class returnType = m.getReturnType(); if (void.class != returnType) { if (Remote.class.isAssignableFrom(returnType)) throw new WSException("Return Type " + returnType.getName() + " should not extend java.rmi.Remote"); if (om.isDocumentWrapped()) { QName name = getReturnXmlName(opc, null); WrappedParameter wrapped = new WrappedParameter(name, returnType.getName(), convertToProperty(name.getLocalPart()), -1); ParameterMetaData retMetaData = om.getReturnParameter(); retMetaData.getWrappedParameters().add(wrapped); } else { om.setReturnParameter(getParameterMetaDataForReturnType(returnType, om, opc)); } } if (om.isDocumentWrapped()) { ParameterWrapping.generateWrapper(wrappedParameter, false); if (! om.isOneWay()) ParameterWrapping.generateWrapper(om.getReturnParameter(), false); } Class[] exceptionTypes = m.getExceptionTypes(); boolean remoteExceptionFound = false; if (exceptionTypes != null) { for (int i = 0; i < exceptionTypes.length; i++) { if (RemoteException.class.isAssignableFrom(exceptionTypes[i])) remoteExceptionFound = true; else om.addFault(getFaultMetaData(exceptionTypes[i], om)); } } if (! remoteExceptionFound) throw new WSException(m.getName() + " does not throw RemoteException."); om.assertDocumentBare(); tmd.addOperation(om); } } private OperationMetaData getOperationMetaData(Method m) { String methodName = m.getName(); int count = 0; if (operationNameCount.containsKey(methodName)) count = operationNameCount.get(methodName); operationNameCount.put(methodName, ++count); String localName = (count > 1) ? methodName + count : methodName; OperationMetaData om = new OperationMetaData(tmd, new QName(targetNamespace, localName), methodName); om.setSOAPAction("");// FIXME:Default SOAP Action return om; } private boolean isHeaderParameter(OperationConfig config, int index) { if (config == null) return false; return config.params.get(index).header; } private ParameterMetaData getParameterMetaData(Class type, OperationMetaData om, OperationConfig config, int index) { QName xmlType = ToolsUtils.getXMLType(type, tmd.typeNamespace); QName xmlName = getXmlName(type, config, index, om.isDocumentBare() ? om.getQName().getLocalPart() : null); ParameterMetaData pm = new ParameterMetaData(om, xmlName, xmlType, type.getName()); pm.setInHeader(isHeaderParameter(config, index)); String mode = null; if (config != null) mode = config.params.get(index).mode; boolean holder = Holder.class.isAssignableFrom(type); if (holder) { pm.setJavaTypeName(HolderUtils.getValueType(type).getName()); if (mode != null) { if (mode.equals("OUT")) pm.setMode(ParameterMode.OUT); else if (mode.equals("INOUT")) pm.setMode(ParameterMode.INOUT); } else { pm.setMode(ParameterMode.INOUT); } } return pm; } private QName getXmlName(Class type, OperationConfig config, int index, String defaultName) { if (config != null) { QName name = config.params.get(index).xmlName; if (name != null) { if ("".equals(name.getNamespaceURI())) name = new QName(tmd.typeNamespace, name.getLocalPart()); return name; } } if (defaultName == null) defaultName = getDefaultName(type) + "_" + (index + 1); QName xmlName = new QName(tmd.typeNamespace, defaultName); return xmlName; } private QName getReturnXmlName(OperationConfig config, String defaultName) { if (config != null) { QName name = config.returnXmlName; if (name != null) { if ("".equals(name.getNamespaceURI())) name = new QName(tmd.typeNamespace, name.getLocalPart()); return name; } } if (defaultName == null) defaultName = Constants.DEFAULT_RPC_RETURN_NAME; return new QName(tmd.typeNamespace, defaultName); } private ParameterMetaData getParameterMetaDataForReturnType(Class type, OperationMetaData om, OperationConfig config) { QName xmlType = ToolsUtils.getXMLType(type, tmd.typeNamespace); QName xmlName = getReturnXmlName(config, om.isDocumentBare() ? om.getResponseName().getLocalPart() : null); ParameterMetaData pm = new ParameterMetaData(om, xmlName, xmlType, type.getName()); return pm; } private String getDefaultName(Class javaClass) { String name = ""; WSDLUtils utils = WSDLUtils.getInstance(); if (Holder.class.isAssignableFrom(javaClass)) javaClass = utils.getJavaTypeForHolder(javaClass); if (javaClass.isArray()) { name = utils.getMessagePartForArray(javaClass); } else name = utils.getJustClassName(javaClass); return name; } private String convertToProperty(String variable) { if (Character.isUpperCase(variable.charAt(0))) { char c = Character.toLowerCase(variable.charAt(0)); StringBuilder builder = new StringBuilder(variable); builder.setCharAt(0, c); variable = builder.toString(); } return variable; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/ToolsEndpoint0000644000175000017500000000407010652304753031651 0ustar godgod/* * 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.tools.metadata; // $Id: ToolsEndpointMetaData.java 4016 2007-07-27 06:00:11Z thomas.diesler@jboss.com $ import org.jboss.ws.metadata.config.ConfigurationProvider; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import javax.xml.namespace.QName; /** * Tools Endpoint Metadata * @author Anil Saldhana * @since Oct 6, 2005 */ public class ToolsEndpointMetaData extends EndpointMetaData { public String typeNamespace; private String endpointAddress; public ToolsEndpointMetaData(ServiceMetaData service, QName portName, QName portTypeName) { super(service, portName, portTypeName, Type.JAXRPC); super.configName = ConfigurationProvider.DEFAULT_CLIENT_CONFIG_NAME; super.configFile = ConfigurationProvider.DEFAULT_JAXRPC_CLIENT_CONFIG_FILE; } public String getEndpointAddress() { return endpointAddress; } public void setEndpointAddress(String endpointAddress) { this.endpointAddress = endpointAddress; } }././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/ToolsAnnotationMetaDataBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/metadata/ToolsAnnotati0000644000175000017500000002046710630511747031655 0ustar godgod/* * 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.tools.metadata; import java.lang.reflect.Array; import java.lang.reflect.Method; import java.rmi.Remote; import java.rmi.RemoteException; import javax.jws.Oneway; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.soap.SOAPBinding; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.rpc.holders.Holder; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.Style; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.tools.ToolsUtils; /** * Builds the ToolsEndpointMetaData using JSR-181 annotations * on the endpoint * @author Anil Saldhana * @since Oct 20, 2005 */ public class ToolsAnnotationMetaDataBuilder { private ToolsEndpointMetaData tmd = null; private String targetNamespace = null; private String typeNamespace = null; private Class endpoint = null; public ToolsAnnotationMetaDataBuilder(ToolsEndpointMetaData tmd, String targetNamespace, String typeNamespace2) { this.tmd = tmd; this.targetNamespace = targetNamespace; this.typeNamespace = typeNamespace; endpoint = tmd.getServiceEndpointInterface(); } public ToolsEndpointMetaData generate() { generateOperationMetaData(); return tmd; } //PRIVATE METHODS private void generateOperationMetaData() { // Generate the Operation Metadata Method[] marr = endpoint.getDeclaredMethods(); if( marr != null) { int len = Array.getLength(marr); for(int i = 0; i < len ; i++) { Method m = marr[i]; if (WSDLUtils.getInstance().checkIgnoreMethod(m)) continue; tmd.addOperation(getOperationMetaData(m,tmd)); } } } private OperationMetaData getOperationMetaData(Method m, ToolsEndpointMetaData em) { String opname = null; String soapAction = null; //Check if there are annotations WebMethod an = m.getAnnotation(WebMethod.class); if(an != null) { opname = an.operationName(); soapAction = an.action(); } if(opname == null || opname.length() == 0) opname = m.getName(); OperationMetaData om = new OperationMetaData(em, new QName(targetNamespace,opname), m.getName()); om.setSOAPAction(soapAction); Style style = Style.RPC; SOAPBinding sb = (SOAPBinding)endpoint.getAnnotation(SOAPBinding.class); if(sb != null) { String wsdlStyle = sb.style().name(); if(wsdlStyle != null && wsdlStyle.equalsIgnoreCase("DOCUMENT")) style = Style.DOCUMENT; } em.setStyle(style); Class[] paramTypes = m.getParameterTypes(); int lenparam = paramTypes != null ? paramTypes.length : 0; for (int j = 0; j < lenparam; j++) { Class paramType = paramTypes[j]; if(Remote.class.isAssignableFrom(paramType)) throw new WSException("OpName:" + opname + " param:" + paramType.getName() + " should not extend Remote" ); //Get the ParameterMetaData for the individual parameters om.addParameter(getParameterMetaData(paramType, om, j + 1)); } //Oneway annotation Oneway ow = m.getAnnotation(Oneway.class); if(ow != null) om.setOneWay(true); Class ret = m.getReturnType(); ParameterMetaData retPmd = getParameterMetaDataForReturnType(ret, om, 1); if(retPmd != null ) om.setReturnParameter(retPmd); //Take care of exceptions also Class[] exarr = m.getExceptionTypes(); if(exarr != null) { int len = Array.getLength(exarr); int i = 0; for( i = 0 ; i < len ; i++) { Class exClass = exarr[i]; if(!RemoteException.class.isAssignableFrom(exClass)) om.addFault(getFaultMetaData(exClass,om)); } } return om; } private ParameterMetaData getParameterMetaData(Class type, OperationMetaData om, int index) { WebParam wp = (WebParam)type.getAnnotation(WebParam.class); String tns = targetNamespace; String name = ""; ParameterMode mode = ParameterMode.IN; if( wp != null) { tns = wp.targetNamespace(); if(tns == null || tns == "") tns = targetNamespace; name = wp.name() == "" ? type.getName() + "_" + index : type.getName(); if( wp.mode() == WebParam.Mode.INOUT ) mode = ParameterMode.INOUT; else if(wp.mode() == WebParam.Mode.OUT) mode = ParameterMode.OUT; } if(name == null || name.length() == 0) name = this.getXMLName(type) + "_" +index; if(typeNamespace != null && typeNamespace.equals(tns) == false) tns = typeNamespace; //Types always deal with typeNamespace boolean header = wp != null ? wp.header() : false; QName xmlType = ToolsUtils.getXMLType(type, tns); ParameterMetaData pm = new ParameterMetaData(om, new QName(tns,name), xmlType, type.getName()); return pm; } private ParameterMetaData getParameterMetaDataForReturnType(Class type, OperationMetaData om, int index) { if(type == void.class) return null; if(Remote.class.isAssignableFrom( type )) throw new WSException(om.getJavaName() + " has return type which " + "should not extend java.rmi.Remote" ); WebResult wr = (WebResult)type.getAnnotation(WebResult.class); String tns = targetNamespace; String name = "result"; if( wr != null) { tns = wr.targetNamespace(); if(tns == null || tns == "") tns = targetNamespace; name = wr.name() == "" ? type.getName() + "_" + index : type.getName(); } else { // Check if it is a Holder if (Holder.class.isAssignableFrom( type )) { type = WSDLUtils.getInstance().getJavaTypeForHolder( type ); } } if(typeNamespace != null && tns.equals(typeNamespace) == false) tns = typeNamespace; QName xmlType = ToolsUtils.getXMLType(type, tns); ParameterMetaData pm = new ParameterMetaData(om, new QName(tns,name), xmlType, type.getName()); return pm; } private FaultMetaData getFaultMetaData(Class exType, OperationMetaData om) { String exname = WSDLUtils.getInstance().getJustClassName(exType); QName xmlName = new QName( typeNamespace, exname); FaultMetaData fm = new FaultMetaData(om, xmlName, xmlName, exType.getName()); return fm; } private String getXMLName(Class javaClass) { String name = ""; WSDLUtils utils = WSDLUtils.getInstance(); if(Holder.class.isAssignableFrom(javaClass)) javaClass = utils.getJavaTypeForHolder(javaClass); if(javaClass.isArray()) { int len = utils.getArrayDimension(javaClass); for(int i = 0; i < len; i++) javaClass = javaClass.getComponentType(); name = utils.getMessagePartForArray(javaClass); } else name = utils.getJustClassName(javaClass); return name; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/JavaKeywords.java0000644000175000017500000000603710573014651030623 0ustar godgod/* * JBoss, Home of Professional Open Source * Copyright 2007, 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.tools; import java.util.HashSet; import java.util.Set; /** * Singleton to check if a specified work is a restricted keyword. * * This list also includes the boolean literals and the null literal. * * @author darran.lofthouse@jboss.com * @since 5 Mar 2007 */ public class JavaKeywords { private static final JavaKeywords keywords = new JavaKeywords(); private final String[] keywordsArray = { "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", "enum", "extends", "final", "finally", "float", "for", "if", "goto", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "try", "void", "volatile", "while" }; private final String[] restrictedLiteralsArray = { "true", "false", "null" }; private final Set restrictedKeywords; private JavaKeywords() { int keywordsSize = keywordsArray.length + restrictedLiteralsArray.length; keywordsSize = (int)((double)keywordsSize / 0.75) + 1; restrictedKeywords = new HashSet(keywordsSize); addAll(restrictedKeywords, keywordsArray); addAll(restrictedKeywords, restrictedLiteralsArray); } private void addAll(final Set set, final String[] data) { for (String current : data) { set.add(current); } } /** * The internal method to check if the keyword is a restricted * keyword. * * @param name * @return */ private boolean internalIsRestrictedKeyword(final String name) { return restrictedKeywords.contains(name); } /** * Check is the passed in name is a reserved Java keyword. * * @param name * @return */ public static boolean isJavaKeyword(final String name) { return keywords.internalIsRestrictedKeyword(name); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/HolderWriter.java0000644000175000017500000000776510613224665030640 0ustar godgod/* * JBoss, Home of Professional Open Source * Copyright 2007, 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.tools; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; import javax.xml.rpc.holders.Holder; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.WSDLUtils; /** * Utility class to write JAX-RPC holders. * * @author darran.lofthouse@jboss.com * @since 11 Apr 2007 */ public class HolderWriter { private static final WSDLUtils utils = WSDLUtils.getInstance(); private static final String newline = "\n"; /** * HashMap of the holders already generated so they do not need to be * generated again. */ private HashMap createdHolders = new HashMap(); String getOrCreateHolder(final String type, final File pkgLoc) { String fullHolderName = createdHolders.get(type); if (fullHolderName == null) { StringBuilder buf = new StringBuilder(); fullHolderName = writeHolder(type, buf); createdHolders.put(type, fullHolderName); String holderName = fullHolderName.substring(fullHolderName.lastIndexOf('.') + 1); try { File sei = utils.createPhysicalFile(pkgLoc, holderName); FileWriter writer = new FileWriter(sei); writer.write(buf.toString()); writer.flush(); writer.close(); } catch (IOException e) { throw new WSException("Unable to create JAX-RPC holder.", e); } } return fullHolderName; } private String writeHolder(final String type, final StringBuilder buf) { String pkg = type.substring(0, type.lastIndexOf('.')); String typeName = type.substring(type.lastIndexOf('.') + 1); String holderName = typeName + "Holder"; utils.writeJbossHeader(buf); buf.append(newline); buf.append("package ").append(pkg).append(";").append(newline); buf.append(newline); buf.append("public class ").append(holderName).append(" implements ").append(Holder.class.getName()); buf.append(newline).append("{").append(newline); // Add the public member variable. buf.append(newline); buf.append(" public ").append(type).append(" value;"); buf.append(newline); // Add the default constructor. buf.append(newline); buf.append(" ").append("public ").append(holderName).append("()").append(newline); buf.append(" {").append(newline); buf.append(" this.value = new ").append(type).append("();").append(newline); buf.append(" }").append(newline); // Add the second constructor. buf.append(newline); buf.append(" ").append("public ").append(holderName).append("(final ").append(type).append(" value)").append(newline); buf.append(" {").append(newline); buf.append(" this.value = value;").append(newline); buf.append(" }").append(newline); buf.append(newline); buf.append("}").append(newline); return pkg + "." + holderName; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/JavaToWSDL.java0000644000175000017500000002421510650145103030057 0ustar godgod/* * 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.tools; // $Id: JavaToWSDL.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.StringWriter; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.rpc.encoding.TypeMapping; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.Style; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.tools.Configuration.OperationConfig; import org.jboss.ws.tools.metadata.ToolsUnifiedMetaDataBuilder; import org.jboss.ws.tools.wsdl.WSDLWriter; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * Generates a WSDL for a service endpoint. * *
      This is the main entry point for all Java To WSDL needs. *
      Features that can be set are derived from org.jboss.ws.tools.WSToolsConstants *

      * Notable ones are:
      * @see org.jboss.ws.tools.WSToolsConstants.WSTOOLS_FEATURE_RESTRICT_TO_TARGET_NS * @see org.jboss.ws.tools.WSToolsConstants.WSTOOLS_FEATURE_INCLUDE_SCHEMA_IN_WSDL * @see org.jboss.ws.tools.WSToolsConstants.WSTOOLS_FEATURE_USE_ANNOTATIONS * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 24-Jul-2005 */ public class JavaToWSDL { // provide logging private static final Logger log = Logger.getLogger(JavaToWSDL.class); // The required wsdl namespace URI private String wsdlNamespace; // The target namespace private String targetNamespace; //The type namespace (it can be different from the target namespace) private String typeNamespace; // The service name private String serviceName; // The portType name private String portTypeName; private Style style; private ParameterStyle parameterStyle; // Features as represented by Constants private Map features = new HashMap(); // A Map of package/namespace mapping that needs to be passed onto types generator private Map packageNamespaceMap = new HashMap(); private TypeMapping typeMapping = null; private JavaWsdlMapping javaWsdlMapping = null; private UnifiedMetaData umd = null; private boolean qualifiedElements = false; private Map> operationMap = null; /** Contruct a java to wsdl generator for a given wsdl version. *

      * WSDL-1.1 namespace URI: http://schemas.xmlsoap.org/wsdl/
      * WSDL-2.0 namespace URI: http://www.w3.org/2003/11/wsdl * * @param namespace wsdl namespace URI */ public JavaToWSDL(String namespace) { if (Constants.NS_WSDL11.equals(namespace) == false) throw new IllegalArgumentException("Unsupported wsdl version: " + namespace); this.wsdlNamespace = namespace; } /** * Add a feature to this subsystem * @see org.jboss.ws.tools.WSToolsConstants * @param name * @param value */ public void addFeature(String name, boolean value) { features.put(name, new Boolean(value)); } /** * Return a feature if set * @see org.jboss.ws.tools.WSToolsConstants * @param name * @return boolean value representing the feature, if not * @throws IllegalStateException Feature unrecognized */ public boolean getFeature(String name) { Boolean val = features.get(name); if (val == null) throw new WSException("Feature value not available: " + name); return val.booleanValue(); } /** Get the immutable wsdl namespace URI */ public String getWsdlNamespace() { return wsdlNamespace; } /** Get the wsdl target namespace */ public String getTargetNamespace() { return targetNamespace; } /** Set the wsdl target namespace */ public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; } /** Get the type Namespace */ public String getTypeNamespace() { return typeNamespace; } /** Set the Type Namespace */ public void setTypeNamespace(String typeNamespace) { this.typeNamespace = typeNamespace; } /** Get the wsdl service name */ public String getServiceName() { return serviceName; } /** Set the wsdl service name */ public void setServiceName(String serviceName) { this.serviceName = serviceName; } /** Get the wsdl service endpoint name */ public String getPortTypeName() { return portTypeName; } /** Set the wsdl service PortType Name */ public void setPortTypeName(String endpointName) { this.portTypeName = endpointName; } /** * During the WSDL generation process, a typeMapping will be * created that maps xml types -> java types * * @return typeMapping * @exception IllegalStateException If typeMapping has not been generated */ public TypeMapping getTypeMapping() { if(typeMapping == null) throw new WSException("TypeMapping has not been generated"); return typeMapping; } public Style getStyle() { return style; } public void setStyle(Style style) { this.style = style; } public ParameterStyle getParameterStyle() { return parameterStyle; } public void setParameterStyle(ParameterStyle parameterStyle) { this.parameterStyle = parameterStyle; } /** * Users can customize a java package->xml namespace map * that will be used in the Java to WSDL process. *
      The package representing the endpoint will always be mapped * to the target namespace, irrespective of an attempt to * customize that in the map. If you desire to change that, then * think about changing just the type namespace as the types are * generated using the typenamespace. * * @param pn The Map */ public void setPackageNamespaceMap(Map pn) { this.packageNamespaceMap = pn; } public void setOperationMap(Map> operationMap) { this.operationMap = operationMap; } /** * Clients of Tools can build a UnifiedMetaData externally * and pass it to the Java To WSDL subsystem [Optional] * * @param um */ public void setUnifiedMetaData(UnifiedMetaData um) { this.umd = um; } public UnifiedMetaData getUnifiedMetaData() { return umd; } public void setUmd(UnifiedMetaData umd) { this.umd = umd; } public boolean isQualifiedElements() { return qualifiedElements; } public void setQualifiedElements(boolean qualifiedElements) { this.qualifiedElements = qualifiedElements; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } /** Generate the common WSDL definition for a given endpoint */ public WSDLDefinitions generate(Class endpoint) { if(log.isDebugEnabled()) log.debug("generate [endpoint=" + endpoint.getName() + ",tnsURI=" + targetNamespace + ",service=" + serviceName + ",portType=" + portTypeName + "]"); if( umd == null) { umd = new ToolsUnifiedMetaDataBuilder(endpoint, targetNamespace, typeNamespace, serviceName, style, parameterStyle, operationMap).getUnifiedMetaData(); } if (typeNamespace != null) packageNamespaceMap.put(endpoint.getPackage().getName(), typeNamespace); WSDLDefinitions wsdlDefinitions = null; try { if (Constants.NS_WSDL11.equals(wsdlNamespace)) { JavaToWSDL11 javaWSDL11 = new JavaToWSDL11(); javaWSDL11.addFeatures(features); javaWSDL11.setPackageNamespaceMap(packageNamespaceMap); javaWSDL11.addFeatures(features); if( umd != null ) javaWSDL11.setUnifiedMetaData(umd); javaWSDL11.setQualifiedElements(qualifiedElements); wsdlDefinitions = javaWSDL11.generate(endpoint); typeMapping = javaWSDL11.getTypeMapping(); javaWsdlMapping = javaWSDL11.getJavaWsdlMapping(); } if (wsdlDefinitions == null) throw new WSException("Cannot generate WSDL definitions"); // Debug the generated wsdl StringWriter sw = new StringWriter(); new WSDLWriter(wsdlDefinitions).write(sw, Constants.DEFAULT_XML_CHARSET); if(log.isDebugEnabled()) log.debug("Generated WSDL:\n" + sw.toString()); // Debug the generated mapping file String jaxrpcMappingStr = null; if (javaWsdlMapping != null) { Element root = DOMUtils.parse(javaWsdlMapping.serialize()); jaxrpcMappingStr = DOMWriter.printNode(root, true); } if(log.isDebugEnabled()) log.debug("Generated Mapping:\n" + jaxrpcMappingStr); } catch (RuntimeException rte) { throw rte; } catch (Exception e) { log.error("Cannot generate WSDL",e); throw new WSException("Cannot generate wsdl from: " + endpoint); } return wsdlDefinitions; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/JavaWriter.java0000644000175000017500000003312010573014651030261 0ustar godgod/* * 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.tools; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.tools.XSDTypeToJava.VAR; /** * Handles writing of Java source files (XSD-> Java) * @author Anil Saldhana * @since May 6, 2005 */ public class JavaWriter { private String newline = "\n"; protected WSDLUtils utils = WSDLUtils.getInstance(); public JavaWriter() { } /** * Creates a Java Class that represents a Simple Type restricted by enumeration * @param fname * @param lst List of enumerated values (we support Strings only) * @param loc Location where the file has to be created * @param pkgname Package Name * @throws IOException */ public void createJavaFileForEnumeratedValues(String fname, StringList lst, File loc, String pkgname, XSSimpleTypeDefinition type) throws IOException { List importList = new ArrayList(); importList.add("java.util.Map"); importList.add("java.util.HashMap"); File sei = utils.createPhysicalFile(loc, fname); StringBuilder buf = utils.createClassBasicStructure(pkgname, fname, type, importList, null); buf.append("private java.lang.String value;" + newline); buf.append("private static Map valueMap = new HashMap();" + newline); //For now, we will support Strings only int lenOfArr = lst != null ? lst.getLength() : 0; for (int i = 0; i < lenOfArr; i++) { String str = lst.item(i); buf.append("public static final String _" + str + "String = \"" + str + "\";" + newline); } for (int i = 0; i < lenOfArr; i++) { String str = lst.item(i); buf.append("public static final java.lang.String _" + str + " = new java.lang.String(_" + str + "String);"); buf.append(newline); } for (int i = 0; i < lenOfArr; i++) { String str = lst.item(i); buf.append("public static final " + fname + " " + str + " = new " + fname + "(_" + str + ");"); buf.append(newline); } //Create CTR buf.append(newline + newline + "protected " + fname + "(java.lang.String value) { " + newline); buf.append("this.value = value;valueMap.put(this.toString(), this); " + newline + "}"); buf.append(newline + newline); //Create getValue method buf.append(newline + " public java.lang.String getValue() {" + newline + " return value;" + newline + "}"); buf.append(newline + newline); //Create fromValue method buf.append(newline + "public static " + fname + " fromValue(java.lang.String value)" + newline); buf.append(" throws java.lang.IllegalStateException {" + newline); for (int i = 0; i < lenOfArr; i++) { String str = lst.item(i); if (i > 0) buf.append("else "); buf.append("if (" + str + ".value.equals(value)) {" + newline); buf.append("return " + str + ";" + newline); buf.append("}" + newline); } buf.append(" throw new IllegalArgumentException();" + newline + "}" + newline + newline); //End- fromValue method //create- fromString method buf.append(newline + "public static " + fname + " fromString(String value)" + newline); buf.append(" throws java.lang.IllegalStateException {" + newline); buf.append(fname + " ret = (" + fname + ")valueMap.get(value);" + newline); buf.append("if (ret != null) {" + newline + " return ret;" + newline + " }" + newline + newline); for (int i = 0; i < lenOfArr; i++) { String str = lst.item(i); if (i > 0) buf.append("else "); buf.append("if (value.equals(_" + str + "String)) {" + newline); buf.append("return " + str + ";" + newline + "}"); } buf.append(newline + " throw new IllegalArgumentException();" + newline + "}" + newline + newline); //End- fromString method //create - toString method buf.append(newline + " public String toString() {" + newline + " return value.toString();" + newline + "}" + newline); //End - toString method //create -readResolve method buf.append(newline + "private Object readResolve()" + newline + " throws java.io.ObjectStreamException {" + newline + " return fromValue(getValue());" + newline + " } " + newline); //End - readResolve method //create - equals method buf.append(newline + "private boolean equals(Object obj){" + newline + " if (!(obj instanceof " + fname + ")) {" + newline + " return false;" + newline + " } " + newline); buf.append("return ((" + fname + ")obj).value.equals(value);" + newline + "}" + newline); //End - equals method //create - hashCode method buf.append(newline + " public int hashCode() { " + newline + " return value.hashCode(); " + newline + " }" + newline); //End - hashCode method buf.append("}" + newline); //end of class FileWriter writer = new FileWriter(sei); writer.write(buf.toString()); writer.flush(); writer.close(); } /** * A simple utility method that just creates a Java source file * * @param location Location where the Java source file needs to be written * @param filename File Name of the Java source * @param packageName * @param vars * @param importList List of strings that represent imports * @param baseTypeName Name of base class * @param isExceptionType Exception types need special treatment * @param typeNameToBaseVARList Needed if we are dealing with an exception type * @throws IOException */ public void createJavaFile(File location, String filename, String packageName, List vars, List importList, String baseTypeName, boolean isExceptionType, Map typeNameToBaseVARList) throws IOException { File newLoc = null; if (needToCreatePackageStructure(location, packageName)) newLoc = utils.createPackage(location.getPath(), packageName); else newLoc = location; String classname = utils.chop(filename, ".java"); File sei = utils.createPhysicalFile(newLoc, classname); StringBuilder buffer = new StringBuilder(); utils.writeJbossHeader(buffer); //Create the package Name buffer.append(newline).append("package ").append(packageName).append(";"); if (importList != null) { for (String imp : importList) { buffer.append(newline).append("import ").append(imp).append(";"); } } buffer.append(newline).append(newline); buffer.append(newline).append("public class ").append(classname).append(newline); if (baseTypeName != null && baseTypeName.length() > 0) buffer.append(" extends ").append(baseTypeName); buffer.append("{").append(newline); createVariables(buffer, vars, isExceptionType); createCTR(buffer, classname, vars, isExceptionType, typeNameToBaseVARList); buffer.append(newline); createAccessors(buffer, vars, isExceptionType); buffer.append("}").append(newline); //Create a FileWriter FileWriter writer = new FileWriter(sei); writer.write(buffer.toString()); writer.flush(); writer.close(); } //PRIVATE METHODS private void createCTR(StringBuilder buf, String cname, List vars, boolean isExceptionType, Map typeNameToBaseVARList) { if (vars.size() > 0 && isExceptionType == false) { buf.append("public " + cname + "(){}"); //Empty CTR buf.append(newline); buf.append(newline); } StringBuilder ctrvarbuf = new StringBuilder(); StringBuilder ctrintbuf = new StringBuilder(); boolean calledSuper = false; if (isExceptionType) { List baseList = typeNameToBaseVARList.get(cname); int baseLen = baseList != null ? baseList.size() : 0; String arrStr = "[]"; if (baseLen > 0) { calledSuper = true; ctrintbuf.append("super("); for (int i = 0; i < baseLen; i++) { if (i > 0) { ctrvarbuf.append(", "); ctrintbuf.append(", "); } VAR v = baseList.get(i); ctrvarbuf.append(v.getVartype()); if (v.isArrayType) ctrvarbuf.append(arrStr); ctrvarbuf.append(" ").append(v.getVarname()); ctrintbuf.append(v.getVarname()); } ctrintbuf.append(");").append(newline); } } Iterator iter = vars.iterator(); int index = 0; while (iter.hasNext()) { if (index++ > 0 || calledSuper) { ctrvarbuf.append(", "); } VAR v = (VAR)iter.next(); String name = v.getVarname(); if (JavaKeywords.isJavaKeyword(name)) { name = "_" + name; } String type = v.getVartype(); boolean isArr = v.isArrayType(); ctrvarbuf.append(type); if (isArr) ctrvarbuf.append("[]"); ctrvarbuf.append(" " + name); if (isExceptionType && calledSuper == false && index == 1 && v.getVartype().equals("java.lang.String")) { ctrintbuf.append("super(").append(v.getVarname()).append(");").append(newline); calledSuper = true; } ctrintbuf.append("this." + name + "=" + name + ";"); ctrintbuf.append(newline); } buf.append("public " + cname + "(" + ctrvarbuf.toString() + "){"); buf.append(newline); buf.append(ctrintbuf.toString()); buf.append("}"); } private void createAccessors(StringBuilder buf, List vars, boolean isExceptionType) { Iterator iter = vars.iterator(); while (iter.hasNext()) { VAR v = (VAR)iter.next(); String name = v.getVarname(); String internalName = name; if (JavaKeywords.isJavaKeyword(internalName)) { internalName = "_" + internalName; } String type = v.getVartype(); boolean isArr = v.isArrayType(); //Add getter/setter also buf.append("public " + type); if (isArr) buf.append("[] "); String str = " get"; //boolean case if (type.equals("boolean")) str = " is"; buf.append(str + utils.getMixedCase(name) + "() { return " + internalName + " ;}"); buf.append(newline); buf.append(newline); if (isExceptionType == false) writeSetter(buf, name, internalName, type, isArr); buf.append(newline); buf.append(newline); } } private List createVariables(StringBuilder buf, List vars, boolean isExceptionType) { if (vars == null) return vars; Iterator iter = vars.iterator(); while (iter.hasNext()) { VAR v = (VAR)iter.next(); String name = v.getVarname(); // JBWS-1170 Convert characters which are illegal in Java identifiers name = ToolsUtils.convertInvalidCharacters(name); if (JavaKeywords.isJavaKeyword(name)) { name = "_" + name; } String type = v.getVartype(); boolean isArr = v.isArrayType(); buf.append(newline); if (isExceptionType) buf.append("private " + type); else buf.append("protected " + type); if (isArr) buf.append("[] "); buf.append(" " + name).append(";").append(newline); } return vars; } private boolean needToCreatePackageStructure(File location, String packageName) { packageName = packageName.replace('.', '/'); try { String externalForm = location.toURL().toExternalForm(); return externalForm.indexOf(packageName) < 0; } catch (MalformedURLException e) { // ignore return false; } } private void writeSetter(StringBuilder buf, String name, String internalName, String type, boolean isArr) { buf.append("public void "); buf.append("set" + utils.getMixedCase(name) + "(" + type); if (isArr) buf.append("[]"); buf.append(" " + internalName + "){ this." + internalName + "=" + internalName + "; }"); } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/WSDLToJava.java0000644000175000017500000007250510737160603030074 0ustar godgod/* * 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.tools; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.net.URL; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.metadata.wsdl.WSDLBindingOperation; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLException; import org.jboss.ws.metadata.wsdl.WSDLInterface; import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault; import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput; import org.jboss.ws.metadata.wsdl.WSDLRPCPart; import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader; import org.jboss.ws.metadata.wsdl.WSDLTypes; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.ws.tools.helpers.ReturnTypeUnwrapper; import org.jboss.ws.tools.interfaces.WSDLToJavaIntf; import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory; import org.jboss.wsf.common.JavaUtils; import org.w3c.dom.Element; /** * Class that acts as the front door to all wsdl2java needs
      * *
      Note: (Web Services Layer)
      * Method to generate Java SEI is as follows
      *
      {@link #generateSEI(URL wsdlFile, File dir, boolean annotate) generateSEI} *
      *
      Please also have a look at the features that can be passed via {@link #setFeature(String name, boolean value) setFeature} *
      *
      Features are: *
      @see org.jboss.ws.Constants.USE_ANNOTATIONS : Should the generated Java Types use annotations * @author Anil Saldhana * @since Dec 28, 2004 */ public class WSDLToJava implements WSDLToJavaIntf { private String newline = "\n"; protected LiteralTypeMapping typeMapping = null; protected WSDLDefinitions wsdl = null; /** * Singleton class that handle many utility functions */ protected WSDLUtils utils = WSDLUtils.getInstance(); //Feature Set protected boolean annotate = false; protected Map namespacePackageMap = null; protected HolderWriter holderWriter = new HolderWriter(); private String seiPkgName = ""; private String directoryToGenerate = ""; private String style; private String parameterStyle; public WSDLToJava() { } /* (non-Javadoc) * @see org.jboss.ws.tools.WSDLToJavaIntf#convertWSDL2Java(java.net.URL) */ public WSDLDefinitions convertWSDL2Java(URL wsdlfileurl) throws WSDLException { checkTypeMapping(); WSDLDefinitionsFactory wsdlFactory = WSDLDefinitionsFactory.newInstance(); wsdl = wsdlFactory.parse(wsdlfileurl); return wsdl; } /* (non-Javadoc) * @see org.jboss.ws.tools.WSDLToJavaIntf#getFeature(java.lang.String) */ public boolean getFeature(String name) { if (name == null) throw new IllegalArgumentException("Illegal null argument:name"); if (name.equalsIgnoreCase(WSToolsConstants.WSTOOLS_FEATURE_USE_ANNOTATIONS)) return annotate; throw new WSException("Feature:" + name + " not recognized"); } /* (non-Javadoc) * @see org.jboss.ws.tools.WSDLToJavaIntf#setFeature(java.lang.String, boolean) */ public void setFeature(String name, boolean value) { if (name == null) throw new IllegalArgumentException("Illegal null argument:name"); if (name.equalsIgnoreCase(WSToolsConstants.WSTOOLS_FEATURE_USE_ANNOTATIONS)) annotate = value; } /* (non-Javadoc) * @see org.jboss.ws.tools.WSDLToJavaIntf#generateSEI(java.net.URL, java.io.File, boolean) */ public void generateSEI(URL wsdlFile, File dir, boolean annotate) throws IOException { checkTypeMapping(); WSDLDefinitions wsdl = convertWSDL2Java(wsdlFile); this.annotate = annotate; this.directoryToGenerate = dir.getAbsolutePath(); generateSEI(wsdl, dir); } /* (non-Javadoc) * @see org.jboss.ws.tools.WSDLToJavaIntf#generateSEI(org.jboss.ws.metadata.wsdl.WSDLDefinitions, java.io.File) */ public void generateSEI(WSDLDefinitions wsdl, File dir) throws IOException { checkTypeMapping(); this.directoryToGenerate = dir.getAbsolutePath(); this.wsdl = wsdl; style = utils.getWSDLStyle(wsdl); //TODO: Handle annotations flag, as per JAX-WS 2.0 Spec. //Given the WSDL Object Tree, generate the SEI //Also take in the location where the SEI should be written // String typeNS = wsdl.getNamespaceURI(WSDLConstants.PREFIX_TNS); String targetNS = wsdl.getTargetNamespace(); //Check if there is an user override String packageName = namespacePackageMap != null ? namespacePackageMap.get(targetNS) : null; if (packageName == null || packageName.length() == 0) packageName = NamespacePackageMapping.getJavaPackageName(targetNS); this.seiPkgName = packageName; File dirloc = utils.createPackage(dir.getAbsolutePath(), packageName); createSEI(dirloc, wsdl); } public Map getNamespacePackageMap() { return namespacePackageMap; } /* (non-Javadoc) * @see org.jboss.ws.tools.WSDLToJavaIntf#setPackageNamespaceMap(java.util.Map) */ public void setNamespacePackageMap(Map map) { //Lets convert the package->namespace map to namespace->package map Set keys = map.keySet(); Iterator iter = keys.iterator(); while (iter != null && iter.hasNext()) { if (namespacePackageMap == null) namespacePackageMap = new HashMap(); String pkg = iter.next(); namespacePackageMap.put(pkg, map.get(pkg)); } } public void setTypeMapping(LiteralTypeMapping tm) { this.typeMapping = tm; } private class WrappedArray { public QName xmlType; public XSTypeDefinition xt; public String suffix; public boolean nillable; public WrappedArray(XSTypeDefinition xt) { this.xt = xt; } public boolean unwrap() { if (!Constants.DOCUMENT_LITERAL.equals(style)) { XSElementDeclaration unwrapped = SchemaUtils.unwrapArrayType(xt); StringBuilder builder = new StringBuilder(); while (unwrapped != null) { xt = unwrapped.getTypeDefinition(); nillable = unwrapped.getNillable(); builder.append("[]"); unwrapped = SchemaUtils.unwrapArrayType(xt); } if (builder.length() > 0) { xmlType = new QName(xt.getNamespace(), xt.getName()); suffix = builder.toString(); return true; } } return false; } } //*************************************************************************** // PRIVATE METHODS //*************************************************************************** private boolean isDocument() { return Constants.DOCUMENT_LITERAL.equals(style); } private boolean isWrapped() { return "wrapped".equals(parameterStyle) && Constants.DOCUMENT_LITERAL.equals(style); } private void appendMethods(WSDLInterface intf, StringBuilder buf) throws IOException { buf.append(newline); String itfname = intf.getName().getLocalPart(); WSDLInterfaceOperation[] ops = intf.getOperations(); if (ops == null || ops.length == 0) throw new IllegalArgumentException("Interface " + itfname + " doesn't have operations"); int len = ops != null ? ops.length : 0; for (int i = 0; i < len; i++) { WSDLInterfaceOperation op = ops[i]; WSDLBindingOperation bindingOperation = HeaderUtil.getWSDLBindingOperation(wsdl, op); //TODO: Take care of multiple outputs String returnType = null; StringBuilder paramBuffer = new StringBuilder(); WSDLInterfaceOperationInput input = WSDLUtils.getWsdl11Input(op); WSDLInterfaceOperationOutput output = WSDLUtils.getWsdl11Output(op); if (isDocument()) { returnType = appendDocParameters(paramBuffer, input, output, bindingOperation); } else { returnType = appendRpcParameters(paramBuffer, op, output, bindingOperation); } if (returnType == null) returnType = "void"; buf.append(" public " + returnType + " "); buf.append(ToolsUtils.firstLetterLowerCase(op.getName().getLocalPart())); buf.append("(").append(paramBuffer); buf.append(") throws "); //Generate the Exception Types WSDLInterfaceOperationOutfault[] outfaults = op.getOutfaults(); for (int k = 0; k < outfaults.length; k++) { WSDLInterfaceOperationOutfault fault = outfaults[k]; QName faultName = fault.getRef(); //Get the main fault from the wsdlInterface WSDLInterfaceFault intfFault = fault.getWsdlInterfaceOperation().getWsdlInterface().getFault(faultName); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); QName faultXMLName = intfFault.getElement(); QName faultXMLType = intfFault.getXmlType(); XSElementDeclaration xe = xsmodel.getElementDeclaration(faultXMLName.getLocalPart(), faultXMLName.getNamespaceURI()); XSTypeDefinition xt = xe.getTypeDefinition(); if (!xt.getAnonymous()) xt = xsmodel.getTypeDefinition(xt.getName(), xt.getNamespace()); if (xt instanceof XSComplexTypeDefinition) generateJavaSource((XSComplexTypeDefinition)xt, xsmodel, faultXMLName.getLocalPart(), true); Class cl = getJavaType(faultXMLType, false); if (cl == null) { String faultTypeName = (!xt.getAnonymous()) ? faultXMLType.getLocalPart() : faultXMLName.getLocalPart(); String packageName = getPackageName(xt.getNamespace()); buf.append(packageName + "." + JavaUtils.capitalize(faultTypeName)); } else buf.append(cl.getName()); buf.append(","); } buf.append(" java.rmi.RemoteException"); buf.append(";"); buf.append(newline); } } private String appendRpcParameters(StringBuilder paramBuffer, WSDLInterfaceOperation op, WSDLInterfaceOperationOutput output, WSDLBindingOperation bindingOperation) throws IOException { String returnType = null; boolean first = true; RPCSignature signature = new RPCSignature(op); for (WSDLRPCPart part : signature.parameters()) { if (first) first = false; else paramBuffer.append(", "); QName xmlName = new QName(part.getName()); QName xmlType = part.getType(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); boolean holder = output != null && output.getChildPart(part.getName()) != null; generateParameter(paramBuffer, xmlName.getLocalPart(), xmlType, xsmodel, xt, false, true, holder); paramBuffer.append(" ").append(getMethodParam(xmlName.getLocalPart())); } if (signature.returnParameter() != null) { QName xmlName = new QName(signature.returnParameter().getName()); QName xmlType = signature.returnParameter().getType(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); returnType = getReturnType(xmlName, xmlType, xt); } if (bindingOperation != null) { appendHeaderParameters(paramBuffer, bindingOperation); } return returnType; } private String appendDocParameters(StringBuilder paramBuffer, WSDLInterfaceOperationInput input, WSDLInterfaceOperationOutput output, WSDLBindingOperation bindingOperation) throws IOException { String returnType = null; boolean holder = false; if (input != null && input.getElement() != null) { QName xmlName = input.getElement(); holder = output != null && xmlName.equals(output.getElement()); appendParameters(paramBuffer, input, output, xmlName.getLocalPart()); } if (!holder && output != null && output.getElement() != null) { QName xmlName = output.getElement(); QName xmlType = output.getXMLType(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); returnType = getReturnType(xmlName, xmlType, xt); } if (bindingOperation != null) { appendHeaderParameters(paramBuffer, bindingOperation); } return returnType; } private void appendHeaderParameters(StringBuilder buf, WSDLBindingOperation bindingOperation) throws IOException { WSDLSOAPHeader[] inputHeaders = HeaderUtil.getSignatureHeaders(bindingOperation.getInputs()); WSDLSOAPHeader[] outputHeaders = HeaderUtil.getSignatureHeaders(bindingOperation.getOutputs()); // Process Inputs First for (WSDLSOAPHeader currentInput : inputHeaders) { boolean holder = HeaderUtil.containsMatchingPart(outputHeaders, currentInput); appendHeaderParameter(buf, currentInput, holder); } for (WSDLSOAPHeader currentOutput : outputHeaders) { boolean input = HeaderUtil.containsMatchingPart(inputHeaders, currentOutput); if (input == true) continue; appendHeaderParameter(buf, currentOutput, true); } } private void appendHeaderParameter(StringBuilder buf, WSDLSOAPHeader header, boolean holder) throws IOException { QName elementName = header.getElement(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); XSElementDeclaration xe = xsmodel.getElementDeclaration(elementName.getLocalPart(), elementName.getNamespaceURI()); XSTypeDefinition xt = xe.getTypeDefinition(); WSDLTypes wsdlTypes = wsdl.getWsdlTypes(); QName xmlType = wsdlTypes.getXMLType(header.getElement()); // Replace the xt with the real type from the schema. xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); if (buf.length() > 0) { buf.append(", "); } generateParameter(buf, xe.getName(), xmlType, xsmodel, xt, false, true, holder); buf.append(" ").append(header.getPartName()); } private void appendParameters(StringBuilder buf, WSDLInterfaceOperationInput in, WSDLInterfaceOperationOutput output, String containingElement) throws IOException { QName xmlType = in.getXMLType(); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); boolean wrapped = isWrapped(); if (wrapped) { int inputs = in.getWsdlOperation().getInputs().length; if (inputs > 1) throw new WSException("[JAX-RPC - 2.3.1.2] Can not unwrap parameters for operation with mutliple inputs. inputs=" + inputs); String operationName = in.getWsdlOperation().getName().getLocalPart(); String elementName = in.getElement().getLocalPart(); if (elementName.equals(operationName) == false) throw new WSException("[JAX-RPC - 2.3.1.2] Unable to unwrap parameters, wrapper element name must match operation name. operationName=" + operationName + " elementName=" + elementName); wrapped = unwrapElementParameters(buf, containingElement, xt); } if (wrapped == false) { QName xmlName = in.getElement(); boolean holder = output != null && xmlName.equals(output.getElement()); generateParameter(buf, containingElement, xmlType, xsmodel, xt, false, true, holder); buf.append(" ").append(getMethodParam(containingElement)); } } private boolean unwrapElementParameters(StringBuilder buf, String containingElement, XSTypeDefinition xt) throws IOException { // If at any point parameter unwrapping can not happen return false so we drop back to not unwrapping. if (xt instanceof XSComplexTypeDefinition == false) return false; StringBuilder tempBuf = new StringBuilder(); XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt; boolean hasAttributes = wrapper.getAttributeUses().getLength() > 0; if (hasAttributes) throw new WSException("[JAX-RPC 2.3.1.2] Can not unwrap, complex type contains attributes."); boolean unwrappedElement = false; XSParticle particle = wrapper.getParticle(); if (particle == null) { unwrappedElement = true; } else { XSTerm term = particle.getTerm(); if (term instanceof XSModelGroup) { unwrappedElement = unwrapGroup(tempBuf, containingElement, (XSModelGroup)term); } } if (unwrappedElement) { buf.append(tempBuf); // We need a wrapper class generated generateJavaSource(wrapper, WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()), containingElement); return true; } return false; } public boolean unwrapGroup(StringBuilder buf, String containingElement, XSModelGroup group) throws IOException { if (group.getCompositor() != XSModelGroup.COMPOSITOR_SEQUENCE) return false; XSObjectList particles = group.getParticles(); for (int i = 0; i < particles.getLength(); i++) { XSParticle particle = (XSParticle)particles.item(i); XSTerm term = particle.getTerm(); if (term instanceof XSModelGroup) { if (unwrapGroup(buf, containingElement, (XSModelGroup)term) == false) return false; } else if (term instanceof XSElementDeclaration) { if (buf.length() > 0) buf.append(", "); XSElementDeclaration element = (XSElementDeclaration)term; XSTypeDefinition type = element.getTypeDefinition(); String tempContainingElement = containingElement + ToolsUtils.firstLetterUpperCase(element.getName()); QName xmlType = null; if (type.getAnonymous() == false) xmlType = new QName(type.getNamespace(), type.getName()); JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1; boolean primitive = !(element.getNillable() || (particle.getMinOccurs() == 0 && particle.getMaxOccurs() == 1)); generateParameter(buf, tempContainingElement, xmlType, xsmodel, type, array, primitive, false); String paramName; if (type.getAnonymous()) { paramName = containingElement; } else { paramName = element.getName(); } buf.append(" ").append(getMethodParam(paramName)); } } // If we reach here we must have successfully unwrapped the parameters. return true; } private void generateParameter(StringBuilder buf, String containingElement, QName xmlType, JBossXSModel xsmodel, XSTypeDefinition xt, boolean array, boolean primitive, boolean holder) throws IOException { WrappedArray wrappedArray = new WrappedArray(xt); String arraySuffix = (array) ? "[]" : ""; if (wrappedArray.unwrap()) { xt = wrappedArray.xt; xmlType = wrappedArray.xmlType; primitive = !wrappedArray.nillable; arraySuffix = wrappedArray.suffix; } if (xt instanceof XSSimpleTypeDefinition) xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt); Class cl = null; if (xmlType != null) cl = getJavaType(xmlType, primitive); if (cl != null) { if (holder) cl = utils.getHolder(cl); buf.append(JavaUtils.getSourceName(cl) + arraySuffix); } else { String className; if (xt == null || xt.getAnonymous()) { className = containingElement; } else { className = xmlType.getLocalPart(); } if (className.charAt(0) == '>') className = className.substring(1); className = ToolsUtils.convertInvalidCharacters(className); className = utils.firstLetterUpperCase(className); String packageName = getPackageName(xt.getNamespace()); className = packageName + "." + className + arraySuffix; if (holder) { className = holderWriter.getOrCreateHolder(className, getLocationForJavaGeneration(packageName)); } buf.append(className); if (xt instanceof XSComplexTypeDefinition) generateJavaSource((XSComplexTypeDefinition)xt, xsmodel, containingElement); } } private void createSEIFile(WSDLInterface intf, File loc) throws IOException { String seiName = getServiceEndpointInterfaceName(intf); StringBuilder buf = new StringBuilder(); utils.writeJbossHeader(buf); buf.append("package " + seiPkgName + ";" + newline); buf.append("public interface " + seiName + " extends java.rmi.Remote" + newline + "{" + newline); appendMethods(intf, buf); buf.append("}" + newline); File sei = utils.createPhysicalFile(loc, seiName); FileWriter writer = new FileWriter(sei); writer.write(buf.toString()); writer.flush(); writer.close(); } public String getServiceEndpointInterfaceName(WSDLInterface wsdlInterface) { String seiName = utils.chopPortType(wsdlInterface.getName().getLocalPart()); //Check if the portType name conflicts with a service name if (wsdl.getService(seiName) != null) seiName += "_PortType"; seiName = JavaUtils.capitalize(seiName); return seiName; } private void createSEI(File loc, WSDLDefinitions wsdl) throws IOException { WSDLInterface[] intarr = wsdl.getInterfaces(); if (intarr == null || intarr.length == 0) throw new IllegalArgumentException("Interfaces cannot be zero"); int len = intarr.length; for (int i = 0; i < len; i++) { WSDLInterface intf = intarr[i]; createSEIFile(intf, loc); } } private String getReturnType(QName xmlName, QName xmlType, XSTypeDefinition xt) throws IOException { String containingElement = xmlName.getLocalPart(); String arraySuffix = ""; boolean primitive = true; JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI()); ReturnTypeUnwrapper unwrapper = new ReturnTypeUnwrapper(xmlType, xsmodel, isWrapped()); if (unwrapper.unwrap()) { // Need to generate wrapper class as well. if (xt instanceof XSComplexTypeDefinition) generateJavaSource((XSComplexTypeDefinition)xt, xsmodel, containingElement); if (unwrapper.unwrappedElement != null) { XSElementDeclaration element = unwrapper.unwrappedElement; xt = element.getTypeDefinition(); primitive = unwrapper.primitive; if (unwrapper.xmlType != null) xmlType = unwrapper.xmlType; containingElement = containingElement + ToolsUtils.firstLetterUpperCase(unwrapper.unwrappedElement.getName()); if (unwrapper.array) arraySuffix = "[]"; } } WrappedArray wrappedArray = new WrappedArray(xt); if (wrappedArray.unwrap()) { xt = wrappedArray.xt; xmlType = wrappedArray.xmlType; primitive = !wrappedArray.nillable; arraySuffix = wrappedArray.suffix; } if (xt instanceof XSSimpleTypeDefinition) xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt); Class cls = getJavaType(xmlType, primitive); if (xt instanceof XSComplexTypeDefinition) generateJavaSource((XSComplexTypeDefinition)xt, xsmodel, containingElement); if (cls == null) { String className; if (xt.getAnonymous() == true) { className = containingElement; } else { className = xmlType.getLocalPart(); } if (className.charAt(0) == '>') className = className.substring(1); className = ToolsUtils.convertInvalidCharacters(className); className = utils.firstLetterUpperCase(className); String packageName = getPackageName(xt.getNamespace()); return packageName + "." + className + arraySuffix; } if (cls.isArray()) return JavaUtils.getSourceName(cls); return cls.getName() + arraySuffix; } private void checkTypeMapping() { if (typeMapping == null) throw new WSException("TypeMapping has not been set."); } private Class getJavaType(QName qname, boolean primitive) { Class cls = typeMapping.getJavaType(qname, primitive); /** * Special case - when qname=xsd:anyType && cls == Element * then cls has to be javax.xml.soap.SOAPElement */ if (qname.getNamespaceURI().equals(Constants.NS_SCHEMA_XSD) && "anyType".equals(qname.getLocalPart()) && cls == Element.class) cls = SOAPElement.class; return cls; } /** * Make sure the first character is lower case and if the * parameter is a reserved word prefix it with '_'. * * @param containingElement * @return */ private String getMethodParam(String name) { String paramName = ToolsUtils.firstLetterLowerCase(name); if (JavaKeywords.isJavaKeyword(paramName)) { paramName = "_" + paramName; } return paramName; } private File getLocationForJavaGeneration(String packageName) { return new File(this.directoryToGenerate + "/" + packageName.replace('.', '/')); } private void generateJavaSource(XSComplexTypeDefinition xt, JBossXSModel xsmodel, String containingElement) throws IOException { generateJavaSource(xt, xsmodel, containingElement, false); } private void generateJavaSource(XSComplexTypeDefinition xt, JBossXSModel xsmodel, String containingElement, boolean exception) throws IOException { XSDTypeToJava xtj = new XSDTypeToJava(); xtj.setTypeMapping(this.typeMapping); String targetNS = wsdl.getTargetNamespace(); String tgtNS = xt.getNamespace(); String packName = getPackageName(tgtNS); if(!tgtNS.equals(targetNS)) { File dir = utils.createPackage(this.directoryToGenerate, packName); } xtj.createJavaFile((XSComplexTypeDefinition)xt, containingElement, getLocationForJavaGeneration(packName), packName, xsmodel, exception); } public void setParameterStyle(String paramStyle) { this.parameterStyle = paramStyle; } private String getPackageName(String targetNamespace) { //Get it from global config if (namespacePackageMap != null) { String pkg = namespacePackageMap.get(targetNamespace); if (pkg != null) { return pkg; } } //return NamespacePackageMapping.getJavaPackageName(targetNamespace); //Default behaviour will always generate all classes in the SEI package only return seiPkgName; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/JavaToWSDL11.java0000644000175000017500000001404010561611275030225 0ustar godgod/* * 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.tools; import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.xml.rpc.encoding.TypeMapping; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.tools.helpers.JavaToWSDLHelper; /** * Java To WSDL11 Converter * @author Anil Saldhana * @since Jul 24, 2005 */ public class JavaToWSDL11 { // provide logging private static final Logger log = Logger.getLogger(JavaToWSDL11.class); // The required wsdl namespace URI private final String wsdlNamespace = Constants.NS_WSDL11; /** Features as represented by Constants*/ private HashMap features = new HashMap(); // A Map of package/namespace mapping that needs to be passed onto types generator private Map packageNamespaceMap = null; private TypeMapping typeMapping = null; private JavaWsdlMapping javaWsdlMapping = null; private UnifiedMetaData umd = null; private boolean qualifiedElements = false; /** * Default Constructor */ public JavaToWSDL11() { if(log.isDebugEnabled()) log.debug("Creating JavaToWSDL11 instance"); } /** * Add a feature to this subsystem * @see org.jboss.ws.tools.WSToolsConstants * @param name * @param value */ public void addFeature(String name, boolean value) { features.put(name, new Boolean(value)); } /** * Append features * @see org.jboss.ws.tools.WSToolsConstants * @param map */ public void addFeatures(Map map) { features.putAll(map); } /** * Return a feature if set * @see org.jboss.ws.tools.WSToolsConstants * @param name * @return boolean value representing the feature, if not * @throws IllegalStateException Feature unrecognized */ public boolean getFeature(String name) { Boolean val = features.get(name); if (val != null) return val.booleanValue(); throw new WSException("Feature unrecognized"); } /** * A customized Package->Namespace map * * @param map */ public void setPackageNamespaceMap(Map map) { packageNamespaceMap = map; } /** * During the WSDL generation process, a typeMapping will be * created that maps xml types -> java types * * @return typeMapping * @exception IllegalStateException If typeMapping has not been generated */ public TypeMapping getTypeMapping() { if (typeMapping == null) throw new WSException("TypeMapping has not been generated"); return typeMapping; } /** * Clients of Tools can build a UnifiedMetaData externally * and pass it to the Java To WSDL subsystem [Optional] * * @param um */ public void setUnifiedMetaData(UnifiedMetaData um) { this.umd = um; } /** * Generate the common WSDL definition for a given endpoint */ public WSDLDefinitions generate(Class endpoint) { WSDLDefinitions wsdl = null; if (umd != null) { JavaToWSDLHelper helper = new JavaToWSDLHelper(); try { helper.setPackageNamespaceMap(packageNamespaceMap); wsdl = handleJavaToWSDLGeneration(helper, endpoint.getName()); typeMapping = helper.getTypeMapping(); } catch (IOException e) { log.error("Error during Java->WSDL generation:", e); } } // This is somewhat of a hack if (qualifiedElements) { JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()); if (schemaModel != null) schemaModel.setQualifiedElements(true); } return wsdl; } public boolean isQualifiedElements() { return qualifiedElements; } public void setQualifiedElements(boolean qualifiedElements) { this.qualifiedElements = qualifiedElements; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } //PRIVATE METHODS private WSDLDefinitions handleJavaToWSDLGeneration(JavaToWSDLHelper helper, String endpointName) throws IOException { WSDLDefinitions wsdl = null; if (umd == null) throw new WSException("Unified Meta Data Model is null"); for (ServiceMetaData service : umd.getServices()) { EndpointMetaData epMetaData = service.getEndpointByServiceEndpointInterface(endpointName); if (epMetaData != null) { wsdl = helper.generate(service); break; } } javaWsdlMapping = helper.getJavaWsdlMapping(); return wsdl; } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/exceptions/0000755000175000017500000000000010755000263027516 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/exceptions/JBossWSToolsException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/exceptions/JBossWSTool0000644000175000017500000000331310542776150031602 0ustar godgod/* * 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.tools.exceptions; /** * General JBossWS Tools Exception * @author Anil Saldhana * @since Jul 23, 2005 */ public class JBossWSToolsException extends Exception { /** * Default CTR */ public JBossWSToolsException() { super(); } /** * @param arg0 Message * @param arg1 Throwable Object */ public JBossWSToolsException(String arg0, Throwable arg1) { super(arg0, arg1); } /** * @param arg0 Message */ public JBossWSToolsException(String arg0) { super(arg0); } /** * @param arg0 Throwable Object */ public JBossWSToolsException(Throwable arg0) { super(arg0); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/WebservicesXMLCreatorImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/WebservicesXMLCreatorI0000644000175000017500000001531410650145103031554 0ustar godgod/* * 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.tools; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.tools.interfaces.WebservicesXMLCreator; import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData; import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData; import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory; import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.w3c.dom.Element; /** * Creates the webservices.xml deployment descriptor * @author Anil Saldhana * @since Jun 20, 2005 */ public class WebservicesXMLCreatorImpl implements WebservicesXMLCreator { // provide logging protected static final Logger log = Logger.getLogger(WebservicesXMLCreatorImpl.class); protected String targetNamespace = null; protected String seiName = null; protected String portName = null; protected String serviceName = null; protected String servletLink = null; protected String ejbLink = null; protected String wsdlFile = null; protected String mappingFile = null; protected boolean append = false; public WebservicesXMLCreatorImpl() { } public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; } public void setSeiName(String seiName) { this.seiName = seiName; } public void setPortName(String portName) { this.portName = portName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public void setEjbLink(String ejbLink) { this.ejbLink = ejbLink; } public void setServletLink(String servletLink) { this.servletLink = servletLink; } public void setMappingFile(String mappingFile) { this.mappingFile = mappingFile; } public void setWsdlFile(String wsdlFile) { this.wsdlFile = wsdlFile; } public void setAppend(boolean append) { this.append = append; } public void generateWSXMLDescriptor(File wsXmlFile) throws IOException { WebservicesMetaData webservices = constructWSMetaData(); // handle append flag if (append && wsXmlFile.exists()) { WebservicesMetaData existingWebservices; // parse existing webservices descriptor InputStream wsXmlStream = new FileInputStream(wsXmlFile); try { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); ObjectModelFactory factory = new WebservicesFactory(wsXmlFile.toURL()); existingWebservices = (WebservicesMetaData)unmarshaller.unmarshal(wsXmlStream, factory, null); } catch (JBossXBException e) { throw new WSException("Could not unmarshal existing webservices descriptor: " + wsXmlFile, e); } finally { wsXmlStream.close(); } // append generated webservice-descriptions to existing descriptor for (WebserviceDescriptionMetaData webserviceDescription : webservices.getWebserviceDescriptions()) existingWebservices.addWebserviceDescription(webserviceDescription); webservices = existingWebservices; } // (re-)write generated webservices descriptor to file Element root = DOMUtils.parse(webservices.serialize()); FileWriter fwriter = new FileWriter(wsXmlFile); new DOMWriter(fwriter).setPrettyprint(true).print(root); fwriter.close(); } //PRIVATE METHODS private WebservicesMetaData constructWSMetaData() { WebservicesMetaData wm = new WebservicesMetaData(); WebserviceDescriptionMetaData wsdm = new WebserviceDescriptionMetaData(wm); populateWebserviceDescriptionMetaData(wsdm); wm.addWebserviceDescription(wsdm); return wm; } private void populateWebserviceDescriptionMetaData(WebserviceDescriptionMetaData wsdm) { checkEssentials(); wsdm.setWebserviceDescriptionName(this.serviceName); wsdm.setWsdlFile(this.wsdlFile); wsdm.setJaxrpcMappingFile(this.mappingFile); PortComponentMetaData pm1 = new PortComponentMetaData(wsdm); pm1.setPortComponentName(portName); pm1.setWsdlPort(new QName(this.targetNamespace, portName, "portNS")); pm1.setServiceEndpointInterface(seiName); if (this.servletLink != null && this.servletLink.length() > 0) pm1.setServletLink(this.servletLink); else pm1.setEjbLink(this.ejbLink); wsdm.addPortComponent(pm1); } private void checkEssentials() { if (serviceName == null) throw new WSException("serviceName is null"); if (wsdlFile == null) throw new WSException("wsdlFile is null"); if (mappingFile == null) throw new WSException("mappingFile is null"); if (targetNamespace == null) throw new WSException("targetNamespace is null"); if (portName == null) throw new WSException("portName is null"); if (seiName == null) throw new WSException("seiName is null"); if (servletLink == null && ejbLink == null) throw new WSException("Either servletLink or ejbLink should not be null"); if (servletLink != null && ejbLink != null) throw new WSException("One of servletLink or ejbLink should be null"); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/XMLNameUtil.java0000644000175000017500000000310110542776150030303 0ustar godgod/* * 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.tools; // $Id: XMLNameUtil.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; /** * Translates XML names to Java and back * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class XMLNameUtil { /** * Translate a Java name to an XML name. * [TODO] */ public static String toXMLName(String javaName) { return javaName; } /** * Translate an XML name to a Java name. * [TODO] */ public static String toJavaName(QName xmlName) { return xmlName.getLocalPart(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/NamespacePackageMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/NamespacePackageMappin0000644000175000017500000002025410573014651031604 0ustar godgod/* * 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.tools; import java.util.HashSet; import java.util.Set; /** * Utility class for mapping an XML namespace to a Java package. * * This mapping is performed according to the algorith defined in section D.5.1 * of the JAXB 2.0 specification. * * @author darran.lofthouse@jboss.com * @since 18-Jul-2006 */ public class NamespacePackageMapping { private static final NamespacePackageMapping npm = new NamespacePackageMapping(); /* * The JAXB specification says to use the list of country codes as defined in ISO-3166 1981 to identify the top * level domains. * * The recommendations in the Java Language Specification for selecting unique package names is based around * choosing package names using the domain name of your organisation. * * Not all countries use the country code listed in ISO-3166 as their top level domain. As an example 'The United * Kingdom of Great Britain and Northern Ireland' uses .uk as the top level domain, however ISO-3166 lists the * country code as gb. * * For this reason I have used the list of country codes available from here: - * * http://www.iana.org/cctld/cctld-whois.htm */ private final String[] countryCodesArray = { "ac", "ad", "ae", "af", "ag", "ai", "al", "am", "an", "ao", "aq", "ar", "as", "at", "au", "aw", "az", "ax", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo", "br", "bs", "bt", "bv", "bw", "by", "bz", "ca", "cc", "cd", "cf", "cg", "ch", "ci", "ck", "cl", "cm", "cn", "co", "cr", "cs", "cu", "cv", "cx", "cy", "cz", "de", "dj", "dk", "dm", "do", "dz", "ec", "ee", "eg", "eh", "er", "es", "et", "eu", "fi", "fj", "fk", "fm", "fo", "fr", "ga", "gb", "gd", "ge", "gf", "gg", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr", "gs", "gt", "gu", "gw", "gy", "hk", "hm", "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "io", "iq", "ir", "is", "it", "je", "jm", "jo", "jp", "ke", "kg", "kh", "ki", "km", "kn", "kp", "kr", "kw", "ky", "kz", "la", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "mg", "mh", "mk", "ml", "mm", "mn", "mo", "mp", "mq", "mr", "ms", "mt", "mu", "mv", "mw", "mx", "my", "mz", "na", "nc", "ne", "nf", "ng", "ni", "nl", "no", "np", "nr", "nu", "nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pm", "pn", "pr", "ps", "pt", "pw", "py", "qa", "re", "ro", "ru", "rw", "sa", "sb", "sc", "sd", "se", "sg", "sh", "si", "sj", "sk", "sl", "sm", "sn", "so", "sr", "st", "sv", "sy", "sz", "tc", "td", "tf", "tg", "th", "tj", "tk", "tl", "tm", "tn", "to", "tp", "tr", "tt", "tv", "tw", "tz", "ua", "ug", "uk", "um", "us", "uy", "uz", "va", "vc", "ve", "vg", "vi", "vn", "vu", "wf", "ws", "ye", "yt", "yu", "za", "zm", "zw" }; private final String[] topLevelDomainsArray = { "com", "gov", "net", "org", "edu" }; private final Set topLevelDomains; /** * Convert an XML namespace to a Java package using the algorithm defined in section * D.5.1 of the JAXB specification. * * @param targetNS * @return */ public static String getJavaPackageName(final String targetNS) { return npm.convertNamespaceToPackage(targetNS); } private NamespacePackageMapping() { int topLevelSize = countryCodesArray.length + topLevelDomainsArray.length; topLevelSize = (int)((double)topLevelSize / 0.75) + 1; topLevelDomains = new HashSet(topLevelSize); addAll(topLevelDomains, countryCodesArray); addAll(topLevelDomains, topLevelDomainsArray); } private void addAll(final Set set, final String[] data) { for (String current : data) { set.add(current); } } private String convertNamespaceToPackage(final String targetNS) { String workingNS = targetNS; boolean schemeIsURN = workingNS.startsWith("urn:"); if (workingNS.startsWith("http://")) { workingNS = workingNS.substring(7); } else if (workingNS.startsWith("https://")) { workingNS = workingNS.substring(8); } else if (workingNS.startsWith("urn:")) { workingNS = workingNS.substring(4); } else { throw new IllegalArgumentException("TargetNS should start with http:// / https:// / urn:"); } // Test for an ending .?? .??? or .html boolean hasExtension = workingNS.matches("^.*\\/.*\\.((.{2,3})|(html))$"); if (hasExtension) { workingNS = workingNS.substring(0, workingNS.lastIndexOf(".")); } String[] tokens = workingNS.split("[\\/\\:]+"); if (schemeIsURN) { tokens[0] = tokens[0].replace('-', '.'); } String[] packagePrefix = convertDomainToPackage(tokens[0]); String[] temp = tokens; tokens = new String[packagePrefix.length + temp.length - 1]; System.arraycopy(packagePrefix, 0, tokens, 0, packagePrefix.length); System.arraycopy(temp, 1, tokens, packagePrefix.length, temp.length - 1); StringBuilder packageName = new StringBuilder(); for (int i = 0; i < tokens.length; i++) { String current = tokens[i]; current = current.toLowerCase(); current = convertReserved(current); current = convertStart(current); current = ToolsUtils.convertInvalidCharacters(current); packageName.append(current); if (i < tokens.length - 1) { packageName.append("."); } } return packageName.toString(); } /** * Check if the passed in component is a reserved keyword, * if it is append and underscore and return. */ private String convertReserved(final String component) { String result = component; if (JavaKeywords.isJavaKeyword(result)) { result = result + "_"; } return result; } /** * Check if the first character of the component is a valid character to * start an identifier, if it is not prefix it with an underscore and return. */ private String convertStart(final String component) { String result = component; if (Character.isJavaIdentifierStart(result.charAt(0)) == false) { result = "_" + result; } return result; } /** * Given a domain name split it into the corresponding parts, and convert * into the order suitable for creating a package name. * * The transposition is only performed if the last element is a top level domain * ("com", "gov", "net", "org", "edu" or a country code used as a top level domain). */ private String[] convertDomainToPackage(final String domain) { String[] parts = domain.split("\\."); String[] packge; if (topLevelDomains.contains(parts[parts.length - 1])) { if (parts[0].equals("www")) { packge = new String[parts.length - 1]; } else { packge = new String[parts.length]; } for (int i = 0; i < packge.length; i++) { packge[i] = parts[parts.length - i - 1]; } } else { packge = parts; } return packge; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/0000755000175000017500000000000010755000263026471 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/0000755000175000017500000000000010755000263027432 5ustar godgod././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/ChainedWritableWrapperGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/ChainedWrit0000644000175000017500000000456010626771577031607 0ustar godgod/* * 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.tools.jaxws.impl; import org.jboss.ws.core.jaxws.WrapperGenerator; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class ChainedWritableWrapperGenerator implements WrapperGenerator { private List chain = new ArrayList(); static class Entry { Entry(WritableWrapperGenerator generator, File directory) { this.generator = generator; this.directory = directory; } WritableWrapperGenerator generator; File directory; } public ChainedWritableWrapperGenerator() { } public void reset(ClassLoader loader) { for (Entry entry : chain) entry.generator.reset(loader); } public void write() throws IOException { for (Entry entry : chain) entry.generator.write(entry.directory); } public void generate(FaultMetaData fmd) { for (Entry entry : chain) entry.generator.generate(fmd); } public void generate(ParameterMetaData pmd) { for (Entry entry : chain) entry.generator.generate(pmd); } public void add(WritableWrapperGenerator generator, File directory) { chain.add(new Entry(generator, directory)); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/JBossWSProviderFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/JBossWSProv0000644000175000017500000000302310627222747031527 0ustar godgod/* * 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.tools.jaxws.impl; import org.jboss.wsf.spi.tools.WSContractProvider; import org.jboss.wsf.spi.tools.WSContractProviderFactory; /** * Creates a JBossWS WSContractProvider implementation. * @see org.jboss.ws.tools.jaxws.impl.JBossWSProviderImpl */ public class JBossWSProviderFactoryImpl implements WSContractProviderFactory { public WSContractProvider createProvider(ClassLoader loader) { JBossWSProviderImpl impl = new JBossWSProviderImpl(); impl.setClassLoader(loader); return impl; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/WritableWrapperGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/WritableWra0000644000175000017500000000240110626771577031621 0ustar godgod/* * 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.tools.jaxws.impl; import org.jboss.ws.core.jaxws.WrapperGenerator; import java.io.File; import java.io.IOException; public interface WritableWrapperGenerator extends WrapperGenerator { public void write(File directory) throws IOException; }././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/BytecodeWrapperGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/BytecodeWra0000644000175000017500000000542510627600304031573 0ustar godgod/* * 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.tools.jaxws.impl; import javassist.CannotCompileException; import javassist.NotFoundException; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxws.DynamicWrapperGenerator; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; public class BytecodeWrapperGenerator extends DynamicWrapperGenerator implements WritableWrapperGenerator { private List typeNames = new ArrayList(); PrintStream stream; public BytecodeWrapperGenerator(ClassLoader loader, PrintStream stream) { super(loader); this.stream = stream; prune = false; } @Override public void reset(ClassLoader loader) { super.reset(loader); typeNames.clear(); } @Override public void generate(FaultMetaData fmd) { super.generate(fmd); typeNames.add(fmd.getFaultBeanName()); } @Override public void generate(ParameterMetaData pmd) { super.generate(pmd); typeNames.add(pmd.getJavaTypeName()); } public void write(File directory) throws IOException { if(typeNames.isEmpty()) { System.out.println("No Classes to generate..."); return; } stream.println("Writing Classes:"); for (String name : typeNames) { try { stream.println(name.replace('.', '/') + ".class"); pool.get(name).writeFile(directory.getAbsolutePath()); } catch (CannotCompileException e) { throw new WSException(e); } catch (NotFoundException e) { throw new WSException(e); } } } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/SunRIConsumerFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/SunRIConsum0000644000175000017500000000271110627222747031556 0ustar godgod/* * 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.tools.jaxws.impl; import org.jboss.wsf.spi.tools.WSContractConsumer; import org.jboss.wsf.spi.tools.WSContractConsumerFactory; /** * Creates a WSContractConsumer that delegates to the Sun RI. * * @author Jason T. Greene * @version $Revision:2311 $ */ public class SunRIConsumerFactoryImpl implements WSContractConsumerFactory { public WSContractConsumer createConsumer() { return new SunRIConsumerImpl(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/JBossWSProv0000644000175000017500000001315310703636612031527 0ustar godgod/* * 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.tools.jaxws.impl; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.net.URL; import java.net.URLClassLoader; import org.jboss.ws.WSException; import org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.tools.io.NullPrintStream; import org.jboss.wsf.common.ResourceLoaderAdapter; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.deployment.Deployment; import org.jboss.wsf.spi.deployment.DeploymentModelFactory; import org.jboss.wsf.spi.tools.WSContractProvider; /** * The default WSContractProvider implementation. * * @author Jason T. Greene */ final class JBossWSProviderImpl extends WSContractProvider { private ClassLoader loader; private boolean generateWsdl = false; private boolean generateSource = false; private File outputDir = new File("output"); private File resourceDir = null; private File sourceDir = null; private PrintStream messageStream = NullPrintStream.getInstance(); private void createDirectories(File resourceDir, File sourceDir) { if (!outputDir.exists()) if (!outputDir.mkdirs()) throw new WSException("Could not create directory: " + outputDir); if (generateWsdl && !resourceDir.exists()) if (!resourceDir.mkdirs()) throw new WSException("Could not create directory: " + resourceDir); if (generateSource && !sourceDir.exists()) if (!sourceDir.mkdirs()) throw new WSException("Could not create directory: " + sourceDir); } @Override public void provide(Class endpointClass) { // Use the output directory as the default File resourceDir = (this.resourceDir != null) ? this.resourceDir : outputDir; File sourceDir = (this.sourceDir != null) ? this.sourceDir : outputDir; createDirectories(resourceDir, sourceDir); messageStream.println("Output directory: " + outputDir.getAbsolutePath()); messageStream.println("Source directory: " + sourceDir.getAbsolutePath()); // Create a dummy classloader to catch generated classes ClassLoader loader = new URLClassLoader(new URL[0], this.loader); UnifiedMetaData umd = new UnifiedMetaData(new ResourceLoaderAdapter(loader)); umd.setClassLoader(loader); ChainedWritableWrapperGenerator generator = new ChainedWritableWrapperGenerator(); if (generateSource) generator.add(new SourceWrapperGenerator(loader, messageStream), sourceDir); generator.add(new BytecodeWrapperGenerator(loader, messageStream), outputDir); JAXWSWebServiceMetaDataBuilder builder = new JAXWSWebServiceMetaDataBuilder(); builder.setWrapperGenerator(generator); builder.setGenerateWsdl(generateWsdl); builder.setToolMode(true); builder.setWsdlDirectory(resourceDir); builder.setMessageStream(messageStream); if (generateWsdl) messageStream.println("Generating WSDL:"); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); DeploymentModelFactory factory = spiProvider.getSPI(DeploymentModelFactory.class); Deployment dep = factory.newDeployment("wsprovide-deployment", loader); dep.setRuntimeClassLoader(loader); builder.buildWebServiceMetaData(dep, umd, endpointClass, null); try { generator.write(); } catch (IOException io) { throw new WSException("Could not write output files:", io); } } @Override public void provide(String endpointClass) { try { provide(loader.loadClass(endpointClass)); } catch (ClassNotFoundException e) { throw new WSException("Class not found: " + endpointClass); } } @Override public void setClassLoader(ClassLoader loader) { this.loader = loader; } @Override public void setGenerateWsdl(boolean generateWsdl) { this.generateWsdl = generateWsdl; } @Override public void setOutputDirectory(File directory) { outputDir = directory; } @Override public void setGenerateSource(boolean generateSource) { this.generateSource = generateSource; } @Override public void setResourceDirectory(File directory) { resourceDir = directory; } @Override public void setSourceDirectory(File directory) { sourceDir = directory; } @Override public void setMessageStream(PrintStream messageStream) { this.messageStream = messageStream; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/SourceWrapperGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/SourceWrapp0000755000175000017500000001440710650145103031635 0ustar godgod/* * 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.tools.jaxws.impl; import com.sun.codemodel.*; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxws.AbstractWrapperGenerator; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.wsf.common.JavaUtils; import javax.xml.bind.annotation.*; import javax.xml.namespace.QName; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.List; import java.util.SortedMap; /** * Generates source for wrapper beans * * @author Jason T. Greene * @version $Revision: 3959 $ */ public class SourceWrapperGenerator extends AbstractWrapperGenerator implements WritableWrapperGenerator { private static Logger log = Logger.getLogger(SourceWrapperGenerator.class); private PrintStream stream; private JCodeModel codeModel; public SourceWrapperGenerator(ClassLoader loader, PrintStream stream) { super(loader); this.stream = stream; codeModel = new JCodeModel(); } @Override public void reset(ClassLoader loader) { super.reset(loader); codeModel = new JCodeModel(); } public void write(File directory) throws IOException { stream.println("Writing Source:"); codeModel.build(directory, stream); } public void generate(ParameterMetaData pmd) { List wrappedParameters = pmd.getWrappedParameters(); OperationMetaData operationMetaData = pmd.getOperationMetaData(); if (operationMetaData.isDocumentWrapped() == false) throw new WSException("Operation is not document/literal (wrapped)"); if (wrappedParameters == null) throw new WSException("Cannot generate a type when their is no type information"); String wrapperName = pmd.getJavaTypeName(); if (log.isDebugEnabled()) if(log.isDebugEnabled()) log.debug("Generating wrapper: " + wrapperName); try { JDefinedClass clazz = codeModel._class(wrapperName); addClassAnnotations(clazz, pmd.getXmlName(), pmd.getXmlType(), null); for (WrappedParameter wrapped : wrappedParameters) { addProperty(clazz, wrapped.getType(), wrapped.getName(), wrapped.getVariable()); } } catch (Exception e) { throw new WSException("Could not generate wrapper type: " + wrapperName, e); } } public void generate(FaultMetaData fmd) { String faultBeanName = fmd.getFaultBeanName(); Class exception = fmd.getJavaType(); try { SortedMap> properties = getExceptionProperties(exception); String[] propertyOrder = properties.keySet().toArray(new String[0]); JDefinedClass clazz = codeModel._class(faultBeanName); addClassAnnotations(clazz, fmd.getXmlName(), fmd.getXmlType(), propertyOrder); for (String property : propertyOrder) addProperty(clazz, properties.get(property).getName(), new QName(property), property); } catch (Exception e) { throw new WSException("Could not generate wrapper type: " + faultBeanName, e); } } private static String getterPrefix(Class type) { return Boolean.TYPE == type || Boolean.class == type ? "is" : "get"; } private void addProperty(JDefinedClass clazz, String typeName, QName name, String variable) throws ClassNotFoundException { Class type = JavaUtils.loadJavaType(typeName, loader); JFieldVar field = clazz.field(JMod.PRIVATE, type, variable); JAnnotationUse annotation = field.annotate(XmlElement.class); if (name.getNamespaceURI() != null) annotation.param("namespace", name.getNamespaceURI()); annotation.param("name", name.getLocalPart()); // Add acessor methods JMethod method = clazz.method(JMod.PUBLIC, type, getterPrefix(type) + JavaUtils.capitalize(variable)); method.body()._return(JExpr._this().ref(variable)); method = clazz.method(JMod.PUBLIC, void.class, "set" + JavaUtils.capitalize(variable)); method.body().assign(JExpr._this().ref(variable), method.param(type, variable)); } private static void addClassAnnotations(JDefinedClass clazz, QName xmlName, QName xmlType, String[] propertyOrder) { JAnnotationUse annotation = clazz.annotate(XmlRootElement.class); if (xmlName.getNamespaceURI() != null && xmlName.getNamespaceURI().length() > 0) annotation.param("namespace", xmlName.getNamespaceURI()); annotation.param("name", xmlName.getLocalPart()); annotation = clazz.annotate(XmlType.class); if (xmlType.getNamespaceURI() != null & xmlType.getNamespaceURI().length() > 0) annotation.param("namespace", xmlType.getNamespaceURI()); annotation.param("name", xmlType.getLocalPart()); if (propertyOrder != null) { JAnnotationArrayMember paramArray = annotation.paramArray("propOrder"); for (String property : propertyOrder) paramArray.param(property); } annotation = clazz.annotate(XmlAccessorType.class); annotation.param("value", XmlAccessType.FIELD); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/jaxws/impl/SunRIConsum0000644000175000017500000001371410703636612031556 0ustar godgod/* * 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.tools.jaxws.impl; import com.sun.tools.ws.wscompile.WsimportTool; import org.jboss.ws.tools.io.NullPrintStream; import org.jboss.wsf.spi.tools.WSContractConsumer; import java.io.File; import java.io.PrintStream; import java.net.URL; import java.util.ArrayList; import java.util.List; /** * WSContractConsumer that delegates to the Sun CompileTool. * * @author Jason T. Greene * @author Heiko Braun * @version $Revision: 4747 $ */ public class SunRIConsumerImpl extends WSContractConsumer { private List bindingFiles; private File catalog; private boolean generateSource; private File outputDir = new File("output"); private File sourceDir; private String targetPackage; private PrintStream messageStream; private String wsdlLocation; private List additionalCompilerClassPath = new ArrayList(); private String target = "2.0"; @Override public void setBindingFiles(List bindingFiles) { this.bindingFiles = bindingFiles; } @Override public void setCatalog(File catalog) { this.catalog = catalog; } @Override public void setGenerateSource(boolean generateSource) { this.generateSource = generateSource; } @Override public void setMessageStream(PrintStream messageStream) { this.messageStream = messageStream; } @Override public void setOutputDirectory(File directory) { outputDir = directory; } @Override public void setSourceDirectory(File directory) { sourceDir = directory; } @Override public void setTargetPackage(String targetPackage) { this.targetPackage = targetPackage; } @Override public void setWsdlLocation(String wsdlLocation) { this.wsdlLocation = wsdlLocation; } public void setAdditionalCompilerClassPath(List additionalCompilerClassPath) { this.additionalCompilerClassPath = additionalCompilerClassPath; } public void setTarget(String target) { this.target = target; } @Override public void consume(URL wsdl) { List args = new ArrayList(); if (bindingFiles != null) { for (File file : bindingFiles) { args.add("-b"); args.add(file.getAbsolutePath()); } } if (catalog != null) { args.add("-catalog"); args.add(catalog.getAbsolutePath()); } if (generateSource) { args.add("-keep"); if (sourceDir != null) { if (!sourceDir.exists() && !sourceDir.mkdirs()) throw new IllegalStateException("Could not make directory: " + sourceDir.getName()); args.add("-s"); args.add(sourceDir.getAbsolutePath()); } } if (targetPackage != null) { args.add("-p"); args.add(targetPackage); } if (wsdlLocation != null) { args.add("-wsdllocation"); args.add(wsdlLocation); } PrintStream stream = messageStream; if (stream != null) { args.add("-verbose"); } else { stream = NullPrintStream.getInstance(); } if (!outputDir.exists() && !outputDir.mkdirs()) throw new IllegalStateException("Could not make directory: " + outputDir.getName()); // Always add the output directory and the wsdl location args.add("-d"); args.add(outputDir.getAbsolutePath()); // Always set the target if(!target.equals("2.0")) throw new IllegalArgumentException("WSConsume (native) only supports JAX-WS 2.0"); args.add("-target"); args.add(target); // finally the WSDL file args.add(wsdl.toString()); // See WsimportTool#compileGeneratedClasses() if(!additionalCompilerClassPath.isEmpty()) { StringBuffer javaCP = new StringBuffer(); for(String s : additionalCompilerClassPath) { javaCP.append(s).append(File.pathSeparator); } System.setProperty("java.class.path", javaCP.toString()); } try { // enforce woodstox if (null == System.getProperty("javax.xml.stream.XMLInputFactory")) System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory"); WsimportTool compileTool = new WsimportTool(stream); boolean success = compileTool.run(args.toArray(new String[args.size()])); if (!success) throw new IllegalStateException("WsImport invocation failed. Try the verbose switch for more information"); } catch (Throwable t) { if (messageStream != null) { messageStream.println("Failed to invoke WsImport"); t.printStackTrace(messageStream); } else { t.printStackTrace(); } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/io/0000755000175000017500000000000010755000263025744 5ustar godgod././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/io/NullPrintStream.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/io/NullPrintStream.jav0000644000175000017500000000726210703636612031566 0ustar godgod/* * 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.tools.io; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Locale; /** * Print stream singleton that does nothing * * @author richard.opalka@jboss.com * * @since Oct 12, 2007 */ public final class NullPrintStream extends PrintStream { private static final PrintStream instance = new NullPrintStream(); public static PrintStream getInstance() { return instance; } private NullPrintStream() { super(new ByteArrayOutputStream()); } @Override public PrintStream append(char c) { return this; } @Override public PrintStream append(CharSequence csq, int start, int end) { return this; } @Override public PrintStream append(CharSequence csq) { return this; } @Override public boolean checkError() { return false; } @Override public void close() { } @Override public void flush() { } @Override public PrintStream format(Locale l, String format, Object... args) { return this; } @Override public PrintStream format(String format, Object... args) { return this; } @Override public void print(boolean b) { } @Override public void print(char c) { } @Override public void print(char[] s) { } @Override public void print(double d) { } @Override public void print(float f) { } @Override public void print(int i) { } @Override public void print(long l) { } @Override public void print(Object obj) { } @Override public void print(String s) { } @Override public PrintStream printf(Locale l, String format, Object... args) { return this; } @Override public PrintStream printf(String format, Object... args) { return this; } @Override public void println() { } @Override public void println(boolean x) { } @Override public void println(char x) { } @Override public void println(char[] x) { } @Override public void println(double x) { } @Override public void println(float x) { } @Override public void println(int x) { } @Override public void println(long x) { } @Override public void println(Object x) { } @Override public void println(String x) { } @Override protected void setError() { } @Override public void write(byte[] buf, int off, int len) { } @Override public void write(int b) { } @Override public void write(byte[] b) throws IOException { } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/XSDToJava.java0000644000175000017500000001453610613224665027763 0ustar godgod/* * 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.tools; import java.io.File; import java.io.IOException; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSLoader; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSObject; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.ws.Constants; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.ws.tools.interfaces.XSDToJavaIntf; /** * Generates Java Types given a schema file * @author Anil Saldhana * @since May 11, 2005 */ public class XSDToJava implements XSDToJavaIntf { /** * Singleton class that handle many utility functions */ protected WSDLUtils utils = WSDLUtils.getInstance(); /** * Utility class that converts a XSD Type into a Java class */ protected XSDTypeToJava xsdJava = new XSDTypeToJava(); private LiteralTypeMapping typeMapping = null; /* * @see org.jboss.ws.tools.interfaces.JavaToXSDIntf#generateSEI(java.lang.String, java.io.File, java.lang.String, boolean) */ public void generateJavaSource(String schemaFile, File dirloc, String packageName, boolean createPackageDir) throws IOException { XSLoader xsloader = SchemaUtils.getInstance().getXSLoader(); XSModel xsmodel = xsloader.loadURI(schemaFile); if (createPackageDir) dirloc = utils.createPackage(dirloc.getAbsolutePath(), packageName); generateJavaSource(xsmodel, dirloc, packageName); } /* * @see org.jboss.ws.tools.interfaces.JavaToXSDIntf#generateSEI(org.apache.xerces.xs.XSModel, java.io.File, java.lang.String, boolean) */ public void generateJavaSource(XSModel xsmodel, File dirloc, String packageName, boolean createPackageDir) throws IOException { if (createPackageDir) dirloc = utils.createPackage(dirloc.getAbsolutePath(), packageName); generateJavaSource(xsmodel, dirloc, packageName); } /* * @see org.jboss.ws.tools.interfaces.JavaToXSDIntf#generateSEI(org.apache.xerces.xs.XSModel, java.io.File, java.lang.String) */ public void generateJavaSource(XSModel xsmodel, File dirloc, String packageName) throws IOException { //Now that we have the schema, lets build the types for the schema XSNamedMap xsnamedmap = xsmodel.getComponents(XSConstants.TYPE_DEFINITION); int len = xsnamedmap != null ? xsnamedmap.getLength() : 0; for (int i = 0; i < len; i++) { XSObject type = xsnamedmap.item(i); if (type instanceof XSComplexTypeDefinition) { XSComplexTypeDefinition ctype = (XSComplexTypeDefinition)type; //Ignore xsd:anyType String nsuri = type.getNamespace(); String tname = type.getName(); if (Constants.NS_SCHEMA_XSD.equals(nsuri) && "anyType".equals(tname)) continue; checkXSDTypeToJava(); xsdJava.createJavaFile(ctype, dirloc, packageName, xsmodel); } else if (type instanceof XSSimpleTypeDefinition) { XSSimpleTypeDefinition stype = (XSSimpleTypeDefinition)type; //Ignore xsd:anyType String nsuri = type.getNamespace(); String tname = type.getName(); if (Constants.NS_SCHEMA_XSD.equals(nsuri) && "anyType".equals(tname)) continue; checkXSDTypeToJava(); xsdJava.createJavaFile(stype, dirloc, packageName, xsmodel); } } //Consider Global Element Declarations that may have anonymous complex types xsnamedmap = xsmodel.getComponents(XSConstants.ELEMENT_DECLARATION); len = xsnamedmap != null ? xsnamedmap.getLength() : 0; for (int i = 0; i < len; i++) { XSElementDeclaration elm = (XSElementDeclaration)xsnamedmap.item(i); String elmname = elm.getName(); XSTypeDefinition elmtype = elm.getTypeDefinition(); if (elmtype != null && elmtype instanceof XSComplexTypeDefinition) { XSComplexTypeDefinition ctype = (XSComplexTypeDefinition)elmtype; String nsuri = elmtype.getNamespace(); String tname = elmtype.getName(); if (tname != null) continue; //Consider only anon complex types createJavaFile(ctype, dirloc, packageName, xsmodel, elmname); } } } /** * Set the type mapping to be used in the generation * * @param tm */ public void setTypeMapping(LiteralTypeMapping tm) { this.typeMapping = tm; } private void createJavaFile(XSComplexTypeDefinition type, File loc, String pkgname, XSModel schema, String outerElementName) throws IOException { String str = "Method should be used for anon complex types only"; if (type.getName() != null) throw new IllegalArgumentException(str); checkXSDTypeToJava(); xsdJava.createJavaFile(type,outerElementName, loc,pkgname,schema, false); } private void checkXSDTypeToJava() { if(xsdJava == null) xsdJava = new XSDTypeToJava(); xsdJava.setTypeMapping(typeMapping); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/schema/0000755000175000017500000000000010755000263026575 5ustar godgod././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/schema/SchemaTypeCreator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/schema/SchemaTypeCreat0000644000175000017500000010043210571617734031556 0ustar godgod/* * 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.tools.schema; import java.beans.BeanInfo; import java.beans.IndexedPropertyDescriptor; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; import javax.ejb.SessionBean; import javax.xml.namespace.QName; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.core.jaxrpc.ParameterWrapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping; import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSComplexTypeDefinition; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSElementDeclaration; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModelGroup; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSParticle; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSSimpleTypeDefinition; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSTypeDefinition; import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.ws.tools.interfaces.SchemaCreatorIntf; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.SimpleTypeBindings; /** * Implementation for creation of schema types * @author Anil Saldhana * @since Aug 31, 2005 */ public class SchemaTypeCreator implements SchemaCreatorIntf { protected Logger log = Logger.getLogger(SchemaTypeCreator.class); protected WSDLUtils utils = WSDLUtils.getInstance(); protected SchemaUtils schemautils = SchemaUtils.getInstance(); protected WSSchemaUtils sutils = null; protected LiteralTypeMapping typeMapping = new LiteralTypeMapping(); // Zero or more namespace definitions private NamespaceRegistry namespaces = null; private JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping(); protected String xsNS = Constants.NS_SCHEMA_XSD; private int maxPrefix = 1; protected JBossXSModel xsModel = null; //A Map of custom package->namespace mapping provided by the user protected Map packageNamespaceMap = new HashMap(); public SchemaTypeCreator() { xsModel = new JBossXSModel(); namespaces = xsModel.getNamespaceRegistry(); sutils = WSSchemaUtils.getInstance(namespaces, null); } /* (non-Javadoc) * @see org.jboss.ws.tools.schema.SchemaCreatorIntf#addPackageNamespaceMapping( java.lang.String,java.lang.String) */ public void addPackageNamespaceMapping(String pkgname, String ns) { if (pkgname == null) throw new IllegalArgumentException("Illegal Null Argument:pkgname"); if (ns == null) throw new IllegalArgumentException("Illegal Null Argument:ns"); packageNamespaceMap.put(pkgname, ns); } public JBossXSTypeDefinition generateType(QName xmlType, Class javaType) { return generateType(xmlType, javaType, null); } public JBossXSTypeDefinition generateType(QName xmlType, Class javaType, Map elementNames) { return getType(xmlType, javaType, elementNames); } public QName getXMLSchemaType(Class javaType) { QName xmlt = schemautils.getToolsOverrideInTypeMapping(javaType); //Check if it is already registered if (xmlt == null) xmlt = typeMapping.getXMLType(javaType, false); return xmlt; } public JavaWsdlMapping getJavaWsdlMapping() { return javaWsdlMapping; } /* (non-Javadoc) * @see org.jboss.ws.tools.schema.SchemaCreatorIntf#getXSModel() */ public JBossXSModel getXSModel() { return xsModel; } /* (non-Javadoc) * @see org.jboss.ws.tools.schema.SchemaCreatorIntf#getCustomNamespaceMap() */ public HashMap getCustomNamespaceMap() { HashMap map = null; if (namespaces != null) { Iterator iter = namespaces.getRegisteredPrefixes(); while (iter != null && iter.hasNext()) { String prefix = (String)iter.next(); if (prefix.startsWith("ns")) { if (map == null) map = new HashMap(); map.put(prefix, namespaces.getNamespaceURI(prefix)); } } } return map; } /* (non-Javadoc) * @see org.jboss.ws.tools.schema.SchemaCreatorIntf#getPackageNamespaceMap() */ public Map getPackageNamespaceMap() { return this.packageNamespaceMap; } /* (non-Javadoc) * @see org.jboss.ws.tools.schema.SchemaCreatorIntf#getTypeMapping() */ public LiteralTypeMapping getTypeMapping() { return typeMapping; } /* (non-Javadoc) * @see org.jboss.ws.tools.schema.SchemaCreatorIntf#getJavaType(javax.xml.namespace.QName) */ public Class getJavaType(QName xmlType) { Class retType = typeMapping.getJavaType(xmlType); if (retType == null) throw new IllegalArgumentException("Unsupported type: " + xmlType); return retType; } /* (non-Javadoc) * @see org.jboss.ws.tools.schema.SchemaCreatorIntf#setXSModel(org.jboss.ws.wsdl.xmlschema.JBossXSModel) */ public void setXSModel(JBossXSModel xsm) { xsModel = xsm; } /** * If there is a type being used from a different namespace, a custom * prefix will be needed * @param nsuri * @return New Prefix */ public String allocatePrefix(String nsURI) { String prefix = namespaces.getPrefix(nsURI); return (prefix == null) ? namespaces.registerURI(nsURI, null) : prefix; } /* (non-Javadoc) * @see org.jboss.ws.tools.schema.SchemaCreatorIntf#setPackageNamespaceMap(java.util.Map) */ public void setPackageNamespaceMap(Map packageNamespaceMap) { this.packageNamespaceMap = packageNamespaceMap; } //PRIVATE METHODS private JBossXSTypeDefinition checkTypeExistsInXSModel(QName xmlt) { JBossXSTypeDefinition ct = null; if (xmlt != null && xsModel != null) ct = getXSTypeDefinitionIfPresent(xmlt); return ct; } private JBossXSTypeDefinition getType(QName xmlType, Class javaType, Map elementNames) { JBossXSTypeDefinition ct = null; boolean registered = false; // Step 1: Check if the javaType is registered in the typeMapping if (xmlType == null) { xmlType = getXMLSchemaType(javaType); registered = xmlType != null; } else { registered = typeMapping.isRegistered(javaType, xmlType); } // Step 2: if the javatype is registered, search the xsmodel to obtain the type if (registered) ct = checkTypeExistsInXSModel(xmlType); // If the type is still unavailable, see xmlt represents schema basic type if (ct == null && xmlType != null && Constants.NS_SCHEMA_XSD.equals(xmlType.getNamespaceURI()) && !javaType.isArray()) ct = schemautils.getSchemaBasicType(xmlType.getLocalPart()); if (ct == null && Exception.class.isAssignableFrom(javaType)) ct = this.getComplexTypeForJavaException(xmlType, javaType); // Step 3: If the type does not exist in the xsmodel, create a new type if (ct == null) ct = generateNewType(xmlType, javaType, elementNames); return ct; } private JBossXSTypeDefinition getXSTypeDefinitionIfPresent(QName qname) { return (JBossXSTypeDefinition)xsModel.getTypeDefinition(qname.getLocalPart(), qname.getNamespaceURI()); } private JBossXSTypeDefinition generateNewType(QName xmlType, Class javaType, Map elementNames) { //Step 1: Take care of superclass (if any)::Generate Type for the base class, if any Class superclass = javaType.getSuperclass(); JBossXSTypeDefinition baseType = null; List particles = new ArrayList(); if (superclass != null && !utils.checkIgnoreClass(superclass)) { baseType = generateType(null, superclass); if (baseType != null) { addBaseTypeParts(baseType, particles); } } //Check if the javaType is an array if (javaType.isArray()) return handleArray(xmlType, javaType); String name; String namespace; if (xmlType != null) { name = xmlType.getLocalPart(); namespace = xmlType.getNamespaceURI(); } else { name = WSDLUtils.getJustClassName(javaType); namespace = getNamespace(javaType); } // Check if it is a JAX-RPC enumeration Class valueType = getEnumerationValueType(javaType); if (valueType != null) return handleJAXRPCEnumeration(name, namespace, javaType, valueType); // Generate and register the complex type before building it's particles // This solves circular reference problems JBossXSComplexTypeDefinition complexType = sutils.createXSComplexTypeDefinition(name, baseType, particles, namespace); QName registerQName = new QName(namespace, name); typeMapping.register(javaType, registerQName, null, null); xsModel.addXSComplexTypeDefinition(complexType); //Step 2: Generate XSParticles for all the public fields particles.addAll(getXSParticlesForPublicFields(namespace, javaType, elementNames)); //Step 3: Generate XSParticles for the properties try { particles.addAll(introspectJavaProperties(namespace, javaType, elementNames)); } catch (IntrospectionException e) { log.error("Problem in introspection of the Java Type during type generation", e); throw new WSException(e); } if (elementNames instanceof LinkedHashMap) particles = sortNamedOuterParticles(particles, (LinkedHashMap)elementNames); else Collections.sort((List)particles); registerJavaTypeMapping(registerQName, javaType, "complexType", particles, elementNames); JBossXSModelGroup group = (JBossXSModelGroup)complexType.getParticle().getTerm(); group.setParticles(particles); if (log.isDebugEnabled()) log.debug("generateNewType: " + sutils.write(complexType)); return complexType; } private JBossXSTypeDefinition handleJAXRPCEnumeration(String name, String namespace, Class javaType, Class valueType) { JBossXSTypeDefinition enumType = generateType(null, valueType); JBossXSSimpleTypeDefinition simpleType = new JBossXSSimpleTypeDefinition(); simpleType.setBaseType(enumType); simpleType.setName(name); simpleType.setNamespace(namespace); try { Method getValue = javaType.getMethod("getValue"); for (Field field : javaType.getFields()) { if (Modifier.isStatic(field.getModifiers()) && field.getType().equals(javaType)) { Object ret = getValue.invoke(field.get(null)); String item = SimpleTypeBindings.marshal(enumType.getName(), ret, new NamespaceRegistry()); simpleType.addLexicalEnumeration(item); } } } catch (Exception e) { throw new WSException("JAX-RPC Enumeration type did not conform to expectations"); } xsModel.addXSTypeDefinition(simpleType); registerJavaTypeMapping(new QName(namespace, name), javaType, "simpleType", new ArrayList(), null); return simpleType; } private Class getEnumerationValueType(Class javaType) { try { javaType.getConstructor(); return null; } catch (NoSuchMethodException e) { } for (Method method : javaType.getMethods()) { if (Modifier.isStatic(method.getModifiers()) && method.getName().equals("fromValue") && method.getParameterTypes().length == 1) return method.getParameterTypes()[0]; } return null; } private List sortNamedOuterParticles(List particles, LinkedHashMap elementNames) { Map index = new LinkedHashMap(); List newList = new ArrayList(); for (XSParticle particle : particles) { XSTerm term = particle.getTerm(); if (term instanceof XSElementDeclaration) index.put(((XSElementDeclaration)term).getName(), particle); else newList.add(particle); } // Follow the order of elementNames for (QName name : elementNames.values()) { XSParticle found = index.get(name.getLocalPart()); if (found != null) { index.remove(name.getLocalPart()); newList.add(found); } } // Add everything else for (XSParticle particle : index.values()) { newList.add(particle); } return newList; } private void registerJavaTypeMapping(QName registerQName, Class javaType, String scope, List particles, Map elementNames) { QName qname = new QName(registerQName.getNamespaceURI(), registerQName.getLocalPart(), "typeNS"); // Add package mapping if needed String packageName = javaWsdlMapping.getPackageNameForNamespaceURI(qname.getNamespaceURI()); if (packageName == null && javaType.getPackage() != null) { PackageMapping packageMapping = new PackageMapping(javaWsdlMapping); packageMapping.setNamespaceURI(qname.getNamespaceURI()); packageMapping.setPackageType(javaType.getPackage().getName()); javaWsdlMapping.addPackageMapping(packageMapping); } JavaXmlTypeMapping javaXmlTypeMapping = new JavaXmlTypeMapping(javaWsdlMapping); javaXmlTypeMapping.setJavaType(javaType.getName()); javaXmlTypeMapping.setQNameScope(scope); javaXmlTypeMapping.setRootTypeQName(qname); // JSR-109 specifies an element name as a string, not a qname, so we need to strip the namespace Map reversedNames = null; if (elementNames != null) { reversedNames = new HashMap(); for (String variable : elementNames.keySet()) reversedNames.put(elementNames.get(variable).getLocalPart(), variable); } addVariableMappings(javaType, javaXmlTypeMapping, particles, reversedNames); javaWsdlMapping.addJavaXmlTypeMappings(javaXmlTypeMapping); } private void addVariableMappings(Class javaType, JavaXmlTypeMapping javaXmlTypeMapping, List particles, Map reversedNames) { for (XSParticle particle : particles) { XSTerm term = particle.getTerm(); if (term.getType() == XSConstants.MODEL_GROUP) { XSModelGroup group = (XSModelGroup)term; XSObjectList list = group.getParticles(); ArrayList baseParticles = new ArrayList(); for (int i = 0; i < list.getLength(); i++) baseParticles.add((XSParticle)list.item(i)); addVariableMappings(javaType, javaXmlTypeMapping, baseParticles, null); continue; } String name = term.getName(); String variableName = name; if (reversedNames != null && reversedNames.get(name) != null) variableName = reversedNames.get(name); VariableMapping mapping = new VariableMapping(javaXmlTypeMapping); mapping.setJavaVariableName(variableName); mapping.setXmlElementName(name); mapping.setDataMember(utils.doesPublicFieldExist(javaType, variableName)); if (isAlreadyMapped(javaXmlTypeMapping, mapping) == false) { javaXmlTypeMapping.addVariableMapping(mapping); } } } private boolean isAlreadyMapped(JavaXmlTypeMapping jxtm, VariableMapping vm) { String javaVariableName = vm.getJavaVariableName(); String attributeName = vm.getXmlAttributeName(); String elementName = vm.getXmlElementName(); for (VariableMapping current : jxtm.getVariableMappings()) { boolean matched = checkStringEquality(javaVariableName, current.getJavaVariableName()); if (matched) { matched = checkStringEquality(attributeName, current.getXmlAttributeName()); } if (matched) { matched = checkStringEquality(elementName, current.getXmlElementName()); } if (matched) { return true; } } return false; } private List getXSParticlesForPublicFields(String typeNamespace, Class javaType, Map elementNames) { List particles = new ArrayList(); for (Field field : utils.getPublicFields(javaType)) { // Skip collections if (Collection.class.isAssignableFrom(field.getType())) { log.warn("JAX-RPC does not allow collection types skipping field: " + javaType.getName() + "." + field.getName()); continue; } JBossXSParticle particle = createFieldParticle(typeNamespace, field.getName(), field.getType(), elementNames); particles.add(particle); } return particles; } private JBossXSTypeDefinition handleArray(QName xmlType, Class javaType) { Class componentType = javaType.getComponentType(); boolean isComponentArray = componentType.isArray(); // Do not allow overrides i.e. byte[][] should not be base64Binary[] JBossXSTypeDefinition xst = (isComponentArray) ? handleArray(null, componentType) : generateType(null, componentType); String name; String namespace; if (xmlType != null) { name = xmlType.getLocalPart(); namespace = xmlType.getNamespaceURI(); } else { if (isComponentArray == false) { name = utils.getJustClassName(componentType.getName()) + ".Array"; namespace = getNamespace(componentType); } else { name = xst.getName() + ".Array"; namespace = xst.getNamespace(); } } JBossXSParticle xsp = new JBossXSParticle(); xsp.setTerm(sutils.createXSElementDeclaration("value", xst, !componentType.isPrimitive())); xsp.setMaxOccurs(-1); List particles = new ArrayList(); particles.add(xsp); JBossXSComplexTypeDefinition complex = sutils.createXSComplexTypeDefinition(name, null, particles, namespace); xsModel.addXSComplexTypeDefinition(complex); typeMapping.register(javaType, new QName(namespace, name), null, null); return complex; } private List introspectJavaProperties(String typeNamespace, Class javaType, Map elementNames) throws IntrospectionException { List xsparts = new ArrayList(); Class superClass = javaType.getSuperclass(); BeanInfo beanInfo = Introspector.getBeanInfo(javaType, superClass); PropertyDescriptor[] props = beanInfo.getPropertyDescriptors(); int len = props != null ? props.length : 0; for (int i = 0; i < len && SessionBean.class.isAssignableFrom(javaType) == false; i++) { PropertyDescriptor prop = props[i]; String fieldname = prop.getName(); Class fieldType = prop.getPropertyType(); if (prop instanceof IndexedPropertyDescriptor && fieldType == null) { log.warn("Indexed Properties without non-indexed accessors are not supported skipping: " + javaType.getName() + "." + fieldname); continue; } // Skip magic work around property used in ParameterWrapping if (fieldType.equals(ParameterWrapping.WrapperType.class)) continue; // Skip collections if (Collection.class.isAssignableFrom(fieldType)) { log.warn("JAX-RPC does not allow collection types skipping: " + javaType.getName() + "." + fieldname); continue; } //Check if the property conflicts with a public member variable if (utils.doesPublicFieldExist(javaType, fieldname)) throw new WSException("Class " + javaType.getName() + " has a public field & property :" + fieldname); JBossXSParticle particle = createFieldParticle(typeNamespace, fieldname, fieldType, elementNames); xsparts.add(particle); } return xsparts; } private JBossXSParticle createFieldParticle(String typeNamespace, String fieldName, Class fieldType, Map elementNames) { // There should be some override mechanism, but we want byte[] to resolve to base64binary (the default) boolean isArray = fieldType.isArray() && fieldType != byte[].class; if (isArray) fieldType = fieldType.getComponentType(); // Do not allow byte[][] to become base64binary[] XSTypeDefinition xst = (isArray && fieldType.isArray()) ? handleArray(null, fieldType) : generateType(null, fieldType); String elementNamespace = null; if (elementNames != null) { QName name = elementNames.get(fieldName); if (name != null) { fieldName = name.getLocalPart(); elementNamespace = name.getNamespaceURI(); if (typeNamespace.equals(elementNamespace)) elementNamespace = null; } } JBossXSElementDeclaration xsel; if (elementNamespace == null || elementNamespace.length() == 0) { xsel = sutils.createXSElementDeclaration(fieldName, xst, !fieldType.isPrimitive()); } else { // If an element has a different namespace than the owning complexType, // then it must be created as a global element in another schema, and then // referenced in the complex type. xsel = sutils.createGlobalXSElementDeclaration(fieldName, xst, elementNamespace); xsModel.addXSElementDeclaration(xsel); } JBossXSParticle particle = sutils.createXSParticle(typeNamespace, isArray, xsel); return particle; } private void addBaseTypeParts(XSTypeDefinition baseType, List xsparts) { if (baseType == null) throw new IllegalArgumentException("Illegal Null Argument:baseType"); if (XSTypeDefinition.COMPLEX_TYPE == baseType.getTypeCategory()) { XSTypeDefinition btype = baseType.getBaseType(); if (btype != null) addBaseTypeParts(btype, xsparts); //Recurse //Just add the particles from this basetype as a ModelGroup sequence XSParticle part = ((XSComplexTypeDefinition)baseType).getParticle(); XSTerm term = part.getTerm(); if (term instanceof XSModelGroup) { JBossXSParticle p = new JBossXSParticle(); p.setTerm(term); xsparts.add(p); } } } private String getNamespace(Class javaType) { if (javaType.isPrimitive()) return Constants.NS_JBOSSWS_URI + "/primitives"; Package javaPackage = javaType.getPackage(); if (javaPackage == null) throw new WSException("Cannot determine namespace, Class had no package"); String packageName = javaPackage.getName(); String ns = packageNamespaceMap.get(packageName); if (ns == null) ns = utils.getTypeNamespace(packageName); allocatePrefix(ns); return ns; } private JBossXSComplexTypeDefinition getComplexTypeForJavaException(QName xmlType, Class javaType) { if (!Exception.class.isAssignableFrom(javaType)) throw new IllegalArgumentException("Type is not an excpetion"); if (RuntimeException.class.isAssignableFrom(javaType)) throw new IllegalArgumentException("JAX-RPC violation, the following exception extends RuntimeException: " + javaType.getName()); String name; String namespace; if (xmlType != null) { namespace = xmlType.getNamespaceURI(); name = xmlType.getLocalPart(); } else { namespace = getNamespace(javaType); name = WSDLUtils.getJustClassName(javaType); } List particles = new ArrayList(0); List types = new ArrayList(0); JBossXSComplexTypeDefinition complexType = new JBossXSComplexTypeDefinition(); complexType.setName(name); complexType.setNamespace(namespace); xsModel.addXSComplexTypeDefinition(complexType); xsModel.addXSElementDeclaration(sutils.createGlobalXSElementDeclaration(name, complexType, namespace)); typeMapping.register(javaType, new QName(namespace, name), null, null); registerJavaTypeMapping(new QName(namespace, name), javaType, "complexType", particles, null); Class superClass = javaType.getSuperclass(); if (!Exception.class.equals(superClass) || Throwable.class.equals(superClass)) { JBossXSTypeDefinition baseType = generateType(null, superClass); complexType.setBaseType(baseType); } generateExceptionParticles(namespace, javaType, types, particles); boolean found = hasConstructor(javaType, types); boolean noarg = found && types.size() == 0; if (!found || noarg) { // Look for a message constructor if a matching constructor could not be found. // We also prefer message constructors over a noarg constructor ArrayList newTypes = new ArrayList(types); newTypes.add(0, String.class); found = hasConstructor(javaType, newTypes); if (found) { insertBaseParticle(particles, "message", String.class, namespace); } else { // If we have a default (0 argument) constructor, fall back to it if (!noarg) throw new IllegalArgumentException("Could not locate a constructor with the following types: " + javaType + ' ' + types); } } complexType.setParticle(createGroupParticle(namespace, particles)); return complexType; } private void insertBaseParticle(List particles, String name, Class type, String targetNS) { if (particles.size() == 0) { particles.add(getXSParticle(name, type, targetNS)); return; } XSParticle particle = particles.get(0); XSTerm term = particle.getTerm(); if (term.getType() == XSConstants.MODEL_GROUP) { JBossXSModelGroup group = (JBossXSModelGroup)term; XSObjectList list = group.getParticles(); ArrayList baseParticles = new ArrayList(); for (int i = 0; i < list.getLength(); i++) baseParticles.add((XSParticle)list.item(i)); insertBaseParticle(baseParticles, name, type, targetNS); if (baseParticles.size() > list.getLength()) group.setParticles(baseParticles); } else { particles.add(0, getXSParticle(name, type, targetNS)); } } private boolean hasConstructor(Class javaType, List types) { boolean found = true; try { javaType.getConstructor(types.toArray(new Class[0])); } catch (NoSuchMethodException e) { found = false; } return found; } private void generateExceptionParticles(String typeNamespace, Class javaType, List types, List particles) { /* * JAX-RPC 1.1 states that properties of an exception are determined by * the combination of a public getter, and a matching constructor. Since * Reflection can not tell us parameter names, the only way to locate the * propper constructor is by type. Since there can be multiple properties * with the same type, we must somehow establish a proper order of the * constructor. Code declaration is not a possibility since this * information is also not retained. This leaves us with only one option, * sorting. * * So the matching constructor must be sorted by two indicies in the * following order: 1. declaring class, super type first 2. property name * in ascending order */ if (Exception.class.equals(javaType)) return; Class superClass = javaType.getSuperclass(); if (!Exception.class.equals(superClass)) { List superParticles = new ArrayList(0); generateExceptionParticles(typeNamespace, superClass, types, superParticles); particles.add(createGroupParticle(typeNamespace, superParticles)); } TreeMap sortedGetters = new TreeMap(); for (Method method : javaType.getDeclaredMethods()) { int modifiers = method.getModifiers(); if ((!Modifier.isPublic(modifiers)) || Modifier.isStatic(modifiers)) continue; String name = method.getName(); Class returnType = method.getReturnType(); if (name.startsWith("get") && returnType != void.class) { name = Introspector.decapitalize(name.substring(3)); sortedGetters.put(name, returnType); } } for (String name : sortedGetters.keySet()) { Class type = sortedGetters.get(name); types.add(type); JBossXSParticle particle = createFieldParticle(typeNamespace, name, type, null); particles.add(particle); } } private JBossXSParticle createGroupParticle(String targetNS, List memberParticles) { JBossXSParticle groupParticle = new JBossXSParticle(null, targetNS); JBossXSModelGroup group = new JBossXSModelGroup(); group.setParticles(memberParticles, false); groupParticle.setTerm(group); return groupParticle; } private JBossXSParticle getXSParticle(String name, Class fieldType, String targetNS) { XSTypeDefinition xstype = null; boolean isArray = fieldType.isArray(); if (isArray) fieldType = fieldType.getComponentType(); xstype = this.generateType(null, fieldType); boolean isNillable = !fieldType.isPrimitive(); JBossXSElementDeclaration xsel = (JBossXSElementDeclaration)sutils.createXSElementDeclaration(name, xstype, isNillable); return sutils.createXSParticle(targetNS, isArray, xsel); } private boolean checkStringEquality(String str1, String str2) { if (str1 == null && str2 == null) return true; if (str1 == null && str2 != null) return false; if (str1 != null && str2 == null) return false; return str1.equals(str2); } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/WSTools.java0000644000175000017500000001131710740456264027567 0ustar godgod/* * 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.tools; // $Id: WSTools.java 5409 2008-01-07 17:09:08Z heiko.braun@jboss.com $ import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.net.URL; import java.net.URLClassLoader; import java.util.StringTokenizer; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.tools.config.ToolsSchemaConfigReader; import org.jboss.ws.tools.helpers.ToolsHelper; /** * Main Class for WSTools * * @author Anil.Saldhana@jboss.org * @author Thomas.Diesler@jboss.org * @since 19-Aug-2005 */ public class WSTools { private static Logger log = Logger.getLogger(WSTools.class); /** * Entry point for the command line scripts. * Just passes the arguments to * @see generate(String) * @param args * @throws IOException */ public static void main(String[] args) throws IOException { WSTools tools = new WSTools(); boolean success = false; try { success = tools.generate(args); } catch (Throwable e) { e.printStackTrace( new PrintWriter(System.err) ); } if(success) System.exit(0); else System.exit(1); } /** * Entry point for the programmatic use */ public boolean generate(String configLocation, String outputDir) throws IOException { ToolsSchemaConfigReader configReader = new ToolsSchemaConfigReader(); Configuration config = configReader.readConfig(configLocation); return process(config, outputDir); } /** * Entry point for the programmatic use */ public boolean generate(String[] args) throws IOException { String configLocation = null; String outputDir = null; if(args.length==0) { usage(); } for (int i = 0; i < args.length; i++) { String arg = args[i]; if ("-config".equals(arg)) { configLocation = args[i + 1]; i++; } else if ("-dest".equals(arg)) { outputDir = args[i + 1]; i++; } else if ("-classpath".equals(arg) || "-cp".equals(arg)) { StringTokenizer st = new StringTokenizer(args[i + 1], File.pathSeparator); int tokens = st.countTokens(); URL[] urls = new URL[tokens]; for (int j = 0; j < tokens; j++) { String token = st.nextToken(); urls[j] = new File(token).toURL(); } ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader urlLoader = new URLClassLoader(urls, ctxLoader); Thread.currentThread().setContextClassLoader(urlLoader); i++; } else { usage(); } } return generate(configLocation, outputDir); } private void usage() { System.out.println("Usage: wstools (-classpath|-cp) -config [-dest ]"); System.exit(1); } private boolean process(Configuration config, String outputDir) throws IOException { if (config == null) throw new IllegalArgumentException("Configuration is null"); if (outputDir == null) outputDir = "."; ToolsHelper helper = new ToolsHelper(); if (config.getJavaToWSDLConfig(false) != null) { helper.handleJavaToWSDLGeneration(config, outputDir); } else if (config.getWSDLToJavaConfig(false) != null) { helper.handleWSDLToJavaGeneration(config, outputDir); } else { throw new IOException("Nothing done, Configuration source must have JavaToWSDL or WSDLToJava specified"); } return true; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/config/0000755000175000017500000000000010755000263026602 5ustar godgod././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/config/ToolsSchemaConfigReader.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/config/ToolsSchemaConf0000644000175000017500000003360210736716066031576 0ustar godgod/* * 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.tools.config; // $Id: ToolsSchemaConfigReader.java 5390 2008-01-02 14:14:14Z mageshbk@jboss.com $ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.tools.Configuration; import org.jboss.ws.tools.Configuration.GlobalConfig; import org.jboss.ws.tools.Configuration.JavaToWSDLConfig; import org.jboss.ws.tools.Configuration.OperationConfig; import org.jboss.ws.tools.Configuration.ParameterConfig; import org.jboss.ws.tools.Configuration.WSDLToJavaConfig; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; /** * Reads the XML configuration file passed to jbossws * @author Anil Saldhana * @author Thomas.Diesler@jboss.org * @since 11-Aug-2005 */ public class ToolsSchemaConfigReader implements ObjectModelFactory { // Tags private static final String PARAMETER_TAG = "parameter"; private static final String WEBSERVICES_TAG = "webservices"; private static final String MAPPING_TAG = "mapping"; private static final String PACKAGE_NAMESPACE_TAG = "package-namespace"; private static final String NAMESPACES_TAG = "namespaces"; private static final String SERVICE_TAG = "service"; private static final String GLOBAL_TAG = "global"; private static final String JAVA_WSDL_TAG = "java-wsdl"; private static final String WSDL_JAVA_TAG = "wsdl-java"; private static final String OPERATION_TAG = "operation"; // Attributes private static final String HEADER_ATTRIBUTE = "header"; private static final String MODE_ATTRIBUTE = "mode"; private static final String XML_NAME_ATTRIBUTE = "xml-name"; private static final String TYPE_ATTRIBUTE = "type"; private static final String NAMESPACE_ATTRIBUTE = "namespace"; private static final String PACKAGE_ATTRIBUTE = "package"; private static final String EJB_LINK_ATTRIBUTE = "ejb-link"; private static final String SERVLET_LINK_ATTRIBUTE = "servlet-link"; private static final String APPEND_ATTRIBUTE = "append"; private static final String TYPE_NAMESPACE_ATTRIBUTE = "type-namespace"; private static final String TARGET_NAMESPACE_ATTRIBUTE = "target-namespace"; private static final String RETURN_XML_NAME_ATTRIBUTE = "return-xml-name"; private static final String ONEWAY_ATTRIBUTE = "one-way"; private static final String PARAMETER_STYLE_ATTRIBUTE = "parameter-style"; private static final String STYLE_ATTRIBUTE = "style"; private static final String ENDPOINT_ATTRIBUTE = "endpoint"; private static final String NAME_ATTRIBUTE = "name"; private static final String LOCATION_ATTRIBUTE = "location"; private static final String FILE_ATTRIBUTE = "file"; // provide logging private static final Logger log = Logger.getLogger(ToolsSchemaConfigReader.class); public ToolsSchemaConfigReader() { } public Configuration readConfig(String configLocation) throws IOException { log.trace("Inside readConfig: " + configLocation); if (configLocation == null) throw new IllegalArgumentException("Config URL passed is null"); URL configURL = null; try { configURL = new URL(configLocation); } catch (MalformedURLException e) { // ignore } if (configURL == null) { File configFile = new File(configLocation); if (configFile.exists()) configURL = configFile.toURL(); } if (configURL == null) { ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); configURL = ctxLoader.getResource(configLocation); } if (configURL == null) throw new IllegalArgumentException("Cannot load config from: " + configLocation); Configuration config = new Configuration(); InputStream is = configURL.openStream(); try { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.setNamespaceAware(true); unmarshaller.setSchemaValidation(true); unmarshaller.setValidation(true); unmarshaller.unmarshal(is, this, config); } catch (JBossXBException ex) { IOException ioex = new IOException("Cannot parse config: " + ex.getMessage()); ioex.initCause(ex); throw ioex; } finally { is.close(); } if (config.getJavaToWSDLConfig(false) == null && config.getWSDLToJavaConfig(false) == null) throw new WSException("Invalid configuration file, either " + JAVA_WSDL_TAG + ", or " + WSDL_JAVA_TAG + " must be present"); log.trace("Exit readConfig"); return config; } public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { if (root instanceof Configuration) return root; else return null; } /** * This method is called by the object model factory and returns the root of the object graph. */ public Object newChild(Configuration config, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { log.trace("Inside newChild:localName=" + localName); if (JAVA_WSDL_TAG.equals(localName)) { JavaToWSDLConfig j2wsdlc = config.getJavaToWSDLConfig(true); return j2wsdlc; } else if (WSDL_JAVA_TAG.equals(localName)) { WSDLToJavaConfig wsdl2jc = config.getWSDLToJavaConfig(true); wsdl2jc.wsdlLocation = attrs.getValue(LOCATION_ATTRIBUTE); String paramStyle = attrs.getValue(PARAMETER_STYLE_ATTRIBUTE); if (paramStyle != null) wsdl2jc.parameterStyle = paramStyle; return wsdl2jc; } else if (GLOBAL_TAG.equals(localName)) { GlobalConfig globalc = config.getGlobalConfig(true); return globalc; } return config; } /** * This method is called by the object model factory and returns the root of the object graph. */ public Object newChild(JavaToWSDLConfig j2wsdlc, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { String errorStr = "Problem parsing tag:" + JAVA_WSDL_TAG; if (SERVICE_TAG.equals(localName)) { j2wsdlc.serviceName = attrs.getValue(NAME_ATTRIBUTE); j2wsdlc.endpointName = attrs.getValue(ENDPOINT_ATTRIBUTE); j2wsdlc.wsdlStyle = getOptionalAttribute(attrs, STYLE_ATTRIBUTE, "document"); j2wsdlc.parameterStyle = getOptionalAttribute(attrs, PARAMETER_STYLE_ATTRIBUTE, "wrapped"); } else if (OPERATION_TAG.equals(localName)) { OperationConfig operation = j2wsdlc.createOperationConfig(); operation.name = attrs.getValue(NAME_ATTRIBUTE); String oneWay = attrs.getValue(ONEWAY_ATTRIBUTE); operation.isOneWay = "true".equals(oneWay) || "1".equals(oneWay); String returnXmlName = attrs.getValue(RETURN_XML_NAME_ATTRIBUTE); if (returnXmlName != null) operation.returnXmlName = navigator.resolveQName(returnXmlName); return operation; } else if (NAMESPACES_TAG.equals(localName)) { errorStr += NAMESPACES_TAG; j2wsdlc.targetNamespace = getNamespace(navigator, TARGET_NAMESPACE_ATTRIBUTE, errorStr, attrs); j2wsdlc.typeNamespace = getNamespace(navigator, TYPE_NAMESPACE_ATTRIBUTE, errorStr, attrs); if (j2wsdlc.typeNamespace == null) j2wsdlc.typeNamespace = j2wsdlc.targetNamespace; } else if (MAPPING_TAG.equals(localName)) { j2wsdlc.mappingFileNeeded = true; j2wsdlc.mappingFileName = getOptionalAttribute(attrs, FILE_ATTRIBUTE, "jaxrpc-mapping.xml"); } else if (WEBSERVICES_TAG.equals(localName)) { j2wsdlc.wsxmlFileNeeded = true; j2wsdlc.servletLink = getOptionalAttribute(attrs, SERVLET_LINK_ATTRIBUTE, null); j2wsdlc.ejbLink = getOptionalAttribute(attrs, EJB_LINK_ATTRIBUTE, null); if (j2wsdlc.ejbLink == null && j2wsdlc.servletLink == null) throw new WSException("Either servletLink or ejbLink should be specified"); String wsxmlFileAppend = attrs.getValue(APPEND_ATTRIBUTE); j2wsdlc.wsxmlFileAppend = "true".equals(wsxmlFileAppend) || "1".equals(wsxmlFileAppend); } return j2wsdlc; } /** * This method is called by the object model factory and returns the root of the object graph. */ public Object newChild(GlobalConfig globalc, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if (PACKAGE_NAMESPACE_TAG.equals(localName)) { String pkgname = attrs.getValue(PACKAGE_ATTRIBUTE); String ns = attrs.getValue(NAMESPACE_ATTRIBUTE); globalc.packageNamespaceMap.put(ns, pkgname); } return globalc; } /** * This method is called by the object model factory and returns the root of the object graph. */ public Object newChild(WSDLToJavaConfig wsdl2jc, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if (MAPPING_TAG.equals(localName)) { wsdl2jc.mappingFileNeeded = true; wsdl2jc.mappingFileName = getOptionalAttribute(attrs, FILE_ATTRIBUTE, "jaxrpc-mapping.xml"); } else if (WEBSERVICES_TAG.equals(localName)) { wsdl2jc.wsxmlFileNeeded = true; wsdl2jc.servletLink = getOptionalAttribute(attrs, SERVLET_LINK_ATTRIBUTE, null); wsdl2jc.ejbLink = getOptionalAttribute(attrs, EJB_LINK_ATTRIBUTE, null); if (wsdl2jc.ejbLink == null && wsdl2jc.servletLink == null) throw new WSException("Either servletLink or ejbLink should be specified"); } return wsdl2jc; } /** * This method is called by the object model factory and returns the root of the object graph. */ public Object newChild(OperationConfig op, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { if (PARAMETER_TAG.equals(localName)) { ParameterConfig parameter = op.createParameterConfig(); parameter.javaType = attrs.getValue(TYPE_ATTRIBUTE); String xmlName = attrs.getValue(XML_NAME_ATTRIBUTE); if (xmlName != null) parameter.xmlName = navigator.resolveQName(xmlName); parameter.mode = attrs.getValue(MODE_ATTRIBUTE); String header = attrs.getValue(HEADER_ATTRIBUTE); if (header != null) parameter.header = "true".equals(header) || "1".equals(header); return parameter; } return null; } /** */ public Object addChild(Configuration config, WSDLToJavaConfig wsdl2jc, UnmarshallingContext navigator, String namespaceURI, String localName) { config.setWSDLToJavaConfig(wsdl2jc); return config; } /** */ public Object addChild(Configuration config, GlobalConfig global, UnmarshallingContext navigator, String namespaceURI, String localName) { config.setGlobalConfig(global); return config; } /** */ public Object addChild(Configuration config, JavaToWSDLConfig j2wc, UnmarshallingContext navigator, String namespaceURI, String localName) { config.setJavaToWSDLConfig(j2wc); return config; } /** */ public Object addChild(JavaToWSDLConfig j2wc, OperationConfig opc, UnmarshallingContext navigator, String namespaceURI, String localName) { List list = j2wc.operations.get(opc.name); if (list == null) { list = new ArrayList(); list.add(opc); j2wc.operations.put(opc.name, list); } else { list.add(opc); } return j2wc; } public Object addChild(OperationConfig opc, ParameterConfig pc, UnmarshallingContext navigator, String namespaceURI, String localName) { opc.params.add(pc); return opc; } public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName) { return root; } //PRIVATE METHODS private String getOptionalAttribute(Attributes attrs, String attribName, String defaultValue) { String value = attrs.getValue(attribName); if (value == null) return defaultValue; return value; } private String getNamespace(UnmarshallingContext navigator, String attribName, String errorStr, Attributes attrs) { try { return attrs.getValue(attribName); } catch (RuntimeException e) { throw new WSException(errorStr + " attribute=" + attribName); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/client/0000755000175000017500000000000010755000263026613 5ustar godgod././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/client/ServiceCreator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/client/ServiceCreator.0000644000175000017500000001727010650145103031540 0ustar godgod/* * 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.tools.client; import java.io.File; import java.io.FileWriter; import java.io.IOException; import javax.xml.namespace.QName; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.WSDLBinding; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; import org.jboss.ws.metadata.wsdl.WSDLEndpoint; import org.jboss.ws.metadata.wsdl.WSDLService; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.tools.interfaces.ServiceCreatorIntf; import org.jboss.wsf.common.JavaUtils; /** * Creates the Service Interface
      * JBWS-160: Client Side Artifacts Generation
      * *
      Note: Web Services Layer
      * Method to create Service interface is as follows
      * Constructor to use is:
      *
      {@link #ServiceCreator( WSDLDefinitions wsdl, String packageName, File location ) ServiceCreator} *
      {@link #createServiceDescriptor() createServiceDescriptor} * * @author Anil Saldhana * @since Jun 22, 2005 */ public class ServiceCreator implements ServiceCreatorIntf { /** * The Package Name */ protected String packageName = null; /** * Directory Location where the service file has to be created */ protected File dirLocation = null; /** * Root object of the WSDL Object Graph */ protected WSDLDefinitions wsdl = null; /** Singleton class that handles many utility functions */ private WSDLUtils utils = WSDLUtils.getInstance(); /** * Constructor */ public ServiceCreator() { } /** * Constructor * @param serviceName Service Name * @param portName Port Name of the endpoint * @param packageName Package Name of the Service interface */ public ServiceCreator(WSDLDefinitions wsdl, String packageName) { this.wsdl = wsdl; this.packageName = packageName; } /** * Constructor * WebServices Layer uses this * @param serviceName Service Name * @param portName Port Name of the endpoint * @param packageName Package Name of the Service interface * @param location Directory Location where the Service File has to be created */ public ServiceCreator(WSDLDefinitions wsdl, String packageName, File location) { this(wsdl, packageName); this.dirLocation = location; } /** * @return Returns the dirLocation. */ public File getDirLocation() { return dirLocation; } /** * @param dirLocation The dirLocation to set. */ public void setDirLocation(File dirLocation) { this.dirLocation = dirLocation; } /** * @return Returns the packageName. */ public String getPackageName() { return packageName; } /** * @param packageName The packageName to set. */ public void setPackageName(String packageName) { this.packageName = packageName; } /** * @see #wsdl * @return */ public WSDLDefinitions getWsdl() { return wsdl; } /** * @see #wsdl * @param wsdl */ public void setWsdl(WSDLDefinitions wsdl) { this.wsdl = wsdl; } /** * Create the Service Interface for the endpoint * @throws IOException * */ public void createServiceDescriptor() throws IOException { if (packageName == null) throw new WSException("package name is null"); if (dirLocation == null) throw new WSException("dir location is null"); if (wsdl == null) throw new WSException("wsdl definitions is null"); WSDLService[] services = wsdl.getServices(); int len = services != null ? services.length : 0; for (int i = 0; i < len; i++) { generateServiceFile(services[i]); } } //PRIVATE METHODS private void generateHeader(StringBuilder buf) { buf.append("/* " + newLine(1)); buf.append("* JBoss, the OpenSource EJB server" + newLine(1)); buf.append("* Distributable under LGPL license. See terms of license at gnu.org." + newLine(1)); buf.append("*/" + newLine(2)); buf.append("//Auto Generated by jbossws - Please do not edit!!!"); buf.append(newLine(2)); } private void generatePackageNameAndImport(StringBuilder buf) { buf.append("package " + packageName + ";" + newLine(3)); buf.append("import javax.xml.rpc.*; " + newLine(3)); } private String getReturnType(WSDLBinding wbind) { String portType = wbind.getInterface().getName().getLocalPart(); portType = utils.chopPortType(portType); //Check if it conflicts with a service name if (wsdl.getService(portType) != null) portType += "_PortType"; return packageName + "." + JavaUtils.capitalize(portType); } private void generateServiceFile(WSDLService wsdlService) throws IOException { String serviceName = wsdlService.getName().getLocalPart(); if (serviceName.endsWith("Service") == false) serviceName = serviceName + "Service"; //Check if the serviceName conflicts with a portType or interface name if (wsdl.getInterface(new QName(wsdl.getTargetNamespace(), serviceName)) != null) serviceName = new StringBuilder(serviceName).insert(serviceName.lastIndexOf("Service"), '_').toString(); serviceName = JavaUtils.capitalize(serviceName); StringBuilder buf = new StringBuilder(); generateHeader(buf); generatePackageNameAndImport(buf); buf.append("public interface " + serviceName + " extends javax.xml.rpc.Service" + newLine(1)); buf.append("{" + newLine(2)); WSDLEndpoint[] endpts = wsdlService.getEndpoints(); int len = endpts != null ? endpts.length : 0; for (int i = 0; i < len; i++) buf.append(generateServiceMethodForWSDLEndpoint(endpts[i])).append(newLine(1)); buf.append("}" + newLine(1)); File loc = utils.createPackage(dirLocation.getAbsolutePath(), packageName); File sei = utils.createPhysicalFile(loc, serviceName); FileWriter writer = new FileWriter(sei); writer.write(buf.toString()); writer.flush(); writer.close(); } private String generateServiceMethodForWSDLEndpoint(WSDLEndpoint endpt) { StringBuilder buf = new StringBuilder(" public "); QName bindName = endpt.getBinding(); WSDLBinding wbind = wsdl.getBinding(bindName); buf.append(getReturnType(wbind)).append(" get"); buf.append(endpt.getName().getLocalPart()).append("()").append(" throws ServiceException;").append(newLine(1)); return buf.toString(); } private String newLine(int times) { String newline = "\n"; StringBuilder buf = new StringBuilder(newline); for (int i = 0; i < times - 1; i++) buf.append(newline); return buf.toString(); } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/JavaToWSDL20.java0000644000175000017500000001350210561611275030227 0ustar godgod/* * 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.tools; import java.util.HashMap; import java.util.Map; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.WSDLDefinitions; // $Id: JavaToWSDL20.java 2275 2007-02-05 11:19:25Z heiko.braun@jboss.com $ /** * Generates a WSDL-2.0 from a Service Endpoint Interface * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 10-Oct-2004 */ public class JavaToWSDL20 { // provide logging private static final Logger log = Logger.getLogger(JavaToWSDL20.class); // The required wsdl namespace URI private final String wsdlNamespace = Constants.NS_WSDL11; // The target namespace private String targetNamespace; //The type namespace (it can be different from the target namespace) private String typeNamespace; // The service name private String serviceName; /** Name of the PortType*/ private String portTypeName; /** Features as represented by Constants*/ private HashMap features = new HashMap(); // A Map of package/namespace mapping that needs to be passed onto types generator private Map packageNamespaceMap = null; /** * CTR in the simplest form * @param sei Class that represents the SEI * @param targetNS Target Namespace * @param typeNS Type Namespace */ /*public JavaToWSDL20(Class sei, String targetNS, String typeNS ) { super(sei,targetNS, typeNS); this.wsdlNamespace = Constants.NS_WSDL20; }*/ /** * Default Constructor */ public JavaToWSDL20() { if(log.isDebugEnabled()) log.debug("Creating JavaToWSDL20 instance"); } /** * Add a feature to this subsystem * @param name * @param value */ public void addFeature(String name, boolean value) { features.put(name,new Boolean(value)); } /** * Append features * @param map */ public void addFeatures(Map map) { features.putAll(map); } /** * Return a feature if set * @param name * @return boolean value representing the feature, if not * @throws IllegalStateException Feature unrecognized */ public boolean getFeature(String name) { Boolean val = features.get(name); if(val != null) return val.booleanValue(); throw new WSException("Feature unrecognized"); } /** * @return Returns the endpointName. */ public String getPortTypeName() { return portTypeName; } /** * @param endpointName The endpointName to set. */ public void setPortTypeName(String endpointName) { this.portTypeName = endpointName; } /** * A customized Package->Namespace map * * @param map */ public void setPackageNamespaceMap(Map map) { packageNamespaceMap = map; } /** * @return Returns the serviceName. */ public String getServiceName() { return serviceName; } /** * @param serviceName The serviceName to set. */ public void setServiceName(String serviceName) { this.serviceName = serviceName; } /** * @return Returns the targetNamespace. */ public String getTargetNamespace() { return targetNamespace; } /** * @param targetNamespace The targetNamespace to set. */ public void setTargetNamespace(String targetNamespace) { this.targetNamespace = targetNamespace; } /** * Get the TypeNamespace * * @return */ public String getTypeNamespace() { return typeNamespace; } /** * * Set the TypeNamespace * @param typeNamespace */ public void setTypeNamespace(String typeNamespace) { this.typeNamespace = typeNamespace; } /** * Generate the common WSDL definition for a given endpoint */ public WSDLDefinitions generate(Class endpoint) { // WSDLDefinitions wsdl = new WSDLDefinitions(); // wsdl.setWsdlNamespace(this.wsdlNamespace); // //Delegate the generation of WSDL to a Helper class // JavaToWSDLHelper helper = new JavaToWSDLHelper(wsdl,this.wsdlNamespace,this.targetNamespace); // if(typeNamespace == null ) typeNamespace = targetNamespace; // helper.setTypeNamespace(typeNamespace); // JavaToXSDIntf jxsd = new JavaToXSD(null); // if(packageNamespaceMap != null) // jxsd.setPackageNamespaceMap(packageNamespaceMap); // jxsd.addFeatures(features); // helper.setJavaToXSD(jxsd); // helper.setEndpoint(endpoint); // helper.appendDefinitions(); // //TODO: Revisit when wsdl 2.0 support is provided // /*helper.generateTypesForXSD(); // helper.generateInterfaces(portTypeName); // helper.generateBindings(); // helper.generateServices(this.serviceName); */ // return wsdl; return null; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/tools/ToolsUtils.java0000644000175000017500000003577710650145103030341 0ustar godgod/* * 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.tools; import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; import java.rmi.Remote; import java.util.Calendar; import java.util.Date; import javax.xml.namespace.QName; import javax.xml.rpc.holders.ByteArrayHolder; import javax.xml.rpc.holders.Holder; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.LiteralTypeMapping; import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils; import org.jboss.wsf.common.JavaUtils; /** * Util class for the JBossWS Tools project * Contains important methods that deal with JAXB 1, JAXB2 * and JAXWS 2.0 specs * @author Anil Saldhana * @since Jun 25, 2005 */ public class ToolsUtils { /** * Maintains a static reference to the TypeMapping just for * the standard type mappings */ private static LiteralTypeMapping mapping = new LiteralTypeMapping(); //Hide the constructor - this is a class with static methods private ToolsUtils() { throw new WSException("Cannot instantiate ToolsUtils."); } /** * Checks whether the class extends java.rmi.Remote * * @param paramType */ public static void checkParameterType( Class paramType) { if (Remote.class.isAssignableFrom(paramType)) throw new IllegalArgumentException("JAXWS-2.0 Assertion::" + "Method param shouldn't extend Remote"); } /** * Ensure that the first alphabet is uppercase * @param fname * @return String that has first character upper case */ public static String firstLetterUpperCase(String fname) { if (fname == "" || fname == null) throw new WSException("String passed is null"); //Ensure that the first character is uppercase if (Character.isLowerCase(fname.charAt(0))) { char[] chars = fname.toCharArray(); char f = Character.toUpperCase(chars[0]); chars[0] = f; fname = new String(chars); } return fname; } /** * Ensure that the first alphabet is lowercase * @param fname * @return String that has first character lower case */ public static String firstLetterLowerCase(String fname) { if (fname == "" || fname == null) throw new WSException("String passed is null"); //Ensure that the first character is lowercase if (Character.isUpperCase(fname.charAt(0))) { char[] chars = fname.toCharArray(); char f = Character.toLowerCase(chars[0]); chars[0] = f; fname = new String(chars); } return fname; } /** * Returns a Java Identifier from a XML Name * as specified by both JAXB 1 and JAXB 2 specs. * Used for deriving class names, method names etc * @param xmlName XML Name * @return Legal Java Identifier */ public static String getJavaIdentifier(String xmlName) { if(xmlName == null || xmlName == "") throw new IllegalArgumentException("xmlName is null"); xmlName = xmlName.trim(); //Get rid of whitespaces //Remove leading and trailing punctuation marks xmlName = trimPunctuationMarks( xmlName); if(xmlName == null) throw new WSException("xmlName has become null"); //Get rid of characters that are not legal characters int lenStr = xmlName.length(); char[] mainArr = new char[lenStr]; int j = 0; for(int i = 0; i < lenStr;i++) { char ch = xmlName.charAt(i); if(Character.isJavaIdentifierPart(ch)) { mainArr[j] = ch; j++; } } //Copy into a new array char[] secArr = new char[j]; for(int x = 0; x < j ; x++) { secArr[x] = mainArr[x]; } return new String(secArr); } /** * Get valid Java Method name as per JAXB 1 and JAXB2.0 spec * @param xmlName XML Name * @param setter is this method for which the name is sought, a setter? * @return Valid Java method name */ public static String getJavaMethodName( String xmlName, boolean setter) { xmlName = getJavaIdentifier(xmlName); xmlName = firstLetterUpperCase(xmlName); String lcase = xmlName.toLowerCase(); if( setter && !lcase.startsWith("set")) { xmlName = "set" + xmlName; } else if(!setter && !lcase.startsWith("get")) { xmlName = "get" + xmlName; } return firstLetterLowerCase(xmlName); } /** * Get a valid Java class name as per JAXB 1 and JAXB2.0 spec * @param xmlName XML Name * @return Valid class name */ public static String getValidClassName( String xmlName) { xmlName = getJavaIdentifier(xmlName); //Ensure the first character is uppercase return firstLetterUpperCase(xmlName); } /** * Given a Java Class, return the xmlType * * @param javaClass * @param ns * @return */ public static QName getXMLType(Class javaClass, String ns) { WSDLUtils utils = WSDLUtils.getInstance(); QName xmlType = null; if(void.class == javaClass) return null; /** * Special boundary condition: When the javaClass is ByteArrayHolder, * the xmlType should be xsd:base64Binary, but because of our algorithm, * it will become xsd:byte - so need to bypass this. */ if(ByteArrayHolder.class == javaClass) { return Constants.TYPE_LITERAL_BASE64BINARY; } if(Holder.class.isAssignableFrom(javaClass)) javaClass = utils.getJavaTypeForHolder(javaClass); xmlType = SchemaUtils.getInstance().getToolsOverrideInTypeMapping(javaClass); if(xmlType != null) return xmlType; // Byte[] should always be mapped to an array of bytes // String[] should always be mapped to an array of strings if (javaClass != Byte[].class && javaClass != String[].class) { xmlType = mapping.getXMLType(javaClass,false); if(xmlType != null) return xmlType; } //Else create a QName String typeName = utils.getJustClassName(javaClass);; if(javaClass.isArray()) { int dim = utils.getArrayDimension(javaClass); Class cls = javaClass; while(cls.isArray()) { cls = cls.getComponentType(); } typeName = WSDLUtils.getInstance().getJustClassName(cls); while(dim-- > 0) typeName += ".Array"; } return new QName(ns, typeName); /*SchemaCreatorIntf sc = new SchemaTypeCreator(); sc.setRestrictToTargetNamespace(restrictNS); //For basic types, the following algorithm will return the simple types JBossXSTypeDefinition xt = sc.generateTypeWithoutRegistration(null, javaClass,ns); return new QName(xt.getNamespace(), xt.getName());*/ } /** * Get the XML Type for an attachment mime type * (will be xsd:hexbinary) * * @param mimetype * @return */ public static QName getXMLTypeForAttachmentType( String mimetype) { return Constants.TYPE_LITERAL_HEXBINARY; } /** * Returns whether a character is a punctuation * @param c * @return true:if punctuation, false - otherwise */ public static boolean isPunctuation(char c) { boolean ret = true; //Idea is if it is not a letter, a digit, a white space, it is a punct if(Character.isDigit(c)) ret = false; else if(Character.isLetter(c)) ret = false; else if(Character.isISOControl(c)) ret = false; else if(Character.isWhitespace(c)) ret = false; return ret; } /** * Checks whether a class is a legal jaxrpc value type * as defined by jaxrpc 1.l specification * * @param cls * @return */ public static boolean isJaxrpcValueType(Class cls) { boolean result = true; if(isJaxrpcRegularType(cls)) return false; boolean defaultCTR = false; //Does it define a default constructor? Constructor[] cons = cls.getDeclaredConstructors(); for (int i=0; i 0) result = true; } catch (java.beans.IntrospectionException e) { } return result; } public static int getNumberOfParticles(Class javaBean) { if(isJavaBean(javaBean) == false) throw new IllegalArgumentException("Illegal JavaBean argument"); //Get number of public fields Field[] pubFields = javaBean.getFields(); int pub = pubFields != null ? pubFields.length : 0; int props = 0; //Get number of properties via bean introspection try { BeanInfo bi = Introspector.getBeanInfo(javaBean); PropertyDescriptor[] pds = bi.getPropertyDescriptors(); props = pds != null ? Array.getLength(pds) : 0; int len = 0; for(int i = 0; i < props ; i++) { PropertyDescriptor pd = pds[i]; Method readMethod = pd.getReadMethod(); if("getClass".equals(readMethod.getName())) continue; len++; } props = len; } catch (java.beans.IntrospectionException e) { } return pub + props; } /** * Determines whether a Java Class can be unwrapped * * @param javaType * @param isReturnType Does the javaType represent a return type * of a method? * @return */ public static boolean canUnWrap(Class javaType, boolean isReturnType) { boolean bool = false; if(isReturnType) { bool = ( ToolsUtils.isJavaBean(javaType) && ToolsUtils.getNumberOfParticles(javaType) == 1 ); } else bool = ToolsUtils.isJaxrpcValueType(javaType); return bool; } /** * Checks whether the class type that is passed as argument is * a legal Jaxrpc type as defined by jaxrpc 1.1 spec * * @param type * @return */ public static boolean isJaxrpcPermittedType(Class type) { if(isJaxrpcRegularType(type) == false) return isJaxrpcValueType(type); else return true; } /** * Checks whether the class type that is passed as argument is * a legal Jaxrpc type (and not a Value Type) as defined by jaxrpc 1.1 spec * * @param type * @return */ public static boolean isJaxrpcRegularType(Class type) { boolean result = false; //Check if it is a primitive type if(JavaUtils.isPrimitive(type)) return true; //Check if it is an array of primitive types Class wrapperType = JavaUtils.getWrapperType(type); if( wrapperType != null && wrapperType != type ) return true; //Check if it is a wrapper type or array Class primType = JavaUtils.getPrimitiveType(type); if( primType != null && primType != type) return true; //Check standard jaxrpc 1.1 classes if(String.class == type || Date.class == type || Calendar.class == type || BigInteger.class == type || BigDecimal.class == type || QName.class == type || URI.class == type) return true; return result; } public synchronized static void registerJavaType(LiteralTypeMapping typeMapping, Class clazz, QName xmlType) { if(typeMapping.isRegistered(clazz,xmlType) == false ) typeMapping.register(clazz,xmlType, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); } /** * Check all of the characters in the component and for any that are not valid * in Java identifiers replace with an underscore. */ public static String convertInvalidCharacters(final String component) { String result = component; for (int i = 0; i < result.length(); i++) { if (Character.isJavaIdentifierPart(result.charAt(i)) == false) { result = result.replace(result.charAt(i), '_'); } } return result; } //Private methods private static String trimPunctuationMarks( String str) { if(str == null) throw new IllegalArgumentException("Str is null"); //Check if the first character is permissible if(Character.isJavaIdentifierStart(str.charAt(0)) == false) str = str.substring(1); else //Check if the first character is a punctuation if(isPunctuation(str.charAt( 0 )) ) str = str.substring(1); int len = str.length(); //Check if the last character is a punctuation if(isPunctuation(str.charAt( len -1 )) ) str = str.substring(0,len-1); return str; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/soap/0000755000175000017500000000000010755000263025137 5ustar godgod././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/soap/SOAPConnectionFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/soap/SOAPConnectionFactoryIm0000644000175000017500000000544710552656010031476 0ustar godgod/* * The Apache Software License, Version 1.1 * * * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package org.jboss.ws.soap; // $Id: SOAPConnectionFactoryImpl.java 1959 2007-01-15 10:48:40Z thomas.diesler@jboss.com $ /** * Included for backwards compatibility * @deprecated */ public class SOAPConnectionFactoryImpl extends org.jboss.ws.core.soap.SOAPConnectionFactoryImpl { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/soap/SOAPFactoryImpl.java0000644000175000017500000000234110552656010030720 0ustar godgod/* * 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.soap; // $Id: SOAPFactoryImpl.java 1959 2007-01-15 10:48:40Z thomas.diesler@jboss.com $ /** * Included for backwards compatibility * @deprecated */ public class SOAPFactoryImpl extends org.jboss.ws.core.soap.SOAPFactoryImpl { } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/soap/MessageFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/soap/MessageFactoryImpl.java0000644000175000017500000000237610552656010031552 0ustar godgod/* * 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.soap; // $Id: MessageFactoryImpl.java 1959 2007-01-15 10:48:40Z thomas.diesler@jboss.com $ /** * Included for backwards compatibility * @deprecated */ public class MessageFactoryImpl extends org.jboss.ws.core.soap.MessageFactoryImpl { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/jaxrpc/0000755000175000017500000000000010755000263025464 5ustar godgod././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/jaxrpc/ServiceFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/jaxrpc/ServiceFactoryImpl.ja0000644000175000017500000000236510560061125031556 0ustar godgod/* * 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.jaxrpc; // $Id: ServiceFactoryImpl.java 2209 2007-01-31 09:33:09Z thomas.diesler@jboss.com $ /** * Included for backwards compatibility * @deprecated */ public class ServiceFactoryImpl extends org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/0000755000175000017500000000000010755000267025131 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/0000755000175000017500000000000010755000264026415 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/0000755000175000017500000000000010755000264030027 5ustar godgod././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Calendar0000644000175000017500000000277710642000211031463 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: CalendarDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A CalendarDeserializer Factory * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class CalendarDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() { return new CalendarDeserializer(); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPArra0000644000175000017500000001651010650145103031321 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: SOAPArrayDeserializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.lang.reflect.Array; import java.util.Arrays; import java.util.Iterator; import java.util.StringTokenizer; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.JavaUtils; import org.w3c.dom.Element; /** * A Deserializer that can handle SOAP encoded arrays. * * @author Thomas.Diesler@jboss.org * @since 31-Oct-2005 */ public class SOAPArrayDeserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(SOAPArrayDeserializer.class); private DeserializerSupport componentDeserializer; public Object deserialize(QName xmlName, QName xmlType, Source source, SerializationContext serContext) throws BindingException { log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); try { ParameterMetaData paramMetaData = (ParameterMetaData)serContext.getProperty(ParameterMetaData.class.getName()); Element soapElement = DOMUtils.sourceToElement(source); QName compXmlType = getComponentTypeFromAttribute(soapElement); paramMetaData.setSOAPArrayCompType(compXmlType); if (compXmlType == null) throw new WSException("Cannot obtain component xmlType: " + paramMetaData.getPartName()); Class compJavaType = getJavaTypeForComponentType(compXmlType, serContext); // Get the component type deserializer factory log.debug("Get component deserializer for: [javaType=" + compJavaType.getName() + ",xmlType=" + compXmlType + "]"); int[] arrDims = getDimensionsFromAttribute(soapElement); Object[] retArray = (Object[])Array.newInstance(compJavaType, arrDims); TypeMappingImpl typeMapping = serContext.getTypeMapping(); AbstractDeserializerFactory compDeserializerFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(compJavaType, compXmlType); if (compDeserializerFactory == null) { log.warn("Cannot obtain component deserializer for: [javaType=" + compJavaType.getName() + ",xmlType=" + compXmlType + "]"); compDeserializerFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(null, compXmlType); } if (compDeserializerFactory == null) throw new WSException("Cannot obtain component deserializer for: " + compXmlType); // Get the component type deserializer componentDeserializer = (DeserializerSupport)compDeserializerFactory.getDeserializer(); if (arrDims.length < 1 || 2 < arrDims.length) throw new WSException("Unsupported array dimensions: " + Arrays.asList(arrDims)); Iterator it = DOMUtils.getChildElements(soapElement); if (arrDims.length == 1) { Object[] subArr = retArray; deserializeMemberValues(compXmlType, serContext, it, subArr); } if (arrDims.length == 2) { for (int i = 0; i < arrDims[0]; i++) { Object[] subArr = (Object[])retArray[i]; deserializeMemberValues(compXmlType, serContext, it, subArr); } } log.debug("deserialized: " + retArray.getClass().getName()); return retArray; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new BindingException(e); } } private void deserializeMemberValues(QName compXmlType, SerializationContext serContext, Iterator it, Object[] subArr) throws BindingException { QName compXmlName = new QName("item"); int dim = subArr.length; for (int i = 0; i < dim; i++) { Object compValue = null; if (it.hasNext()) { Element childElement = (Element)it.next(); Source source = new DOMSource(childElement); compValue = componentDeserializer.deserialize(compXmlName, compXmlType, source, serContext); compValue = JavaUtils.getWrapperValueArray(compValue); } subArr[i] = compValue; } } private int[] getDimensionsFromAttribute(Element arrayElement) { QName attrQName = new QName(Constants.URI_SOAP11_ENC, "arrayType"); QName arrayType = DOMUtils.getAttributeValueAsQName(arrayElement, attrQName); if (arrayType == null) throw new WSException("Cannot obtain attribute: " + attrQName); String localPart = arrayType.getLocalPart(); int dimIndex = localPart.indexOf("["); String dimStr = localPart.substring(dimIndex); StringTokenizer st = new StringTokenizer(dimStr, "[,]"); int[] arrDims = new int[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) arrDims[i] = new Integer(st.nextToken()).intValue(); return arrDims; } private QName getComponentTypeFromAttribute(Element arrayElement) { QName attrQName = new QName(Constants.URI_SOAP11_ENC, "arrayType"); QName arrayType = DOMUtils.getAttributeValueAsQName(arrayElement, attrQName); if (arrayType == null) throw new WSException("Cannot obtain attribute: " + attrQName); String nsURI = arrayType.getNamespaceURI(); String localPart = arrayType.getLocalPart(); int dimIndex = localPart.indexOf("["); QName compXmlType = new QName(nsURI, localPart.substring(0, dimIndex)); return compXmlType; } private Class getJavaTypeForComponentType(QName compXmlType, SerializationContext serContext) { TypeMappingImpl typeMapping = serContext.getTypeMapping(); Class javaType = typeMapping.getJavaType(compXmlType); if (javaType == null) throw new WSException("Cannot obtain javaType for: " + compXmlType); return JavaUtils.getWrapperType(javaType); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/CalendarSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Calendar0000644000175000017500000000562310642000211031454 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: CalendarSerializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.Calendar; import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.SimpleTypeBindings; import org.w3c.dom.NamedNodeMap; /** * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 * @see XML Schema 3.2.16 */ public class CalendarSerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(CalendarSerializer.class); public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { if (log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); String valueStr; if (Constants.TYPE_LITERAL_DATE.equals(xmlType)) valueStr = SimpleTypeBindings.marshalDate((Calendar)value); else if (Constants.TYPE_LITERAL_TIME.equals(xmlType)) valueStr = SimpleTypeBindings.marshalTime((Calendar)value); else if (Constants.TYPE_LITERAL_DATETIME.equals(xmlType)) valueStr = SimpleTypeBindings.marshalDateTime((Calendar)value); else throw new IllegalArgumentException("Invalid xmlType: " + xmlType); NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, null, attributes, true); return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPElem0000644000175000017500000000520610650145103031316 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: SOAPElementSerializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.NamedNodeMap; /** * A serializer that can handle xsd:anyType * * @author Thomas.Diesler@jboss.org * @since 18-Oct-2004 */ public class SOAPElementSerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(SOAPElementSerializer.class); /** Marshal the value for a given XMLSchema type * @param xmlType local part of the schema type * @param value the value to marshal * @param serContext * @return the string representation od the value */ public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); if (value == null) throw new IllegalArgumentException("SOAPElement value cannot be null"); if ((value instanceof SOAPElement) == false) throw new IllegalArgumentException("Value is not a SOAPElement: " + value.getClass().getName()); String xmlFragment = DOMWriter.printNode((SOAPElement)value, false); return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/QNameDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/QNameDes0000644000175000017500000000732710650145103031414 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: QNameDeserializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.wsf.common.DOMUtils; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.SimpleTypeBindings; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class QNameDeserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(QNameDeserializer.class); public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(xmlFragment), serContext); } private Object deserialize(QName xmlName, QName xmlType, String xmlFragment, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); QName value = null; NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); String valueStr = unwrapValueStr(xmlFragment, nsRegistry); if (valueStr != null) { value = SimpleTypeBindings.unmarshalQName(valueStr, nsRegistry); } return value; } /** Unwrap the value string from the XML fragment * @return The value string or null if the startTag contains a xsi:nil='true' attribute */ protected String unwrapValueStr(String xmlFragment, NamespaceRegistry nsRegistry) { if (isEmptyElement(xmlFragment) == false) { // Register namespace declarations try { Element el = DOMUtils.parse(xmlFragment); NamedNodeMap attribs = el.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Node attr = attribs.item(i); String nodeName = attr.getNodeName(); if (nodeName.startsWith("xmlns:")) { String prefix = nodeName.substring(6); String nsURI = attr.getNodeValue(); nsRegistry.registerURI(nsURI, prefix); } } } catch (IOException e) { throw new IllegalArgumentException("Cannot parse xmlFragment: " + xmlFragment); } } return super.unwrapValueStr(xmlFragment); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000755000175000017500000000000010755000264031501 5ustar godgod././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshallerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000000676210542776150031526 0ustar godgod/* * 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.core.jaxrpc.binding.jbossxb; // $Id: JBossXBUnmarshallerImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.InputStream; import java.util.HashMap; import org.jboss.ws.WSException; import org.jboss.ws.extensions.xop.jaxrpc.XOPUnmarshallerImpl; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; /** * An implementation of a JAXB Unmarshaller. * * @author Thomas.Diesler@jboss.org * @author Alexey.Loubyansky@jboss.org * @since 18-Oct-2004 */ public class JBossXBUnmarshallerImpl implements JBossXBUnmarshaller { // The marshaller properties private HashMap properties = new HashMap(); /** * Unmarshal XML data from the specified InputStream and return the resulting content tree. */ public Object unmarshal(InputStream is) throws UnmarshalException { assertRequiredProperties(); org.jboss.xb.binding.Unmarshaller unm = UnmarshallerFactory.newInstance().newUnmarshaller(); SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties); XOPUnmarshallerImpl xopUnmarshaller = new XOPUnmarshallerImpl(); schemaBinding.setXopUnmarshaller(xopUnmarshaller); try { return unm.unmarshal(is, schemaBinding); } catch (JBossXBException e) { throw new UnmarshalException(e.getMessage(), e); } } /** * Get the particular property in the underlying implementation of Unmarshaller. */ public Object getProperty(String name) { if (name == null) throw new IllegalArgumentException("name parameter is null"); return properties.get(name); } /** * Set the particular property in the underlying implementation of Unmarshaller. */ public void setProperty(String name, Object value) { if (name == null) throw new IllegalArgumentException("name parameter is null"); properties.put(name, value); } /** Assert the required properties */ private void assertRequiredProperties() { if (getProperty(JBossXBConstants.JBXB_XS_MODEL) == null) { throw new WSException("Cannot find required property: " + JBossXBConstants.JBXB_XS_MODEL); } if (getProperty(JBossXBConstants.JBXB_JAVA_MAPPING) == null) { throw new WSException("Cannot find required property: " + JBossXBConstants.JBXB_JAVA_MAPPING); } } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/SchemaBindingBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000005350410565334563031525 0ustar godgod/* * 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.core.jaxrpc.binding.jbossxb; // $Id: SchemaBindingBuilder.java 2385 2007-02-16 14:02:27Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.Iterator; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFactory; import org.apache.xerces.xs.XSModel; import org.jboss.logging.Logger; import org.jboss.util.xml.JBossEntityResolver; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.utils.JBossWSEntityResolver; import org.jboss.ws.extensions.xop.jaxrpc.JBossXBContentAdapter; import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping; import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.PackageMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SimpleTypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler; import org.w3c.dom.Element; import org.w3c.dom.Text; import org.xml.sax.Attributes; /** * Create SchemaBinding from XSModel and jaxrpc-mapping. * * @author Thomas.Diesler@jboss.org * @author Alexey.Loubyansky@jboss.org * @since 18-Oct-2004 * @see XSModel * @see JavaWsdlMapping */ public class SchemaBindingBuilder { // provide logging private static final Logger log = Logger.getLogger(SchemaBindingBuilder.class); /** * Creates and initializes an instance of SchemaBinding */ public SchemaBinding buildSchemaBinding(XSModel model, JavaWsdlMapping wsdlMapping) { JBossEntityResolver resolver = new JBossWSEntityResolver(); SchemaBinding schemaBinding = XsdBinder.bind(model, new DefaultSchemaResolver(resolver)); schemaBinding.setIgnoreLowLine(false); schemaBinding.setIgnoreUnresolvedFieldOrClass(false); schemaBinding.setUnmarshalListsToArrays(true); // note: default jaxb2.0 is false! schemaBinding.setSimpleContentProperty("_value"); schemaBinding.setUseNoArgCtorIfFound(true); schemaBinding.setReplacePropertyRefs(false); if (wsdlMapping != null) { bindSchemaToJava(schemaBinding, wsdlMapping); } // setup MTOM handler JBossXBContentAdapter.register(schemaBinding); return schemaBinding; } /** Merges JavaWsdlMapping into SchemaBinding */ private void bindSchemaToJava(SchemaBinding schemaBinding, JavaWsdlMapping wsdlMapping) { if (log.isTraceEnabled()) log.trace("bindSchemaToJava: " + schemaBinding); for (PackageMapping packageMapping : wsdlMapping.getPackageMappings()) { processPackageMapping(schemaBinding, packageMapping); } for (ExceptionMapping exceptionMapping : wsdlMapping.getExceptionMappings()) { processExceptionMapping(schemaBinding, exceptionMapping); } for (JavaXmlTypeMapping typeMapping : wsdlMapping.getJavaXmlTypeMappings()) { processJavaXmlTypeMapping(schemaBinding, typeMapping); } } private void processPackageMapping(SchemaBinding schemaBinding, PackageMapping packageMapping) { PackageMetaData packageMetaData = schemaBinding.getPackageMetaData(); if (packageMetaData == null) { packageMetaData = new PackageMetaData(); schemaBinding.setPackageMetaData(packageMetaData); } if (log.isTraceEnabled()) log.trace("Bound namespace " + packageMapping.getNamespaceURI() + " to package " + packageMapping.getPackageType()); packageMetaData.setName(packageMapping.getPackageType()); } private void processJavaXmlTypeMapping(SchemaBinding schemaBinding, JavaXmlTypeMapping typeMapping) { String javaType = typeMapping.getJavaType(); if (javaType.endsWith("[]")) { processArrayType(schemaBinding, typeMapping); } else { processNonArrayType(schemaBinding, typeMapping); } } private void processExceptionMapping(SchemaBinding schemaBinding, ExceptionMapping exceptionMapping) { QName xmlType = exceptionMapping.getWsdlMessage(); String javaType = exceptionMapping.getExceptionType(); log.trace("processExceptionMapping: [xmlType=" + xmlType + ",javaType=" + javaType + "]"); if (schemaBinding.getType(xmlType) == null) { TypeBinding typeBinding = new TypeBinding(xmlType); ClassMetaData cmd = new ClassMetaData(); cmd.setUseNoArgCtor(Boolean.FALSE); cmd.setImpl(javaType); typeBinding.setClassMetaData(cmd); typeBinding.setSimple(false); schemaBinding.addType(typeBinding); } } private void processArrayType(SchemaBinding schemaBinding, JavaXmlTypeMapping typeMapping) { QName xmlType = getXmlType(typeMapping); log.trace("Ignore array type: " + xmlType); } private void processNonArrayType(SchemaBinding schemaBinding, JavaXmlTypeMapping typeMapping) { QName xmlType = getXmlType(typeMapping); String javaType = typeMapping.getJavaType(); log.trace("processNonArrayType: [xmlType=" + xmlType + ",javaType=" + javaType + "]"); TypeBinding typeBinding = getTypeBinding(schemaBinding, typeMapping); if (typeBinding != null) { // Set the java type, but skip SimpleTypes boolean isSimpleTypeBinding = (typeBinding instanceof SimpleTypeBinding); if(isSimpleTypeBinding == false) { ClassMetaData classMetaData = typeBinding.getClassMetaData(); if (classMetaData == null) { classMetaData = new ClassMetaData(); typeBinding.setClassMetaData(classMetaData); } classMetaData.setImpl(javaType); // exception mapping drives whether we should use the noarg ctor JavaWsdlMapping wsdlMapping = typeMapping.getJavaWsdlMapping(); for (ExceptionMapping aux : wsdlMapping.getExceptionMappings()) { if (javaType.equals(aux.getExceptionType())) { classMetaData.setUseNoArgCtor(false); break; } } if (log.isTraceEnabled()) { QName typeQName = typeBinding.getQName(); log.trace("Bound: [xmlType=" + typeQName + ",javaType=" + javaType + "]"); } } VariableMapping[] variableMappings = typeMapping.getVariableMappings(); for (VariableMapping varMapping : variableMappings) { if (varMapping.getXmlElementName() != null) { processXmlElementName(typeBinding, varMapping); } else if (varMapping.getXmlAttributeName() != null) { processXmlAttributeName(typeBinding, varMapping); } else if (varMapping.getXmlWildcard()) { processWildcard(typeBinding, varMapping); } } } else { log.warn("Cannot obtain type binding for: " + xmlType); } } private void processXmlAttributeName(TypeBinding typeBinding, VariableMapping varMapping) { String xmlAttrName = varMapping.getXmlAttributeName(); log.trace("processXmlAttributeName: " + xmlAttrName); QName xmlName = new QName(xmlAttrName); AttributeBinding attrBinding = typeBinding.getAttribute(xmlName); if (attrBinding == null) { Iterator i = typeBinding.getAttributes().iterator(); while (i.hasNext()) { AttributeBinding auxBinding = (AttributeBinding)i.next(); if (auxBinding.getQName().getLocalPart().equals(xmlAttrName)) { if (attrBinding != null) log.warn("Ambiguous binding for attribute: " + xmlAttrName); attrBinding = auxBinding; } } } if (attrBinding == null) { // attributeFormDefault="qualified" String nsURI = typeBinding.getQName().getNamespaceURI(); if (Constants.SOAP11_ATTR_MUST_UNDERSTAND.equals(xmlAttrName) || Constants.SOAP11_ATTR_ACTOR.equals(xmlAttrName) || Constants.SOAP12_ATTR_ROLE.equals(xmlAttrName)) { nsURI = Constants.NS_SOAP11_ENV; } QName auxName = new QName(nsURI, xmlAttrName); attrBinding = typeBinding.getAttribute(auxName); } if (attrBinding == null) { QName typeQName = typeBinding.getQName(); throw new WSException("Attribute " + xmlName + " found in jaxrpc-mapping but not in the schema: " + typeQName); } String javaVariableName = varMapping.getJavaVariableName(); PropertyMetaData prop = new PropertyMetaData(); prop.setName(javaVariableName); attrBinding.setPropertyMetaData(prop); if (log.isTraceEnabled()) log.trace("Bound attribute " + xmlName + " to property " + prop.getName()); } private void processXmlElementName(TypeBinding typeBinding, VariableMapping varMapping) { QName xmlName = new QName(varMapping.getXmlElementName()); log.trace("processXmlElementName: " + xmlName); ElementBinding element = typeBinding.getElement(xmlName); QName typeQName = typeBinding.getQName(); if (element == null && typeQName != null) { // elementFormDefault="qualified" String nsURI = typeQName.getNamespaceURI(); QName auxName = new QName(nsURI, varMapping.getXmlElementName()); element = typeBinding.getElement(auxName); } if (element == null) { // ') { if (begin != -1) { list.add(expression.substring(begin, i)); begin = -1; } } else { if (begin == -1) begin = i; else if (i == expression.length() - 1) list.add(expression.substring(begin)); } } ElementBinding element = findLocalPathElement(schemaBinding.getElements(), ((String[])list.toArray(new String[0]))); if (element == null) element = findLocalPathElementInTypes(schemaBinding.getTypes(), ((String[])list.toArray(new String[0]))); if (element == null) return null; return element.getType(); } public void bindParameterToElement(SchemaBinding schemaBinding, QName xmlName, QName xmlType) { TypeBinding typeBinding; boolean isAnonymousType = xmlType.getLocalPart().startsWith(">"); if (isAnonymousType) { typeBinding = getAnonymousTypeBinding(schemaBinding, xmlType); } else { typeBinding = schemaBinding.getType(xmlType); } if (typeBinding != null) { if(!isAnonymousType) schemaBinding.addElement(xmlName, typeBinding); } else if (xmlType.equals(Constants.TYPE_LITERAL_ANYTYPE) == false) { throw new WSException("Root type " + xmlType + " not found in the schema."); } } private ElementBinding findLocalPathElement(Iterator elements, String[] path) { while (elements.hasNext()) { ElementBinding element = (ElementBinding)elements.next(); element = findLocalPathElement(element, path, 0); if (element != null) return element; } return null; } private ElementBinding findLocalPathElementInTypes(Iterator types, String[] path) { while (types.hasNext()) { TypeBinding type = (TypeBinding)types.next(); if (type.getQName().getLocalPart().equals(path[0])) { ParticleBinding particle = type.getParticle(); if (particle == null) continue; TermBinding term = particle.getTerm(); if (!term.isModelGroup()) continue; return findLocalPathElement(((ModelGroupBinding)term).getParticles().iterator(), path, 1); } } return null; } private ElementBinding findLocalPathElement(ElementBinding element, String[] path, int pos) { String name = path[pos]; if (!name.equals(element.getQName().getLocalPart())) return null; // End of path if (path.length - 1 == pos) return element; ParticleBinding particle = element.getType().getParticle(); if (particle == null) return null; TermBinding term = particle.getTerm(); if (!term.isModelGroup()) return null; ModelGroupBinding group = (ModelGroupBinding)term; Iterator i = group.getParticles().iterator(); // Increase depth return findLocalPathElement(i, path, pos + 1); } private ElementBinding findLocalPathElement(Iterator particles, String[] path, int pos) { while (particles.hasNext()) { TermBinding term = ((ParticleBinding)particles.next()).getTerm(); if (term instanceof ElementBinding) { ElementBinding element = (ElementBinding)term; element = findLocalPathElement(element, path, pos); if (element != null) return element; } else if (term instanceof ModelGroupBinding) { Iterator i = ((ModelGroupBinding)term).getParticles().iterator(); ElementBinding element = findLocalPathElement(i, path, pos); if (element != null) return element; } } return null; } /** Get the , fall back to */ private QName getXmlType(JavaXmlTypeMapping typeMapping) { QName xmlType = typeMapping.getRootTypeQName(); if (xmlType == null && typeMapping.getAnonymousTypeQName() != null) xmlType = typeMapping.getAnonymousTypeQName(); return xmlType; } // Inner public static class SoapCharactersHandler extends CharactersHandler { public Object unmarshalEmpty(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData) { return ""; } public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { return value; } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { SOAPElement e = (SOAPElement)owner; Text textNode = e.getOwnerDocument().createTextNode((String)value); e.appendChild(textNode); } } public static class SoapElementHandler extends RtElementHandler implements ParticleHandler { private SOAPFactory factory; public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { SOAPFactory factory = getFactory(); SOAPElement element = null; try { String prefix = elementName.getPrefix(); String ns = elementName.getNamespaceURI(); if (ns != null && ns.length() > 0) { prefix = nsCtx.getPrefix(ns); } element = factory.createElement(elementName.getLocalPart(), prefix, ns); } catch (SOAPException e) { throw new IllegalStateException("Failed to create SOAPElement", e); } if (attrs != null) { for (int i = 0; i < attrs.getLength(); ++i) { element.setAttribute(attrs.getLocalName(i), attrs.getValue(i)); } } return element; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if (parent instanceof SOAPElement) { ((SOAPElement)parent).appendChild((Element)o); } else { super.setParent(parent, o, elementName, particle, parentParticle); } } private SOAPFactory getFactory() { if (factory == null) { try { factory = SOAPFactory.newInstance(); } catch (SOAPException e) { throw new IllegalStateException("Failed to create soap element factory", e); } } return factory; } } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshaller.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000000323110542776150031512 0ustar godgod/* * 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.core.jaxrpc.binding.jbossxb; import java.io.OutputStream; import java.io.Writer; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; /** * @author Heiko Braun * @version $Id: JBossXBMarshaller.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ * @since Jul 5, 2006 */ public interface JBossXBMarshaller { void marshal(Object obj, Writer writer) throws MarshalException; void marshal(Object obj, ContentHandler handler); void marshal(Object obj, Node node); void marshal(Object obj, OutputStream os) throws MarshalException; Object getProperty(String name); void setProperty(String name, Object value); } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/MarshalException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000000272010542776150031514 0ustar godgod/* * 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.core.jaxrpc.binding.jbossxb; /** * A marshal exception. * * @author Thomas.Diesler@jboss.org * @since 06-Jun-2006 */ public class MarshalException extends Exception { public MarshalException() { super(); } public MarshalException(String msg, Throwable th) { super(msg, th); } public MarshalException(String msg) { super(msg); } public MarshalException(Throwable th) { super(th); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBConstants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000000347510542776150031524 0ustar godgod/* * 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.core.jaxrpc.binding.jbossxb; // $Id: JBossXBConstants.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** JBossXB Constants * * @author Thomas.Diesler@jboss.org * @since 18-Oct-2004 */ public interface JBossXBConstants { /** Set this property with a Reader to the xsdSchema */ String JBXB_SCHEMA_READER = "org.jboss.xb.xsd.reader"; /** Set this property with a the QName of the root element */ String JBXB_ROOT_QNAME = "org.jboss.xb.root.qname"; /** Set this property with a the QName of the root type */ String JBXB_TYPE_QNAME = "org.jboss.xb.type.qname"; /** Set this property with an instance of JavaWsdlMapping */ String JBXB_JAVA_MAPPING = "org.jboss.xb.java.mapping"; /** Set this property to the XSModel to pull schema info from */ String JBXB_XS_MODEL = "org.jboss.xb.xsd.xsmodel"; } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBMarshallerImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000001777610650145103031521 0ustar godgod/* * 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.core.jaxrpc.binding.jbossxb; // $Id: JBossXBMarshallerImpl.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.HashMap; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping; import org.jboss.wsf.common.JavaUtils; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; /** * An implementation of a JAXB Marshaller that uses the JBossXB schema binding marshaller. * * @author Thomas.Diesler@jboss.org * @author Heiko.Braun@jboss.org * @since 05-Jul-2006 */ public class JBossXBMarshallerImpl implements JBossXBMarshaller { // provide logging private static final Logger log = Logger.getLogger(JBossXBMarshallerImpl.class); // The marshaller properties private HashMap properties = new HashMap(); private MarshallerImpl delegate; public JBossXBMarshallerImpl() { //ClassInfos.disableCache(); delegate = new MarshallerImpl(); delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_XML_VERSION, "false"); delegate.setProperty(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_INDENTATION, "false"); delegate.declareNamespace("xsi", Constants.NS_XML_SCHEMA_INSTANCE); delegate.setSupportNil(true); } /** * Marshal the content tree rooted at obj into a Writer. */ public void marshal(Object obj, Writer writer) throws MarshalException { assertRequiredProperties(); try { QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME); delegate.addRootElement(xmlName); QName xmlType = (QName)getProperty(JBossXBConstants.JBXB_TYPE_QNAME); boolean isAnonymousType = (xmlType != null && xmlType.getLocalPart().startsWith(">")); if (xmlType != null && !isAnonymousType) { delegate.setRootTypeQName(xmlType); } if (xmlName.getNamespaceURI().length() > 0) { String prefix = xmlName.getPrefix(); String nsURI = xmlName.getNamespaceURI(); delegate.declareNamespace(prefix, nsURI); } // wildcards still need to be mapped // todo: cleanup XB API JavaWsdlMapping wsdlMapping = (JavaWsdlMapping)getProperty(JBossXBConstants.JBXB_JAVA_MAPPING); if (wsdlMapping != null) { JavaXmlTypeMapping[] javaXmlMappings = wsdlMapping.getJavaXmlTypeMappings(); if (javaXmlMappings != null) { for (int i = 0; i < javaXmlMappings.length; ++i) { JavaXmlTypeMapping javaXmlMapping = javaXmlMappings[i]; VariableMapping[] variableMappings = javaXmlMapping.getVariableMappings(); if (variableMappings != null) { String clsName = javaXmlMapping.getJavaType(); Class cls = JavaUtils.loadJavaType(clsName, Thread.currentThread().getContextClassLoader()); QName clsQName = javaXmlMapping.getRootTypeQName(); if (clsQName != null) { // TODO: legacy API usage, see JBWS-1091 if ("complexType".equalsIgnoreCase(javaXmlMapping.getQnameScope())) { delegate.mapClassToXsiType(cls, clsQName.getNamespaceURI(), clsQName.getLocalPart()); } } for (int j = 0; j < variableMappings.length; ++j) { VariableMapping variableMapping = variableMappings[j]; if (variableMapping.getXmlWildcard()) { delegate.mapFieldToWildcard(cls, "_any", JBossXBSupport.getWildcardMarshaller()); } } } } } } // the actual marshalling SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties); schemaBinding.setXopMarshaller(new XOPMarshallerImpl()); delegate.marshal(schemaBinding, null, obj, writer); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new MarshalException(e); } } /** * Marshal the content tree rooted at obj into SAX2 events. */ public void marshal(Object obj, ContentHandler handler) { throw new NotImplementedException(); } /** * Marshal the content tree rooted at obj into a DOM tree. */ public void marshal(Object obj, Node node) { throw new NotImplementedException(); } /** * Marshal the content tree rooted at obj into an output stream. */ public void marshal(Object obj, OutputStream os) throws MarshalException { marshal(obj, new OutputStreamWriter(os)); } /** * Get the particular property in the underlying implementation of * Marshaller. */ public Object getProperty(String name) { if (name == null) throw new IllegalArgumentException("name parameter is null"); return properties.get(name); } /** * Set the particular property in the underlying implementation of * Marshaller. * */ public void setProperty(String name, Object value) { if (name == null) throw new IllegalArgumentException("name parameter is null"); properties.put(name, value); } /** * Get a DOM tree view of the content tree(Optional). */ public Node getNode(Object contentTree) { throw new NotImplementedException(); } /** * Assert the required properties */ private void assertRequiredProperties() { if (getProperty(JBossXBConstants.JBXB_SCHEMA_READER) == null && getProperty(JBossXBConstants.JBXB_XS_MODEL) == null) throw new WSException("Cannot find required property: " + JBossXBConstants.JBXB_XS_MODEL); if (getProperty(JBossXBConstants.JBXB_JAVA_MAPPING) == null) throw new WSException("Cannot find required property: " + JBossXBConstants.JBXB_JAVA_MAPPING); QName xmlName = (QName)getProperty(JBossXBConstants.JBXB_ROOT_QNAME); if (xmlName == null) throw new WSException("Cannot find required property: " + JBossXBConstants.JBXB_ROOT_QNAME); if (xmlName.getNamespaceURI().length() > 0 && xmlName.getPrefix().length() == 0) throw new IllegalArgumentException("The given root element name must be prefix qualified: " + xmlName); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBSupport.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000000765210542776150031525 0ustar godgodpackage org.jboss.ws.core.jaxrpc.binding.jbossxb; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.xb.binding.MarshallingContext; import org.jboss.xb.binding.ObjectLocalMarshaller; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.util.Dom2Sax; import org.w3c.dom.Element; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * @author Heiko Braun * @since May 31, 2006 */ public class JBossXBSupport { /** * Setup SchemaBinding associated with the ServiceMetaData. * In case of an unconfigured call it will be generated from JAXB properties. *

      * The SchemaBinding expects to have an element binding for the * incomming xml element. Because the same element name can be reused * by various operations with different xml types, we have to add the * element binding on every invocation. * * @see JBossXBConstants#JBXB_ROOT_QNAME * @see JBossXBConstants#JBXB_TYPE_QNAME */ public static SchemaBinding getOrCreateSchemaBinding(Map properties) { SchemaBinding schemaBinding = null; SchemaBindingBuilder bindingBuilder = new SchemaBindingBuilder(); QName xmlName = (QName)properties.get(JBossXBConstants.JBXB_ROOT_QNAME); QName xmlType = (QName)properties.get(JBossXBConstants.JBXB_TYPE_QNAME); // Get the eagerly initialized SchemaBinding from the ServiceMetaData CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null) { OperationMetaData opMetaData = msgContext.getOperationMetaData(); EndpointMetaData epMetaData = opMetaData.getEndpointMetaData(); ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData(); schemaBinding = serviceMetaData.getSchemaBinding(); } // In case of an unconfigured call generate the SchemaBinding from JAXB properties if (schemaBinding == null) { JBossXSModel xsModel = (JBossXSModel)properties.get(JBossXBConstants.JBXB_XS_MODEL); JavaWsdlMapping wsdlMapping = (JavaWsdlMapping)properties.get(JBossXBConstants.JBXB_JAVA_MAPPING); schemaBinding = bindingBuilder.buildSchemaBinding(xsModel, wsdlMapping); } // The SchemaBinding expects to have an element binding for the // incomming xml element. Because the same element name can be reused // by various operations with different xml types, we have to add the // element binding on every invocation. bindingBuilder.bindParameterToElement(schemaBinding, xmlName, xmlType); return schemaBinding; } /** * Create a Marshaller that serializes * org.w3c.dom.Element's to a org.xml.sax.ContentHandler * * @return ObjectLocalMarshaller * * @see org.jboss.xb.binding.MarshallingContext#getContentHandler() */ public static ObjectLocalMarshaller getWildcardMarshaller() { return new ObjectLocalMarshaller() { public void marshal(MarshallingContext ctx, Object o) { if (o == null) { return; } Element e = (Element)o; ContentHandler ch = ctx.getContentHandler(); try { Dom2Sax.dom2sax(e, ch); } catch (SAXException e1) { throw new IllegalStateException("Failed to marshal DOM element " + new QName(e.getNamespaceURI(), e.getLocalName()) + ": " + e1.getMessage()); } } }; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/JBossXBUnmarshaller.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000000265010602437471031513 0ustar godgod/* * 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.core.jaxrpc.binding.jbossxb; // $Id: JBossXBUnmarshaller.java 2702 2007-03-28 10:11:05Z thomas.diesler@jboss.com $ import java.io.InputStream; /** * @author Heiko Braun * @since Jul 5, 2006 */ public interface JBossXBUnmarshaller { Object unmarshal(InputStream is) throws UnmarshalException; Object getProperty(String name); void setProperty(String name, Object value); } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/UnmarshalException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/jbossxb/0000644000175000017500000000273210542776150031517 0ustar godgod/* * 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.core.jaxrpc.binding.jbossxb; /** * A marshal exception. * * @author Thomas.Diesler@jboss.org * @since 06-Jun-2006 */ public class UnmarshalException extends Exception { public UnmarshalException() { super(); } public UnmarshalException(String msg, Throwable th) { super(msg, th); } public UnmarshalException(String msg) { super(msg); } public UnmarshalException(Throwable th) { super(th); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/HexSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/HexSeria0000644000175000017500000000477710650145103031475 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: HexSerializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.wsf.common.JavaUtils; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.SimpleTypeBindings; import org.w3c.dom.NamedNodeMap; /** * Serializer for hexBinary. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 * @see XML Schema 3.2.16 */ public class HexSerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(HexSerializer.class); public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { if(log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); value = JavaUtils.getPrimitiveValueArray(value); String valueStr = SimpleTypeBindings.marshalHexBinary((byte[])value); NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, null, attributes, true); return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/JBossXBD0000644000175000017500000000317310642000211031317 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: JBossXBDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Deserializer that can handle complex types * by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class JBossXBDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() throws BindingException { return new JBossXBDeserializer(); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/ElementSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/ElementS0000644000175000017500000000300210642000211031444 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: ElementSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Serializer that can handle xsd:anyType * * @author Thomas.Diesler@jboss.org * @since 23-Jun-2005 */ public class ElementSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() { return new ElementSerializer(); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SimpleSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SimpleSe0000644000175000017500000000301410642000211031454 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: SimpleSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Serializer that can handle XMLSchema simple types. * * @author Thomas.Diesler@jboss.org * @since 18-Oct-2004 */ public class SimpleSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() { return new SimpleSerializer(); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/JBossXBDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/JBossXBD0000644000175000017500000001101410642000211031310 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: JBossXBDeserializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.io.ByteArrayInputStream; import javax.xml.namespace.QName; import javax.xml.transform.Source; import org.apache.xerces.xs.XSModel; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.ComplexTypeDeserializer; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC; import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants; import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshaller; import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; /** * A Deserializer that can handle complex types by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class JBossXBDeserializer extends ComplexTypeDeserializer { // provide logging private static final Logger log = Logger.getLogger(JBossXBDeserializer.class); private JBossXBUnmarshaller unmarshaller; public JBossXBDeserializer() throws BindingException { // Get the JAXB marshaller for complex objects unmarshaller = new JBossXBUnmarshallerImpl(); } public Object deserialize(QName xmlName, QName xmlType, Source source, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(source), serContext); } /** * For unmarshalling the WS layer passes to the JAXB layer * * - required self contained xml content * - required map of packaged or generated XSDSchema * - optional QName of the root complex type * - optional instance of JavaWsdlMapping * * The xmlType is redundant if the root element name corresponds to a global element definition in schema. * If the java mapping is null, default mapping rules apply. * * The result is an object instance or null. * In case of an unmarshalling problem a descriptive exception is thrown. */ private Object deserialize(QName xmlName, QName xmlType, String val, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); // Expect the specific JAXRPC serialization context SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext; Object value = null; String typeName = xmlType.getLocalPart(); try { // Get the parsed model XSModel model = jaxrpcContext.getXsModel(); // Get the jaxrpc-mapping.xml meta data JavaWsdlMapping jaxrpcMapping = jaxrpcContext.getJavaWsdlMapping(); unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model); unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName); unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType); unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, jaxrpcMapping); ByteArrayInputStream ins = new ByteArrayInputStream(val.getBytes("UTF-8")); value = unmarshaller.unmarshal(ins); } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new BindingException(ex); } if(log.isDebugEnabled()) log.debug("deserialized: " + (value != null ? value.getClass().getName() : null)); return value; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/QNameSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/QNameSer0000644000175000017500000000275410642000211031420 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: QNameSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * SerializerFactory for QName primitive * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class QNameSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() { return new QNameSerializer(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Base64Serializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Base64Se0000644000175000017500000000641610650145103031271 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: Base64Serializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.extensions.xop.jaxrpc.XOPMarshallerImpl; import org.jboss.wsf.common.JavaUtils; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.sunday.xop.XOPMarshaller; import org.jboss.xb.binding.sunday.xop.XOPObject; import org.w3c.dom.NamedNodeMap; /** * Serializer for base64 * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class Base64Serializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(Base64Serializer.class); public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { if (log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); String xmlFragment = null; NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); if (XOPContext.isXOPMessage()) { XOPMarshaller xopMarshaller = new XOPMarshallerImpl(); XOPObject xopObject = new XOPObject(value); xopObject.setContentType("application/octet-stream"); String cid = xopMarshaller.addMtomAttachment(xopObject, xmlName.getNamespaceURI(), xmlType.getLocalPart()); String xopInclude = ""; xmlFragment = wrapValueStr(xmlName, xopInclude, nsRegistry, null, attributes, false); } else { value = JavaUtils.getPrimitiveValueArray(value); String valueStr = SimpleTypeBindings.marshalBase64((byte[])value); xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, null, attributes, true); } return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/DateDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/DateDese0000644000175000017500000000461710642000211031423 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: DateDeserializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.Calendar; import java.util.Date; import javax.xml.namespace.QName; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.xb.binding.SimpleTypeBindings; /** * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class DateDeserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(DateDeserializer.class); public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(xmlFragment), serContext); } private Object deserialize(QName xmlName, QName xmlType, String xmlFragment, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); Date value = null; String valueStr = unwrapValueStr(xmlFragment); if (valueStr != null) { Calendar cal = SimpleTypeBindings.unmarshalDateTime(valueStr); value = cal.getTime(); } return value; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPArra0000644000175000017500000002300710650145103031320 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: SOAPArraySerializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.soap.NameImpl; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.wsf.common.JavaUtils; import org.w3c.dom.NamedNodeMap; /** * A Serializer that can handle SOAP encoded arrays. * * @author Thomas.Diesler@jboss.org * @since 31-Oct-2005 */ public class SOAPArraySerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(SOAPArraySerializer.class); private ParameterMetaData paramMetaData; private SerializerSupport compSerializer; private NullValueSerializer nullSerializer; private boolean isArrayComponentType; private StringBuilder buffer; public SOAPArraySerializer() throws BindingException { nullSerializer = new NullValueSerializer(); } public Result serialize(SOAPContentElement soapElement, SerializationContext serContext) throws BindingException { paramMetaData = soapElement.getParamMetaData(); QName xmlName = soapElement.getElementQName(); QName xmlType = soapElement.getXmlType(); Object value = soapElement.getObjectValue(); NamedNodeMap attributes = soapElement.getAttributes(); return serialize(xmlName, xmlType, value, serContext, attributes); } public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + ",valueType=" + value.getClass().getName() + "]"); try { if (paramMetaData == null) throw new IllegalStateException("Use serialize(SOAPContenentElement, SerializationContext)"); QName compXmlName = paramMetaData.getXmlName(); QName compXmlType = paramMetaData.getSOAPArrayCompType(); Class javaType = paramMetaData.getJavaType(); Class compJavaType = javaType.getComponentType(); isArrayComponentType = isArrayJavaType(compJavaType) && isArrayXmlType(compXmlType); while (compJavaType.getComponentType() != null && isArrayComponentType == false) { compJavaType = compJavaType.getComponentType(); isArrayComponentType = isArrayJavaType(compJavaType) && isArrayXmlType(compXmlType); } TypeMappingImpl typeMapping = serContext.getTypeMapping(); if (compXmlType == null) { compXmlType = typeMapping.getXMLType(compJavaType); paramMetaData.setSOAPArrayCompType(compXmlType); } if (compXmlType == null) throw new WSException("Cannot obtain component xmlType for: " + compJavaType); // Get the component type serializer factory log.debug("Get component serializer for: [javaType=" + compJavaType.getName() + ",xmlType=" + compXmlType + "]"); AbstractSerializerFactory compSerializerFactory = (AbstractSerializerFactory)typeMapping.getSerializer(compJavaType, compXmlType); if (compSerializerFactory == null) { log.warn("Cannot obtain component serializer for: [javaType=" + compJavaType.getName() + ",xmlType=" + compXmlType + "]"); compSerializerFactory = (AbstractSerializerFactory)typeMapping.getSerializer(null, compXmlType); } if (compSerializerFactory == null) throw new WSException("Cannot obtain component serializer for: " + compXmlType); // Get the component type serializer compSerializer = (SerializerSupport)compSerializerFactory.getSerializer(); // Get the corresponding wrapper type if (JavaUtils.isPrimitive(value.getClass())) value = JavaUtils.getWrapperValueArray(value); String nodeName = new NameImpl(compXmlName).getQualifiedName(); buffer = new StringBuilder("<" + nodeName + " xmlns:" + Constants.PREFIX_SOAP11_ENC + "='" + Constants.URI_SOAP11_ENC + "' "); if (!(value instanceof Object[])) throw new WSException("Unsupported array type: " + javaType); Object[] objArr = (Object[])value; String arrayDim = "" + objArr.length; // Get multiple array dimension Object[] subArr = (Object[])value; while (isArrayComponentType == false && subArr.length > 0 && subArr[0] instanceof Object[]) { subArr = (Object[])subArr[0]; arrayDim += "," + subArr.length; } compXmlType = serContext.getNamespaceRegistry().registerQName(compXmlType); compXmlName = serContext.getNamespaceRegistry().registerQName(compXmlName); String arrayType = Constants.PREFIX_SOAP11_ENC + ":arrayType='" + compXmlType.getPrefix() + ":" + compXmlType.getLocalPart() + "[" + arrayDim + "]'"; buffer.append(arrayType); buffer.append(" xmlns:" + Constants.PREFIX_XSI + "='" + Constants.NS_SCHEMA_XSI + "'"); if (compXmlType.getNamespaceURI().equals(Constants.URI_SOAP11_ENC) == false) buffer.append(" xmlns:" + compXmlType.getPrefix() + "='" + compXmlType.getNamespaceURI() + "'"); if (compXmlName.getNamespaceURI().length() > 0 && compXmlName.getNamespaceURI().equals(compXmlType.getNamespaceURI()) == false) buffer.append(" xmlns:" + compXmlName.getPrefix() + "='" + compXmlName.getNamespaceURI() + "'"); buffer.append(">"); serializeArrayComponents(compXmlName, compXmlType, serContext, objArr); buffer.append(""); String xmlFragment = buffer.toString(); log.debug("serialized: " + xmlFragment); return new BufferedStreamResult(xmlFragment); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new BindingException(e); } } private void serializeArrayComponents(QName xmlName, QName xmlType, SerializationContext serContext, Object[] objArr) throws BindingException { for (Object compValue : objArr) { if (isArrayComponentType == false && compValue instanceof Object[]) { serializeArrayComponents(xmlName, xmlType, serContext, (Object[])compValue); } else { SerializerSupport ser = compSerializer; // Null component value if (compValue == null) { ser = nullSerializer; } Result result = ser.serialize(new QName("item"), xmlType, compValue, serContext, null); buffer.append(new XMLFragment(result).toXMLString()); } } } /** True for all array xmlTypes, i.e. nmtokens, base64Binary, hexBinary * * FIXME: This method should be removed as soon as we can reliably get the SOAP * arrayType from wsdl + schema. */ private boolean isArrayXmlType(QName xmlType) { boolean isArrayType = Constants.TYPE_SOAP11_BASE64.equals(xmlType); isArrayType = isArrayType || Constants.TYPE_SOAP11_BASE64.equals(xmlType); isArrayType = isArrayType || Constants.TYPE_SOAP11_BASE64BINARY.equals(xmlType); isArrayType = isArrayType || Constants.TYPE_SOAP11_HEXBINARY.equals(xmlType); isArrayType = isArrayType || Constants.TYPE_SOAP11_NMTOKENS.equals(xmlType); isArrayType = isArrayType || Constants.TYPE_LITERAL_BASE64BINARY.equals(xmlType); isArrayType = isArrayType || Constants.TYPE_LITERAL_HEXBINARY.equals(xmlType); isArrayType = isArrayType || Constants.TYPE_LITERAL_NMTOKENS.equals(xmlType); return isArrayType; } /** True for all array javaTypes, i.e. String[], Byte[], byte[] * * FIXME: This method should be removed as soon as we can reliably get the SOAP * arrayType from wsdl + schema. */ private boolean isArrayJavaType(Class javaType) { boolean isBinaryType = String[].class.equals(javaType) || Byte[].class.equals(javaType) || byte[].class.equals(javaType); return isBinaryType; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/ElementSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/ElementS0000644000175000017500000000515410650145103031467 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: ElementSerializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * A serializer that can handle xsd:anyType * * @author Thomas.Diesler@jboss.org * @since 18-Oct-2004 */ public class ElementSerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(ElementSerializer.class); /** Marshal the value for a given XMLSchema type * @param xmlType local part of the schema type * @param value the value to marshal * @param serContext * @return the string representation od the value */ public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); if (value == null) throw new IllegalArgumentException("Element value cannot be null"); if ((value instanceof Element) == false) throw new IllegalArgumentException("Value is not a Element: " + value.getClass().getName()); String xmlFragment = DOMWriter.printNode((Element)value, false); return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SimpleSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SimpleSe0000644000175000017500000000556510642000211031471 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: SimpleSerializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.SimpleTypeBindings; import org.w3c.dom.NamedNodeMap; /** * A serializer that can handle XMLSchema simple types. * * @author Thomas.Diesler@jboss.org * @since 18-Oct-2004 */ public class SimpleSerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(SimpleSerializer.class); /** Marshal the value for a given XMLSchema type * @param xmlType local part of the schema type * @param value the value to marshal * @param serContext * @return the string representation od the value */ public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { if(log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); String valueStr; String typeName = xmlType.getLocalPart(); NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); if ("base64Binary".equals(typeName)) { throw new NotImplementedException(); } else { valueStr = SimpleTypeBindings.marshal(xmlType.getLocalPart(), value, nsRegistry); } String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, null, attributes, true); return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPArraySerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPArra0000644000175000017500000000313510642000211031307 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: SOAPArraySerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Serializer that can handle SOAP encoded arrays. * * @author Thomas.Diesler@jboss.org * @since 31-Oct-2005 */ public class SOAPArraySerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() throws BindingException { return new SOAPArraySerializer(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/QNameSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/QNameSer0000644000175000017500000000550110642000211031411 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: QNameSerializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.HashSet; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.SimpleTypeBindings; import org.w3c.dom.NamedNodeMap; /** * Serializer for QNames. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class QNameSerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(QNameSerializer.class); public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); QName qnameValue = (QName)value; String nsURI = qnameValue.getNamespaceURI(); NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); Set nsExtras = new HashSet(); // Remove prefix and register again if (nsURI.length() > 0) { qnameValue = new QName(nsURI, qnameValue.getLocalPart()); qnameValue = nsRegistry.registerQName(qnameValue); if (nsURI.equals(xmlName.getNamespaceURI()) == false) nsExtras.add(nsURI); } String valueStr = SimpleTypeBindings.marshalQName(qnameValue, nsRegistry); String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, nsExtras, attributes, true); return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/ElementDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/ElementD0000644000175000017500000000304110642000211031430 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: ElementDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Deserializer that can handle XMLSchema simple types. * * @author Thomas.Diesler@jboss.org * @since 18-Oct-2004 */ public class ElementDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() { return new ElementDeserializer(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SimpleDe0000644000175000017500000000303610642000211031441 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: SimpleDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Deserializer that can handle XMLSchema simple types. * * @author Thomas.Diesler@jboss.org * @since 18-Oct-2004 */ public class SimpleDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() { return new SimpleDeserializer(); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPElem0000644000175000017500000000305510642000211031305 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: SOAPElementDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Deserializer that can handle XMLSchema simple types. * * @author Thomas.Diesler@jboss.org * @since 18-Oct-2004 */ public class SOAPElementDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() { return new SOAPElementDeserializer(); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPArra0000644000175000017500000000315610642000211031312 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: SOAPArrayDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Deserializer that can handle SOAP encoded arrays. * * @author Thomas.Diesler@jboss.org * @since 31-Oct-2005 */ public class SOAPArrayDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() throws BindingException { return new SOAPArrayDeserializer(); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/QNameDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/QNameDes0000644000175000017500000000272010642000211031373 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: QNameDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class QNameDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() { return new QNameDeserializer(); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPElementSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPElem0000644000175000017500000000301610642000211031302 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: SOAPElementSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Serializer that can handle xsd:anyType * * @author Thomas.Diesler@jboss.org * @since 23-Jun-2005 */ public class SOAPElementSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() { return new SOAPElementSerializer(); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/DateSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/DateSeri0000644000175000017500000000275110642000211031442 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: DateSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * SerializerFactory for Date primitives * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class DateSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() { return new DateSerializer(); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/NullValueSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/NullValu0000644000175000017500000000530010642000211031475 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: NullValueSerializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.NamedNodeMap; /** * Serializer for null values. * * @author Thomas.Diesler@jboss.org * @since 24-Jun-2005 */ public class NullValueSerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(NullValueSerializer.class); /** * Serializes an object null value. * * If a message part of an RPC parameter is defined like this * * * * * * it is possible that the element definition does not allow * null values. In that case an error should be generated. */ public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); nsRegistry.registerURI(Constants.NS_SCHEMA_XSI, Constants.PREFIX_XSI); String xmlFragment = wrapValueStr(xmlName, null, nsRegistry, null, attributes, true); return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/JBossXBS0000644000175000017500000001131110642000211031327 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: JBossXBSerializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.io.StringWriter; import javax.xml.namespace.QName; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; import org.apache.xerces.xs.XSModel; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.ComplexTypeSerializer; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC; import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBConstants; import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshaller; import org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBMarshallerImpl; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.w3c.dom.NamedNodeMap; /** * A Serializer that can handle complex types by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class JBossXBSerializer extends ComplexTypeSerializer { // provide logging private static final Logger log = Logger.getLogger(JBossXBSerializer.class); private JBossXBMarshaller marshaller; public JBossXBSerializer() throws BindingException { // Get the JAXB marshaller for complex objects marshaller = new JBossXBMarshallerImpl(); } /** * For marshalling the WS layer passes to the JAXB layer * * - optional java object instance * - required map of packaged or generated XSDSchema * - required QName of the root element * - optional QName of the root complex type * - optional instance of JavaWsdlMapping * * If the object value is null, the corresponding XML representation of the nillable element should be marshalled. * The xmlType is redundant if the xmlName corresponds to a global element definition in schema. * If the java mapping is null, default mapping rules apply. * * The result is a self contained (i.e. contains all namespace definitions) XML document without the XML declaration. * In case of an marshalling problem a descriptive exception is thrown. */ public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); // Expect the specific JAXRPC serialization context SerializationContextJAXRPC jaxrpcContext = (SerializationContextJAXRPC)serContext; try { // Get the parsed model XSModel model = jaxrpcContext.getXsModel(); // Get the jaxrpc-mapping.xml object graph JavaWsdlMapping jaxrpcMapping = jaxrpcContext.getJavaWsdlMapping(); // schemabinding marshaller is the default delegate JBossXBMarshaller delegate = marshaller; // marshalling context delegate.setProperty(JBossXBConstants.JBXB_XS_MODEL, model); delegate.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType); delegate.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName); delegate.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, jaxrpcMapping); // marshall StringWriter strwr = new StringWriter(); delegate.marshal(value, strwr); String xmlFragment = strwr.toString(); log.debug("serialized: " + xmlFragment); return new BufferedStreamResult(xmlFragment); } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new BindingException(ex); } } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/HexSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/HexSeria0000644000175000017500000000274110642000211031451 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: HexSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * SerializerFactory for hexBinary. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class HexSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() { return new HexSerializer(); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Base64SerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Base64Se0000644000175000017500000000275410642000211031261 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: Base64SerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * SerializerFactory for base64Binary. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class Base64SerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() { return new Base64Serializer(); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/DateSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/DateSeri0000644000175000017500000000521510642000211031440 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: DateSerializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import javax.xml.namespace.QName; import javax.xml.transform.Result; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.SimpleTypeBindings; import org.w3c.dom.NamedNodeMap; /** * Serializer for Dates. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 * @see XML Schema 3.2.16 */ public class DateSerializer extends SerializerSupport { // provide logging private static final Logger log = Logger.getLogger(DateSerializer.class); public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { if(log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); if (value != null) { Calendar cal = new GregorianCalendar(); cal.setTime((Date)value); value = cal; } String valueStr = SimpleTypeBindings.marshalDateTime((Calendar)value); NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); String xmlFragment = wrapValueStr(xmlName, valueStr, nsRegistry, null, attributes, true); return new BufferedStreamResult(xmlFragment); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/DateDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/DateDese0000644000175000017500000000275610642000211031425 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: DateDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A DateDeserializer Factory * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class DateDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() { return new DateDeserializer(); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/CalendarDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Calendar0000644000175000017500000000560410642000211031453 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: CalendarDeserializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.Calendar; import javax.xml.namespace.QName; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.xb.binding.SimpleTypeBindings; /** * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 * @see XML Schema 3.2.16 */ public class CalendarDeserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(CalendarDeserializer.class); public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(xmlFragment), serContext); } private Object deserialize(QName xmlName, QName xmlType, String xmlFragment, SerializationContext serContext) throws BindingException { if (log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); Calendar value = null; String valueStr = unwrapValueStr(xmlFragment); if (valueStr != null) { if (Constants.TYPE_LITERAL_DATE.equals(xmlType)) value = SimpleTypeBindings.unmarshalDate(valueStr); else if (Constants.TYPE_LITERAL_TIME.equals(xmlType)) value = SimpleTypeBindings.unmarshalTime(valueStr); else if (Constants.TYPE_LITERAL_DATETIME.equals(xmlType)) value = SimpleTypeBindings.unmarshalDateTime(valueStr); else throw new IllegalArgumentException("Invalid xmlType: " + xmlType); } return value; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/HexDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/HexDeser0000644000175000017500000000276310642000211031454 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: HexDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * DeserializerFactory for hexBinary. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class HexDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() { return new HexDeserializer(); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Base64DeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Base64De0000644000175000017500000000277110642000211031241 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: Base64DeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * DeserializerFactory for base64. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class Base64DeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() { return new Base64Deserializer(); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/BufferedStreamSource.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Buffered0000644000175000017500000000643510660617420031507 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: BufferedStreamSource.java 4379 2007-08-15 15:43:12Z darran.lofthouse@jboss.com $ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.CharArrayReader; import java.io.CharArrayWriter; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import javax.xml.transform.stream.StreamSource; import org.jboss.ws.WSException; import org.jboss.wsf.common.IOUtils; /** * A StreamSource that can be read repeatedly. * * @author Thomas.Diesler@jboss.org * @since 29-Mar-2007 */ public class BufferedStreamSource extends StreamSource { private byte[] bytes; private char[] chars; public BufferedStreamSource(StreamSource source) { try { InputStream ins = source.getInputStream(); if (ins != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); IOUtils.copyStream(baos, ins); bytes = baos.toByteArray(); } Reader rd = source.getReader(); if (ins == null && rd != null) { char[] auxbuf = new char[1024]; CharArrayWriter wr = new CharArrayWriter(auxbuf.length); int r = rd.read(auxbuf); while (r > 0) { wr.write(auxbuf, 0, r); r = rd.read(auxbuf); } chars = wr.toCharArray(); } } catch (IOException ex) { WSException.rethrow(ex); } } public BufferedStreamSource(byte[] bytes) { this.bytes = bytes; } @Override public InputStream getInputStream() { return (bytes != null ? new ByteArrayInputStream(bytes) : null); } @Override public Reader getReader() { return (chars != null ? new CharArrayReader(chars) : null); } @Override public void setInputStream(InputStream inputStream) { throw new UnsupportedOperationException(); } @Override public void setReader(Reader reader) { throw new UnsupportedOperationException(); } public String toString() { String retStr = null; if (bytes != null) retStr = new String(bytes); else if (chars != null) retStr = new String(chars); return "" + retStr; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPElementDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SOAPElem0000644000175000017500000000526710650145103031325 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: SOAPElementDeserializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.soap.SOAPFactoryImpl; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Element; /** * A deserializer that can handle xsd:anyType * * @author Thomas.Diesler@jboss.org * @since 23-Jun-2005 */ public class SOAPElementDeserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(SOAPElementDeserializer.class); public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(xmlFragment), serContext); } private Object deserialize(QName xmlName, QName xmlType, String xmlFragment, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); try { // TODO: Better way for DOM to source conversion Element domElement = DOMUtils.parse(xmlFragment); SOAPElement soapElement = new SOAPFactoryImpl().createElement(domElement); return soapElement; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new BindingException(); } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/HexDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/HexDeser0000644000175000017500000000465310642000211031454 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: HexDeserializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.xb.binding.SimpleTypeBindings; /** * Deserializer for hexBinary. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 * @see XML Schema 3.2.16 */ public class HexDeserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(HexDeserializer.class); public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(xmlFragment), serContext); } private Object deserialize(QName xmlName, QName xmlType, String xmlFragment, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); byte[] value = null; String valueStr = unwrapValueStr(xmlFragment); if (valueStr != null) { value = SimpleTypeBindings.unmarshalHexBinary(valueStr); } return value; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Base64Deserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Base64De0000644000175000017500000000612510650145103031247 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: Base64Deserializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.extensions.xop.jaxrpc.XOPUnmarshallerImpl; import org.jboss.wsf.common.DOMUtils; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller; import org.w3c.dom.Element; /** * Deserializer for Base64 * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class Base64Deserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(Base64Deserializer.class); public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(xmlFragment), serContext); } private Object deserialize(QName xmlName, QName xmlType, String xmlFragment, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); byte[] value = null; String valueStr = unwrapValueStr(xmlFragment); if(XOPContext.isXOPMessage()) { try { Element xopInclude = DOMUtils.parse(valueStr); String cid = xopInclude.getAttribute("href"); XOPUnmarshaller xopUnmarshaller = new XOPUnmarshallerImpl(); value = xopUnmarshaller.getAttachmentAsByteArray(cid); } catch (IOException e) { throw new WSException("Failed to parse xopInclude element"); } } else if (valueStr != null) { value = SimpleTypeBindings.unmarshalBase64(valueStr); } return value; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/CalendarSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/Calendar0000644000175000017500000000271110642000211031447 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: CalendarSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class CalendarSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() { return new CalendarSerializer(); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/JBossXBSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/JBossXBS0000644000175000017500000000315310642000211031334 0ustar godgod/* * 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.core.jaxrpc.binding; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: JBossXBSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Serializer that can handle complex types * by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class JBossXBSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() throws BindingException { return new JBossXBSerializer(); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/ElementDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/ElementD0000644000175000017500000000504510650145103031447 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: ElementDeserializer.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Element; /** * A deserializer that can handle xsd:anyType * * @author Thomas.Diesler@jboss.org * @since 23-Jun-2005 */ public class ElementDeserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(ElementDeserializer.class); public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(xmlFragment), serContext); } /** Deserialize the given simple xmlString */ private Object deserialize(QName xmlName, QName xmlType, String xmlFragment, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); try { // TODO: Better way for DOM to source conversion Element domElement = DOMUtils.parse(xmlFragment); return domElement; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new BindingException(); } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SimpleDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/binding/SimpleDe0000644000175000017500000000470110642000211031441 0ustar godgod/* * 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.core.jaxrpc.binding; // $Id: SimpleDeserializer.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.xb.binding.SimpleTypeBindings; /** * A deserializer that can handle XMLSchema simple types. * * @author Thomas.Diesler@jboss.org * @since 22-Oct-2004 */ public class SimpleDeserializer extends DeserializerSupport { // provide logging private static final Logger log = Logger.getLogger(SimpleDeserializer.class); public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { return deserialize(xmlName, xmlType, sourceToString(xmlFragment), serContext); } private Object deserialize(QName xmlName, QName xmlType, String xmlFragment, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); Object value = null; String valueStr = unwrapValueStr(xmlFragment); if (valueStr != null) { value = SimpleTypeBindings.unmarshal(xmlType.getLocalPart(), valueStr, serContext.getNamespaceRegistry()); } return value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/0000755000175000017500000000000010755000264030032 5ustar godgod././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/SOAPMessageContextJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/SOAPMess0000644000175000017500000000471310604710730031353 0ustar godgod/* * 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.core.jaxrpc.handler; // $Id: SOAPMessageContextJAXRPC.java 2757 2007-04-04 11:54:00Z thomas.diesler@jboss.com $ import javax.xml.rpc.handler.soap.SOAPMessageContext; import javax.xml.soap.SOAPMessage; import org.jboss.ws.core.CommonMessageContext; /** * Provides access to the SOAP message for either RPC request or response. * * @author Thomas.Diesler@jboss.org * @since 14-Dec-2004 */ public class SOAPMessageContextJAXRPC extends MessageContextJAXRPC implements SOAPMessageContext { /** Default constuctor */ public SOAPMessageContextJAXRPC() { } public SOAPMessageContextJAXRPC(CommonMessageContext msgContext) { super(msgContext); } public SOAPMessage getMessage() { return getSOAPMessage(); } public void setMessage(SOAPMessage message) { setSOAPMessage(message); } /** * Gets the SOAP actor roles associated with an execution of the HandlerChain and its contained Handler instances. * Note that SOAP actor roles apply to the SOAP node and are managed using HandlerChain.setRoles and HandlerChain.getRoles. * Handler instances in the HandlerChain use this information about the SOAP actor roles to process the SOAP header blocks. * Note that the SOAP actor roles are invariant during the processing of SOAP message through the HandlerChain. * * @return Array of URIs for SOAP actor roles */ public String[] getRoles() { return new String[0]; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/HandlerD0000644000175000017500000001757710623427336031466 0ustar godgod/* * 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.core.jaxrpc.handler; // $Id: HandlerDelegateJAXRPC.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Observable; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.rpc.handler.HandlerChain; import javax.xml.rpc.handler.HandlerInfo; import org.jboss.logging.Logger; import org.jboss.ws.core.RoleSource; import org.jboss.ws.core.server.ServerHandlerDelegate; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.HandlerMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** Delegates to JAXRPC handlers * * @author Thomas.Diesler@jboss.org * @since 19-Jan-2005 */ public class HandlerDelegateJAXRPC extends ServerHandlerDelegate implements RoleSource { // provide logging private static Logger log = Logger.getLogger(HandlerDelegateJAXRPC.class); // This endpoints handler chain private ServerHandlerChain preHandlerChain; // This endpoints handler chain private ServerHandlerChain jaxrpcHandlerChain; // This endpoints handler chain private ServerHandlerChain postHandlerChain; // Set of understood headers Set headers = new HashSet(); // Set of roles Set roles = new HashSet(); public HandlerDelegateJAXRPC(ServerEndpointMetaData sepMetaData) { super(sepMetaData); sepMetaData.registerConfigObserver(this); } /** * For JAXRPC PRE/POST are defined in the context of message origin. */ public HandlerType[] getHandlerTypeOrder() { return new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST }; } public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext(); // Initialize the handler chain if (isInitialized() == false) { initHandlerChain(sepMetaData, HandlerType.PRE); initHandlerChain(sepMetaData, HandlerType.ENDPOINT); initHandlerChain(sepMetaData, HandlerType.POST); setInitialized(true); } boolean status = true; HandlerChain handlerChain = null; if (type == HandlerType.PRE) handlerChain = preHandlerChain; else if (type == HandlerType.ENDPOINT) handlerChain = jaxrpcHandlerChain; else if (type == HandlerType.POST) handlerChain = postHandlerChain; if (handlerChain != null) status = handlerChain.handleRequest(msgContext); return status; } public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext(); HandlerChain handlerChain = null; if (type == HandlerType.PRE) handlerChain = preHandlerChain; else if (type == HandlerType.ENDPOINT) handlerChain = jaxrpcHandlerChain; else if (type == HandlerType.POST) handlerChain = postHandlerChain; boolean status = (handlerChain != null ? handlerChain.handleResponse(msgContext) : true); if (type == HandlerType.ENDPOINT) XOPContext.visitAndRestoreXOPData(); return status; } public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex) { SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext(); HandlerChain handlerChain = null; if (type == HandlerType.PRE) handlerChain = preHandlerChain; else if (type == HandlerType.ENDPOINT) handlerChain = jaxrpcHandlerChain; else if (type == HandlerType.POST) handlerChain = postHandlerChain; boolean status = (handlerChain != null ? handlerChain.handleFault(msgContext) : true); if (type == HandlerType.ENDPOINT) XOPContext.visitAndRestoreXOPData(); return status; } public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { // nothing to do for JAXRPC } /** * Init the handler chain */ private void initHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { Set handlerRoles = new HashSet(); List hInfos = new ArrayList(); for (HandlerMetaData handlerMetaData : sepMetaData.getHandlerMetaData(type)) { HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData; handlerRoles.addAll(jaxrpcMetaData.getSoapRoles()); HashMap hConfig = new HashMap(); for (UnifiedInitParamMetaData param : jaxrpcMetaData.getInitParams()) { hConfig.put(param.getParamName(), param.getParamValue()); } Set headers = jaxrpcMetaData.getSoapHeaders(); QName[] headerArr = new QName[headers.size()]; headers.toArray(headerArr); Class hClass = jaxrpcMetaData.getHandlerClass(); hConfig.put(HandlerType.class.getName(), jaxrpcMetaData.getHandlerType()); HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr); if (log.isDebugEnabled()) log.debug("Adding server side handler to service '" + sepMetaData.getPortName() + "': " + info); hInfos.add(info); } initHandlerChain(sepMetaData, hInfos, handlerRoles, type); } private void initHandlerChain(ServerEndpointMetaData sepMetaData, List hInfos, Set handlerRoles, HandlerType type) { if (log.isDebugEnabled()) log.debug("Init handler chain with [" + hInfos.size() + "] handlers"); ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type); if (type == HandlerType.PRE) preHandlerChain = handlerChain; else if (type == HandlerType.ENDPOINT) jaxrpcHandlerChain = handlerChain; else if (type == HandlerType.POST) postHandlerChain = handlerChain; if (handlerChain.getState() == ServerHandlerChain.STATE_CREATED) { // what is the config for a handler chain? handlerChain.init(null); } handlerChain.pullHeaders(headers); Collections.addAll(roles, handlerChain.getRoles()); } public Set getRoles() { return roles; } public Set getHeaders() { return headers; } public void update(Observable observable, Object object) { } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/ClientHandlerChain.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/ClientHa0000644000175000017500000000274610542776150031465 0ustar godgod/* * 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.core.jaxrpc.handler; // $Id: ClientHandlerChain.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.util.List; import java.util.Set; /** * Represents a list of handlers. All elements in the * HandlerChain are of the type javax.xml.rpc.handler.Handler. * * @author Thomas.Diesler@jboss.org * @since 06-May-2004 */ public class ClientHandlerChain extends HandlerChainBaseImpl { public ClientHandlerChain(List infos, Set roles) { super(infos, roles); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/MessageC0000644000175000017500000001113010704666467031461 0ustar godgod/* * 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.core.jaxrpc.handler; // $Id: MessageContextJAXRPC.java 4767 2007-10-15 13:37:59Z heiko.braun@jboss.com $ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.xml.rpc.handler.MessageContext; import javax.xml.soap.SOAPMessage; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.jaxrpc.SerializationContextJAXRPC; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.xb.binding.NamespaceRegistry; /** * The message context that is processed by a handler * in the handle method. *

      * Provides methods to manage a property set. * MessageContext properties enable handlers in a handler chain to share * processing related state. * * @author Thomas.Diesler@jboss.org * @since 06-May-2004 */ public abstract class MessageContextJAXRPC extends CommonMessageContext implements MessageContext { private static Logger log = Logger.getLogger(MessageContextJAXRPC.class); public static final String SERVLET_CONTEXT = "javax.xml.ws.servlet.context"; public static final String SERVLET_REQUEST = "javax.xml.ws.servlet.request"; public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response"; public MessageContextJAXRPC() { } public MessageContextJAXRPC(CommonMessageContext msgContext) { super(msgContext); } /** Create the serialization context */ public SerializationContext createSerializationContext() { EndpointMetaData epMetaData = getEndpointMetaData(); ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData(); SerializationContextJAXRPC jaxrpcContext = new SerializationContextJAXRPC(); jaxrpcContext.setTypeMapping(serviceMetaData.getTypeMapping()); jaxrpcContext.setJavaWsdlMapping(serviceMetaData.getJavaWsdlMapping()); return jaxrpcContext; } /** Gets the namespace registry for this message context */ public NamespaceRegistry getNamespaceRegistry() { return getSerializationContext().getNamespaceRegistry(); } public static CommonMessageContext processPivot(CommonMessageContext requestContext) { log.debug("Begin response processing"); cleanupAttachments(requestContext); return requestContext; } /** Get the message context properties */ public Map getProperties() { Map props = new HashMap(); for (String key : keySet()) { Object value = get(key); props.put(key, value); } return props; } /** * Returns true if the MessageContext contains a property with the specified name. */ public boolean containsProperty(String name) { return containsKey(name); } /** * Gets the value of a specific property from the MessageContext */ public Object getProperty(String name) { return get(name); } /** * Returns an Iterator view of the names of the properties in this MessageContext */ public Iterator getPropertyNames() { return keySet().iterator(); } /** * Removes a property (name-value pair) from the MessageContext */ public void removeProperty(String name) { remove(name); } /** * Sets the name and value of a property associated with the MessageContext. * If the MessageContext contains a value of the same property, the old value is replaced. */ public void setProperty(String name, Object value) { put(name, value); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/ServerHandlerChain.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/ServerHa0000644000175000017500000000400410623427336031501 0ustar godgod/* * 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.core.jaxrpc.handler; // $Id: ServerHandlerChain.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.util.List; import java.util.Set; import javax.xml.rpc.handler.MessageContext; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Represents a list of handlers. All elements in the * HandlerChain are of the type javax.xml.rpc.handler.Handler. * * @author Thomas.Diesler@jboss.org * @since 06-May-2004 */ public class ServerHandlerChain extends HandlerChainBaseImpl { // The required type of the handler private HandlerType type; public ServerHandlerChain(List infos, Set roles, HandlerType type) { super(infos, roles); this.type = type; } public boolean handleRequest(MessageContext msgContext) { boolean doNext = super.handleRequest(msgContext); return doNext; } public boolean handleResponse(MessageContext msgContext) { boolean doNext = super.handleResponse(msgContext); return doNext; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/HandlerC0000644000175000017500000005004710623427336031452 0ustar godgod/* * 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.core.jaxrpc.handler; // $Id: HandlerChainBaseImpl.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.handler.Handler; import javax.xml.rpc.handler.HandlerChain; import javax.xml.rpc.handler.HandlerInfo; import javax.xml.rpc.handler.MessageContext; import javax.xml.soap.SOAPPart; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.SOAPElementImpl; import org.jboss.ws.core.soap.SOAPElementWriter; import org.jboss.ws.core.soap.SOAPEnvelopeImpl; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Represents a list of handlers. All elements in the * HandlerChain are of the type javax.xml.rpc.handler.Handler. *

      * Abstracts the policy and mechanism for the invocation of the registered handlers. * * @author Thomas.Diesler@jboss.org * @since 06-May-2004 */ public abstract class HandlerChainBaseImpl implements HandlerChain { private static Logger log = Logger.getLogger(HandlerChainBaseImpl.class); public static final int STATE_DOES_NOT_EXIST = 0; public static final int STATE_CREATED = 1; public static final int STATE_READY = 2; public static final int STATE_DESTROYED = 3; // The List objects protected List handlers = new ArrayList(); // The roles associated with the handler chain protected Set roles = new HashSet(); // The index of the first handler that returned false during processing protected int falseIndex = -1; // The state of this handler chain protected int state; /** * Constructs a handler chain with the given handlers infos */ public HandlerChainBaseImpl(List infos, Set roles) { log.debug("Create a handler chain for roles: " + roles); addHandlersToChain(infos, roles); } /** Get the list of handler infos */ public List getHandlerInfos() { List list = new ArrayList(); for (int i = 0; i < handlers.size(); i++) { HandlerEntry entry = (HandlerEntry)handlers.get(i); list.add(entry.info); } return list; } public void pullHeaders(Set headers) { for (HandlerEntry entry : handlers) { QName[] handlerHeaders = entry.handler.getHeaders(); if (handlerHeaders != null) Collections.addAll(headers, handlerHeaders); } } public Set getHeaders() { HashSet set = new HashSet(); pullHeaders(set); return set; } /** * Initialize the a handler chain with the given handlers infos */ private void addHandlersToChain(List infos, Set roleSet) { try { if (infos != null) { for (HandlerInfo info : infos) { HandlerWrapper handler = new HandlerWrapper((Handler)info.getHandlerClass().newInstance()); HandlerType type = (HandlerType)info.getHandlerConfig().get(HandlerType.class.getName()); handlers.add(new HandlerEntry(handler, info, type)); } } if (roleSet != null) { roles.addAll(roleSet); } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new JAXRPCException("Cannot initialize handler chain", ex); } // set state to created state = STATE_CREATED; } /** * Get the state of this handler chain */ public int getState() { return state; } /** * Initializes the configuration for a HandlerChain. * * @param config Configuration for the initialization of this handler chain * @throws javax.xml.rpc.JAXRPCException If any error during initialization */ public void init(Map config) { log.debug("init: [config=" + config + "]"); for (int i = 0; i < handlers.size(); i++) { HandlerEntry entry = (HandlerEntry)handlers.get(i); entry.handler.init(entry.info); } // set state to ready state = STATE_READY; } /** * Indicates the end of lifecycle for a HandlerChain. * * @throws javax.xml.rpc.JAXRPCException If any error during destroy */ public void destroy() { log.debug("destroy"); for (int i = 0; i < handlers.size(); i++) { HandlerEntry entry = (HandlerEntry)handlers.get(i); entry.handler.destroy(); } handlers.clear(); // set state to destroyed state = STATE_DESTROYED; } /** * Gets SOAP actor roles registered for this HandlerChain at this SOAP node. The returned array includes the * special SOAP actor next. * * @return SOAP Actor roles as URIs */ public String[] getRoles() { Set auxlist = new HashSet(roles); auxlist.add(Constants.URI_SOAP11_NEXT_ACTOR); String[] roleArr = new String[auxlist.size()]; auxlist.toArray(roleArr); return roleArr; } /** * Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in which this HandlerChain is to act * for the SOAP message processing at this SOAP node. These roles assumed by a HandlerChain must be invariant during * the processing of an individual SOAP message through the HandlerChain. *

      * A HandlerChain always acts in the role of the special SOAP actor next. Refer to the SOAP specification for the * URI name for this special SOAP actor. There is no need to set this special role using this method. * * @param soapActorNames URIs for SOAP actor name */ public void setRoles(String[] soapActorNames) { List newRoles = Arrays.asList(soapActorNames); log.debug("setRoles: " + newRoles); roles.clear(); roles.addAll(newRoles); } /** * Initiates the request processing for this handler chain. * * @param msgContext MessageContext parameter provides access to the request SOAP message. * @return Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method. * @throws javax.xml.rpc.JAXRPCException if any processing error happens */ public boolean handleRequest(MessageContext msgContext) { return handleRequestInternal(msgContext, HandlerType.ALL); } public boolean handleRequest(MessageContext msgContext, HandlerType type) { return handleRequestInternal(msgContext, type); } private boolean handleRequestInternal(MessageContext msgContext, HandlerType type) { boolean doNext = true; if (handlers.size() > 0) { log.debug("Enter: handleRequest"); SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext; jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE); // Replace handlers that did not survive the previous call replaceDirtyHandlers(); int handlerIndex = 0; Handler currHandler = null; try { String lastMessageTrace = null; for (; doNext && handlerIndex < handlers.size(); handlerIndex++) { HandlerEntry handlerEntry = (HandlerEntry)handlers.get(handlerIndex); if (type == HandlerType.ALL || type == handlerEntry.getType()) { currHandler = handlerEntry.getHandler(); if (log.isTraceEnabled()) { SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart(); lastMessageTrace = traceSOAPPart("BEFORE handleRequest - " + currHandler, soapPart, lastMessageTrace); } doNext = currHandler.handleRequest(msgContext); if (log.isTraceEnabled()) { SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart(); lastMessageTrace = traceSOAPPart("AFTER handleRequest - " + currHandler, soapPart, lastMessageTrace); } } } } catch (RuntimeException e) { log.error("RuntimeException in request handler", e); doNext = false; throw e; } finally { // we start at this index in the response chain if (doNext == false) falseIndex = (handlerIndex - 1); jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM); log.debug("Exit: handleRequest with status: " + doNext); } } return doNext; } /** * Initiates the response processing for this handler chain. *

      * In this implementation, the response handler chain starts processing from the same Handler * instance (that returned false) and goes backward in the execution sequence. * * @return Returns true if all handlers in chain have been processed. * Returns false if a handler in the chain returned false from its handleResponse method. * @throws javax.xml.rpc.JAXRPCException if any processing error happens */ public boolean handleResponse(MessageContext msgContext) { return handleResponseInternal(msgContext, HandlerType.ALL); } public boolean handleResponse(MessageContext msgContext, HandlerType type) { return handleResponseInternal(msgContext, type); } private boolean handleResponseInternal(MessageContext msgContext, HandlerType type) { boolean doNext = true; if (handlers.size() > 0) { log.debug("Enter: handleResponse"); SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext; jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE); int handlerIndex = handlers.size() - 1; if (falseIndex != -1) handlerIndex = falseIndex; Handler currHandler = null; try { String lastMessageTrace = null; for (; doNext && handlerIndex >= 0; handlerIndex--) { HandlerEntry handlerEntry = (HandlerEntry)handlers.get(handlerIndex); if (type == HandlerType.ALL || type == handlerEntry.getType()) { currHandler = handlerEntry.getHandler(); if (log.isTraceEnabled()) { SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart(); lastMessageTrace = traceSOAPPart("BEFORE handleResponse - " + currHandler, soapPart, lastMessageTrace); } doNext = currHandler.handleResponse(msgContext); if (log.isTraceEnabled()) { SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart(); lastMessageTrace = traceSOAPPart("AFTER handleResponse - " + currHandler, soapPart, lastMessageTrace); } } } } catch (RuntimeException rte) { log.error("RuntimeException in response handler", rte); doNext = false; throw rte; } finally { // we start at this index in the fault chain if (doNext == false) falseIndex = (handlerIndex - 1); jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM); log.debug("Exit: handleResponse with status: " + doNext); } } return doNext; } /** * Initiates the SOAP fault processing for this handler chain. *

      * In this implementation, the fault handler chain starts processing from the same Handler * instance (that returned false) and goes backward in the execution sequence. * * @return Returns true if all handlers in chain have been processed. * Returns false if a handler in the chain returned false from its handleFault method. * @throws javax.xml.rpc.JAXRPCException if any processing error happens */ public boolean handleFault(MessageContext msgContext) { return handleFaultInternal(msgContext, HandlerType.ALL); } public boolean handleFault(MessageContext msgContext, HandlerType type) { return handleFaultInternal(msgContext, type); } private boolean handleFaultInternal(MessageContext msgContext, HandlerType type) { boolean doNext = true; if (handlers.size() > 0) { log.debug("Enter: handleFault"); SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext; jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE); try { int handlerIndex = handlers.size() - 1; if (falseIndex != -1) handlerIndex = falseIndex; Handler currHandler = null; for (; doNext && handlerIndex >= 0; handlerIndex--) { HandlerEntry handlerEntry = (HandlerEntry)handlers.get(handlerIndex); if (type == HandlerType.ALL || type == handlerEntry.getType()) { currHandler = handlerEntry.getHandler(); log.debug("Handle fault: " + currHandler); doNext = currHandler.handleFault(msgContext); } } } finally { jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM); log.debug("Exit: handleFault with status: " + doNext); } } return doNext; } /** Trace the SOAPPart, do nothing if the String representation is equal to the last one. */ protected String traceSOAPPart(String logMsg, SOAPPart soapPart, String lastMessageTrace) { try { SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope(); String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true); if (envStr.equals(lastMessageTrace)) { log.trace(logMsg + ": unchanged"); } else { log.trace(logMsg + "\n" + envStr); lastMessageTrace = envStr; } return lastMessageTrace; } catch (Exception ex) { log.error("Cannot trace SOAP message", ex); return null; } } /** * Replace handlers that did not survive the previous call */ protected void replaceDirtyHandlers() { for (int i = 0; i < handlers.size(); i++) { HandlerEntry entry = (HandlerEntry)handlers.get(i); if (entry.handler.getState() == HandlerWrapper.DOES_NOT_EXIST) { log.debug("Replacing dirty handler: " + entry.handler); try { HandlerWrapper handler = new HandlerWrapper((Handler)entry.info.getHandlerClass().newInstance()); entry.handler = handler; handler.init(entry.info); } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { log.error("Cannot create handler instance for: " + entry.info, ex); } } } } /** * Get the handler at the requested position */ protected Handler getHandlerAt(int pos) { if (pos < 0 || handlers.size() <= pos) throw new IllegalArgumentException("No handler at position: " + pos); HandlerEntry entry = (HandlerEntry)handlers.get(pos); return entry.handler; } /** * An entry in the handler list */ private class HandlerEntry { private HandlerWrapper handler; private HandlerInfo info; private HandlerType type; public HandlerEntry(HandlerWrapper handler, HandlerInfo info, HandlerType type) { if (handler == null || info == null) throw new IllegalStateException("Invalid handler entry"); if (type == null) { log.debug("Using handler type default: " + HandlerType.ENDPOINT); type = HandlerType.ENDPOINT; } this.handler = handler; this.info = info; this.type = type; } public Handler getHandler() { return handler; } public HandlerInfo getInfo() { return info; } public HandlerType getType() { return type; } } // java.util.List interface **************************************************************************************** public boolean remove(Object o) { return handlers.remove(o); } public boolean containsAll(Collection c) { return handlers.containsAll(c); } public boolean removeAll(Collection c) { return handlers.removeAll(c); } public boolean retainAll(Collection c) { return handlers.retainAll(c); } public int hashCode() { return handlers.hashCode(); } public boolean equals(Object o) { return handlers.equals(o); } public Iterator iterator() { return handlers.iterator(); } public List subList(int fromIndex, int toIndex) { return handlers.subList(fromIndex, toIndex); } public ListIterator listIterator() { return handlers.listIterator(); } public ListIterator listIterator(int index) { return handlers.listIterator(index); } public int size() { return handlers.size(); } public void clear() { handlers.clear(); } public boolean isEmpty() { return handlers.isEmpty(); } public Object[] toArray() { return handlers.toArray(); } public Object get(int index) { return handlers.get(index); } public Object remove(int index) { return handlers.remove(index); } public void add(int index, Object element) { handlers.add(index, (HandlerEntry)element); } public int indexOf(Object elem) { return handlers.indexOf(elem); } public int lastIndexOf(Object elem) { return handlers.lastIndexOf(elem); } public boolean add(Object o) { return handlers.add((HandlerEntry)o); } public boolean contains(Object elem) { return handlers.contains(elem); } public boolean addAll(int index, Collection c) { return handlers.addAll(index, c); } public boolean addAll(Collection c) { return handlers.addAll(c); } public Object set(int index, Object element) { return handlers.set(index, (HandlerEntry)element); } public Object[] toArray(Object[] a) { return handlers.toArray(a); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/HandlerWrapper.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/handler/HandlerW0000644000175000017500000001256110561611275031473 0ustar godgod/* * 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.core.jaxrpc.handler; // $Id: HandlerWrapper.java 2275 2007-02-05 11:19:25Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.handler.Handler; import javax.xml.rpc.handler.HandlerInfo; import javax.xml.rpc.handler.MessageContext; import javax.xml.rpc.soap.SOAPFaultException; import org.jboss.logging.Logger; /** * A wrapper arround a {@link javax.xml.rpc.handler.Handler} that takes care of its lifecycle. * * @author thomas.diesler@jboss.org */ public class HandlerWrapper implements Handler { private static Logger log = Logger.getLogger(HandlerWrapper.class); public final static int DOES_NOT_EXIST = 0; public final static int METHOD_READY = 1; // The states as string private static String[] stateNames = new String[]{"DOES_NOT_EXIST", "METHOD_READY"}; // The handler to delegate to private Handler delegate; // The handler state private int state; /** * Delegate to the given handler */ public HandlerWrapper(Handler handler) { delegate = handler; state = DOES_NOT_EXIST; // this is somewhat a lie ;-) } /** * Get the current state */ public int getState() { return state; } /** * Get the current state as string */ public String getStateAsString() { return stateNames[state]; } /** * Gets the header blocks processed by this Handler instance. */ public QName[] getHeaders() { return delegate.getHeaders(); } /** * The init method enables the Handler instance to initialize itself. */ public void init(HandlerInfo config) throws JAXRPCException { if(log.isDebugEnabled()) log.debug("init: " + delegate); delegate.init(config); state = METHOD_READY; } /** * The destroy method indicates the end of lifecycle for a Handler instance. */ public void destroy() throws JAXRPCException { if(log.isDebugEnabled()) log.debug("destroy: " + delegate); state = DOES_NOT_EXIST; delegate.destroy(); } /** * The handleRequest method processes the request message. */ public boolean handleRequest(MessageContext msgContext) throws JAXRPCException, SOAPFaultException { if (state == DOES_NOT_EXIST) { log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleRequest for: " + delegate); return true; } try { return delegate.handleRequest(msgContext); } catch (RuntimeException e) { return handleRuntimeException(e); } } /** * The handleResponse method processes the response SOAP message. */ public boolean handleResponse(MessageContext msgContext) { if (state == DOES_NOT_EXIST) { log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleResponse for: " + delegate); return true; } try { return delegate.handleResponse(msgContext); } catch (RuntimeException e) { return handleRuntimeException(e); } } /** * The handleFault method processes the SOAP faults based on the SOAP message processing model. */ public boolean handleFault(MessageContext msgContext) { if (state == DOES_NOT_EXIST) { log.warn("Handler is in state DOES_NOT_EXIST, skipping Handler.handleFault for: " + delegate); return true; } try { return delegate.handleFault(msgContext); } catch (RuntimeException e) { return handleRuntimeException(e); } } /** * As defined by JAX-RPC, a RuntimeException(other than SOAPFaultException) thrown from any method of * the Handler results in the destroymethod being invoked and transition to the �Does Not Exist� state. */ private boolean handleRuntimeException(RuntimeException e) { if ((e instanceof SOAPFaultException) == false) { log.warn("RuntimeException in handler method, transition to DOES_NOT_EXIST"); destroy(); } throw e; } /** * Returns a hash code value for the object. */ public int hashCode() { return delegate.hashCode(); } /** * Returns a string representation of the object. */ public String toString() { return "[state=" + getStateAsString() + ",handler=" + delegate + "]"; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/ServletEndpointContextImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/ServletEndpointC0000644000175000017500000000733110614173446031603 0ustar godgod/* * 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.core.jaxrpc; // $Id: ServletEndpointContextImpl.java 2934 2007-04-26 19:01:58Z thomas.diesler@jboss.com $ import java.security.Principal; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.xml.rpc.handler.MessageContext; import javax.xml.rpc.server.ServletEndpointContext; import org.jboss.ws.core.server.ServletRequestContext; import org.jboss.ws.core.soap.MessageContextAssociation; /** * Implementation of ServletEndpointContext * * @author Jason T. Greene */ public class ServletEndpointContextImpl implements ServletEndpointContext { private ServletContext context; private HttpServletRequest request; private HttpServletResponse response; public ServletEndpointContextImpl(ServletRequestContext context) { this.context = context.getServletContext(); this.request = context.getHttpServletRequest(); this.response = context.getHttpServletResponse(); } /** * The getHttpSession method returns the current HTTP session (as a javax.servlet.http.HTTPSession). * When invoked by the service endpoint within a remote method implementation, the getHttpSession returns the HTTP * session associated currently with this method invocation. This method returns null if there is no HTTP session * currently active and associated with this service endpoint. An endpoint class should not rely on an active HTTP * session being always there; the underlying JAX-RPC runtime system is responsible for managing whether or not there * is an active HTTP session. * * The getHttpSession method throws JAXRPCException if invoked by an non HTTP bound endpoint. * * @return The HTTP session associated with the current invocation or null if there is no active session. */ public HttpSession getHttpSession() { // [JBWS-1619] ServletEndpointContext.getHttpSession has an incorrect implementation return request.getSession(false); } public MessageContext getMessageContext() { return (MessageContext)MessageContextAssociation.peekMessageContext(); } public ServletContext getServletContext() { return context; } public Principal getUserPrincipal() { return request.getUserPrincipal(); } public boolean isUserInRole(String role) { return request.isUserInRole(role); } // BEGIN non-standard access methods public HttpServletRequest getHttpServletRequest() { return request; } public HttpServletResponse getHttpServletResponse() { return response; } // END non-standard access methods }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/UnqualifiedCallParameter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/UnqualifiedCallP0000644000175000017500000000305610542776150031536 0ustar godgod/* * 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.core.jaxrpc; // $Id: UnqualifiedCallParameter.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; /** * This type is used in DII clients that do not qualify the call parameter with a java type. * * @author Thomas.Diesler@jboss.org * @since 02-Aug-2005 */ public class UnqualifiedCallParameter { private QName xmlType; public UnqualifiedCallParameter(QName xmlType) { this.xmlType = xmlType; } public String toString() { return getClass().getName() + "[xmlType=" + xmlType +"]"; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SOAPBindingJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SOAPBindingJAXRP0000644000175000017500000000574310577027146031225 0ustar godgod/* * 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.core.jaxrpc; // $Id: SOAPBindingJAXRPC.java 2635 2007-03-17 18:07:34Z thomas.diesler@jboss.com $ import javax.xml.rpc.Call; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPMessage; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * The SOAPBinding interface is an abstraction for the SOAP binding. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ class SOAPBindingJAXRPC { // provide logging private static Logger log = Logger.getLogger(SOAPBindingJAXRPC.class); public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage) { MessageContextJAXRPC msgContext = (MessageContextJAXRPC)MessageContextAssociation.peekMessageContext(); MimeHeaders mimeHeaders = reqMessage.getMimeHeaders(); String soapAction = opMetaData.getSOAPAction(); // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field // with a quoted value equal to the value of the soapAction attribute of // soapbind:operation, if present in the corresponding WSDL description. // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field // with a quoted empty string value, if in the corresponding WSDL description, // the soapAction attribute of soapbind:operation is either not present, or // present with an empty string as its value. if (msgContext.getProperty(Call.SOAPACTION_USE_PROPERTY) != null) log.info("Ignore Call.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745"); String soapActionProperty = (String)msgContext.getProperty(Call.SOAPACTION_URI_PROPERTY); if (soapActionProperty != null) soapAction = soapActionProperty; mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : ""); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJ0000644000175000017500000003130710647117155031364 0ustar godgod/* * 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.core.jaxrpc; // $Id: SOAPFaultHelperJAXRPC.java 3905 2007-07-17 10:48:13Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.encoding.TypeMapping; import javax.xml.rpc.soap.SOAPFaultException; import javax.xml.soap.Detail; import javax.xml.soap.DetailEntry; import javax.xml.soap.MessageFactory; import javax.xml.soap.Name; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFault; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.CommonSOAPFaultException; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.MessageFactoryImpl; import org.jboss.ws.core.soap.NameImpl; import org.jboss.ws.core.soap.SOAPEnvelopeImpl; import org.jboss.ws.core.soap.SOAPFactoryImpl; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.Element; /** * A Helper that translates between SOAPFaultException and SOAPFault. * * @author Thomas.Diesler@jboss.org * @since 03-Feb-2005 */ public class SOAPFaultHelperJAXRPC { // provide logging private static Logger log = Logger.getLogger(SOAPFaultHelperJAXRPC.class); private static List allowedFaultCodes = new ArrayList(); static { allowedFaultCodes.add(Constants.SOAP11_FAULT_CODE_CLIENT); allowedFaultCodes.add(Constants.SOAP11_FAULT_CODE_SERVER); allowedFaultCodes.add(Constants.SOAP11_FAULT_CODE_VERSION_MISMATCH); allowedFaultCodes.add(Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND); } /** Hide constructor */ private SOAPFaultHelperJAXRPC() { } /** Factory method for FaultException for a given SOAPFault */ public static SOAPFaultException getSOAPFaultException(SOAPFault soapFault) { QName faultCode = ((NameImpl)soapFault.getFaultCodeAsName()).toQName(); String faultString = soapFault.getFaultString(); String faultActor = soapFault.getFaultActor(); Detail detail = soapFault.getDetail(); SOAPFaultException faultEx = new SOAPFaultException(faultCode, faultString, faultActor, detail); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (detail != null && msgContext != null) { SerializationContext serContext = msgContext.getSerializationContext(); TypeMapping typeMapping = serContext.getTypeMapping(); Iterator it = detail.getDetailEntries(); while (it.hasNext()) { DetailEntry deElement = (DetailEntry)it.next(); Name deName = deElement.getElementName(); QName xmlName = new QName(deName.getURI(), deName.getLocalName()); OperationMetaData opMetaData = msgContext.getOperationMetaData(); FaultMetaData faultMetaData = opMetaData.getFault(xmlName); if (faultMetaData != null) { if (log.isDebugEnabled()) log.debug("Deserialize fault: " + faultMetaData); QName xmlType = faultMetaData.getXmlType(); Class javaType = faultMetaData.getJavaType(); // Get the deserializer from the type mapping AbstractDeserializerFactory desFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(javaType, xmlType); if (desFactory == null) throw new JAXRPCException("Cannot obtain deserializer factory for: " + xmlType); // Try jaxb deserialization try { // http://jira.jboss.org/jira/browse/JBWS-955 // Cannot deserialize fault detail String prefix = deName.getPrefix(); if (prefix.length() > 0) { String nsURI = deName.getURI(); String attrValue = deElement.getAttribute("xmlns:" + prefix); if (nsURI.length() > 0 && attrValue.length() == 0) deElement.addNamespaceDeclaration(prefix, nsURI); } Source xmlFragment = new DOMSource(deElement); DeserializerSupport des = (DeserializerSupport)desFactory.getDeserializer(); Object userEx = des.deserialize(xmlName, xmlType, xmlFragment, serContext); if (userEx == null || (userEx instanceof Exception) == false) throw new WSException("Invalid deserialization result: " + userEx); faultEx.initCause((Exception)userEx); } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { log.error("Cannot deserialize fault detail", ex); } } else { if (log.isDebugEnabled()) log.debug("Cannot find fault meta data for: " + xmlName); } } } return faultEx; } /** Translate the request exception into a SOAPFault message. */ public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx) { // Get or create the SOAPFaultException SOAPFaultException faultEx; if (reqEx instanceof SOAPFaultException) { faultEx = (SOAPFaultException)reqEx; } else if (reqEx instanceof CommonSOAPFaultException) { CommonSOAPFaultException soapEx = (CommonSOAPFaultException)reqEx; QName faultCode = soapEx.getFaultCode(); String faultString = soapEx.getFaultString(); Throwable cause = soapEx.getCause(); faultEx = new SOAPFaultException(faultCode, faultString, null, null); faultEx.initCause(cause); } else { QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER; String faultString = (reqEx.getMessage() != null ? reqEx.getMessage() : reqEx.toString()); faultEx = new SOAPFaultException(faultCode, faultString, null, null); faultEx.initCause(reqEx); } Throwable faultCause = faultEx.getCause(); log.error("SOAP request exception", faultCause != null ? faultCause : faultEx); try { SOAPMessageImpl faultMessage = toSOAPMessage(faultEx); return faultMessage; } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { log.error("Error creating SOAPFault message", ex); throw new JAXRPCException("Cannot create SOAPFault message for: " + faultEx); } } private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws SOAPException { assertFaultCode(faultEx.getFaultCode()); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SerializationContext serContext = (msgContext != null ? msgContext.getSerializationContext() : new SerializationContextJAXRPC()); NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry(); MessageFactory factory = new MessageFactoryImpl(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage(); SOAPEnvelopeImpl soapEnvelope = (SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope(); SOAPBody soapBody = soapEnvelope.getBody(); QName faultCode = faultEx.getFaultCode(); if (faultCode.getNamespaceURI().length() > 0) faultCode = nsRegistry.registerQName(faultCode); String faultString = getValidFaultString(faultEx); SOAPFault soapFault = soapBody.addFault(new NameImpl(faultCode), faultString); String faultActor = faultEx.getFaultActor(); if (faultActor != null) { SOAPElement soapElement = soapFault.addChildElement("faultactor"); soapElement.addTextNode(faultActor); } Exception faultCause = (Exception)faultEx.getCause(); Detail detail = faultEx.getDetail(); if (detail != null) { soapFault.addChildElement(detail); } else if (faultCause != null && (faultCause instanceof RuntimeException) == false) { Class javaType = faultCause.getClass(); TypeMapping typeMapping = serContext.getTypeMapping(); OperationMetaData opMetaData = msgContext.getOperationMetaData(); if (opMetaData != null && opMetaData.getFaultMetaData(javaType) != null) { FaultMetaData faultMetaData = opMetaData.getFaultMetaData(javaType); QName xmlName = faultMetaData.getXmlName(); QName xmlType = faultMetaData.getXmlType(); xmlName = nsRegistry.registerQName(xmlName); // Get the serializer from the type mapping AbstractSerializerFactory serFactory = (AbstractSerializerFactory)typeMapping.getSerializer(javaType, xmlType); if (serFactory == null) throw new JAXRPCException("Cannot obtain serializer factory for: " + xmlType); try { SerializerSupport ser = (SerializerSupport)serFactory.getSerializer(); Result result = ser.serialize(xmlName, xmlType, faultCause, serContext, null); XMLFragment xmlFragment = new XMLFragment(result); Element domElement = xmlFragment.toElement(); SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); SOAPElement soapElement = soapFactory.createElement(domElement); detail = soapFault.addDetail(); detail.addChildElement(soapElement); } catch (BindingException e) { throw new JAXRPCException(e); } } else { if (log.isDebugEnabled()) log.debug("Cannot obtain fault meta data for: " + javaType); } } return soapMessage; } private static String getValidFaultString(SOAPFaultException faultEx) { String faultString = faultEx.getFaultString(); if (faultString == null || faultString.length() == 0) faultString = "Unqualified " + faultEx.getFaultCode() + " fault"; return faultString; } private static void assertFaultCode(QName faultCode) { if (faultCode == null) throw new IllegalArgumentException("faultcode cannot be null"); // For lazy folkes like the CTS that don't bother to give // a namesapce URI, assume they use a standard code String nsURI = faultCode.getNamespaceURI(); if ("".equals(nsURI)) { log.warn("Empty namespace URI with fault code '" + faultCode + "', assuming: " + Constants.NS_SOAP11_ENV); faultCode = new QName(Constants.NS_SOAP11_ENV, faultCode.getLocalPart()); } // WS-I allows non custom faultcodes if you use a non soap namespace if (Constants.NS_SOAP11_ENV.equals(nsURI) && allowedFaultCodes.contains(faultCode) == false) throw new IllegalArgumentException("Illegal faultcode '" + faultCode + "', allowed values are: " + allowedFaultCodes); } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SchemaGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SchemaGenerator.0000644000175000017500000000723010561611275031474 0ustar godgod/* * 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.core.jaxrpc; // $Id: SchemaGenerator.java 2275 2007-02-05 11:19:25Z heiko.braun@jboss.com $ import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.ws.tools.JavaToXSD; /** A generator for XML schema that is used by unconfigured DII clients * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 03-Jun-2005 */ public class SchemaGenerator { // provide logging private static final Logger log = Logger.getLogger(SchemaGenerator.class); private boolean restrictToTargetNamespace = true; public JBossXSModel generateXSDSchema(QName xmlType, Class javaType) { if(log.isDebugEnabled()) log.debug("generateXSDSchema: [xmlType=" + xmlType + ",javaType=" + javaType.getName() + "]"); try { assertXmlType(xmlType); String nsuri = xmlType.getNamespaceURI(); Class componentType = javaType; while (componentType.isArray()) componentType = componentType.getComponentType(); JavaToXSD javaToXSD = new JavaToXSD(); // Force all DII arrays to use the same array namespace for the component if (! componentType.isPrimitive()) { Map namespaceMap = new HashMap(); namespaceMap.put(componentType.getPackage().getName(), nsuri); javaToXSD.setPackageNamespaceMap(namespaceMap); } JBossXSModel xsModel = javaToXSD.generateForSingleType(xmlType, javaType); if (xsModel == null) throw new WSException("Cannot generate XSModel"); if(log.isDebugEnabled()) log.debug("\n" + xsModel.serialize()); return xsModel; } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new JAXRPCException("Cannot generate xsdSchema for: " + xmlType, e); } } /** * Flag that indicates that the types generated fall under the target namespace * default is false * @param restrictToTargetNamespace The restrictToTargetNamespace to set. */ public void setRestrictToTargetNamespace(boolean restrictToTargetNamespace) { this.restrictToTargetNamespace = restrictToTargetNamespace; } /** Assert that the given namespace has a valid URI */ private void assertXmlType(QName xmlType) { String nsURI = xmlType.getNamespaceURI(); if (nsURI.length() == 0) throw new IllegalArgumentException("Invalid namespace for type: " + xmlType); } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SOAP11BindingJAX0000644000175000017500000000467610604700017031113 0ustar godgod/* * 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.core.jaxrpc; //$Id:SOAP11BindingJAXRPC.java 1054 2006-09-26 10:33:43Z thomas.diesler@jboss.com $ import java.util.Set; import javax.xml.soap.SOAPMessage; import org.jboss.ws.core.CommonSOAP11Binding; import org.jboss.ws.core.RoleSource; import org.jboss.ws.core.soap.SOAPFaultImpl; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * The JAXRPC SOAP11Binding * * @author Thomas.Diesler@jboss.com * @since 20-Sep-2006 */ public class SOAP11BindingJAXRPC extends CommonSOAP11Binding { // Delegate to JAXWS SOAP binding private SOAPBindingJAXRPC delegate = new SOAPBindingJAXRPC(); public SOAP11BindingJAXRPC() { setMTOMEnabled(false); } public SOAP11BindingJAXRPC(boolean mtomEnabled) { setMTOMEnabled(mtomEnabled); } public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage) { delegate.setSOAPActionHeader(opMetaData, reqMessage); } public SOAPMessage createFaultMessageFromException(Exception ex) { return SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex); } protected void throwFaultException(SOAPFaultImpl fault) throws Exception { throw SOAPFaultHelperJAXRPC.getSOAPFaultException(fault); } @Override public Set getRoles() { if (!(headerSource instanceof RoleSource)) throw new IllegalStateException("RoleSource was not available"); return ((RoleSource)headerSource).getRoles(); } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/TypeMappingRegistryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/TypeMappingRegis0000644000175000017500000001454710642000211031565 0ustar godgod/* * 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.core.jaxrpc; // $Id: TypeMappingRegistryImpl.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.HashMap; import java.util.Map; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.encoding.TypeMapping; import javax.xml.rpc.encoding.TypeMappingRegistry; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; import org.jboss.ws.core.binding.TypeMappingImpl; /** * This defines a registry of TypeMapping instances for encoding styles. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class TypeMappingRegistryImpl implements TypeMappingRegistry { // The registered typeMapping for the literal encoding style private Map typeMappings = new HashMap(); public TypeMappingRegistryImpl() { typeMappings.put(Constants.URI_LITERAL_ENC, new LiteralTypeMapping()); typeMappings.put(Constants.URI_SOAP11_ENC, new EncodedTypeMapping()); } /** * Removes all registered TypeMappings and encodingStyleURIs from this TypeMappingRegistry. */ public void clear() { typeMappings.clear(); } /** * Gets the registered default TypeMapping instance. * This method returns null if there is no registered default TypeMapping in the registry. * @return The registered default TypeMapping instance or null */ public TypeMapping getDefaultTypeMapping() { return typeMappings.get(Constants.URI_LITERAL_ENC); } /** * Registers the TypeMapping instance that is default for all encoding styles supported by the TypeMappingRegistry. * A default TypeMapping should include serializers and deserializers that are independent of and usable with any * encoding style. Successive invocations of the registerDefault method replace any existing default TypeMapping instance. * * If the default TypeMapping is registered, any other TypeMapping instances registered through the * TypeMappingRegistry.register method (for a set of encodingStyle URIs) override the default TypeMapping. * * @param mapping TypeMapping instance * @throws javax.xml.rpc.JAXRPCException If there is an error in the registration of the default TypeMapping */ public void registerDefault(TypeMapping mapping) { throw new NotImplementedException(); } /** * Creates a new empty TypeMapping object. * @return TypeMapping instance */ public TypeMapping createTypeMapping() { throw new NotImplementedException(); } /** * Returns the registered TypeMapping for the specified encodingStyle URI. If there is no registered TypeMapping for * the specified encodingStyleURI, this method returns null. * @param encodingStyleURI Encoding style specified as an URI * @return TypeMapping for the specified encodingStyleURI or null */ public TypeMapping getTypeMapping(String encodingStyleURI) { assertEncodingStyle(encodingStyleURI); return typeMappings.get(encodingStyleURI); } /** * Returns a list of registered encodingStyle URIs in this TypeMappingRegistry instance. * @return Array of the registered encodingStyle URIs */ public String[] getRegisteredEncodingStyleURIs() { return new String[]{Constants.URI_LITERAL_ENC, Constants.URI_SOAP11_ENC}; } /** * Registers a TypeMapping instance with the TypeMappingRegistry. * This method replaces any existing registered TypeMapping instance for the specified encodingStyleURI. * * @param encodingStyleURI An encoding style specified as an URI. * @param mapping TypeMapping instance * @return Previous TypeMapping associated with the specified encodingStyleURI, or null if there was no * TypeMapping associated with the specified encodingStyleURI * @throws javax.xml.rpc.JAXRPCException If there is an error in the registration of the TypeMapping for the specified encodingStyleURI. */ public TypeMapping register(String encodingStyleURI, TypeMapping mapping) { throw new NotImplementedException(); } /** * Unregisters a TypeMapping instance, if present, from the specified encodingStyleURI. * @param encodingStyleURI Encoding style specified as an URI * @return TypeMapping instance that has been unregistered or null if there was no * TypeMapping registered for the specified encodingStyleURI */ public TypeMapping unregisterTypeMapping(String encodingStyleURI) { throw new NotImplementedException(); } /** * Removes a TypeMapping from the TypeMappingRegistry. * A TypeMapping is associated with 1 or more encodingStyleURIs. This method unregisters the specified * TypeMapping instance from all associated encodingStyleURIs and then removes this TypeMapping * instance from the registry. * * @param mapping TypeMapping to be removed * @return true if specified TypeMapping is removed from the TypeMappingRegistry; * false if the specified TypeMapping was not in the TypeMappingRegistry */ public boolean removeTypeMapping(TypeMapping mapping) { throw new NotImplementedException(); } /** Assert the literal encoding style */ private void assertEncodingStyle(String encURI) { if (Constants.URI_LITERAL_ENC.equals(encURI) == false && Constants.URI_SOAP11_ENC.equals(encURI) == false) throw new JAXRPCException("Unsupported encoding style: " + encURI); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SOAP12BindingJAX0000644000175000017500000000467710604700017031115 0ustar godgod/* * 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.core.jaxrpc; //$Id:SOAP12BindingJAXRPC.java 1054 2006-09-26 10:33:43Z thomas.diesler@jboss.com $ import java.util.Set; import javax.xml.soap.SOAPMessage; import org.jboss.ws.core.CommonSOAP12Binding; import org.jboss.ws.core.RoleSource; import org.jboss.ws.core.soap.SOAPFaultImpl; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * The JAXRPC SOAP12Binding * * @author Thomas.Diesler@jboss.com * @since 20-Sep-2006 */ public class SOAP12BindingJAXRPC extends CommonSOAP12Binding { // Delegate to JAXWS SOAP binding private SOAPBindingJAXRPC delegate = new SOAPBindingJAXRPC(); public SOAP12BindingJAXRPC() { setMTOMEnabled(false); } public SOAP12BindingJAXRPC(boolean mtomEnabled) { setMTOMEnabled(mtomEnabled); } public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage) { delegate.setSOAPActionHeader(opMetaData, reqMessage); } public SOAPMessage createFaultMessageFromException(Exception ex) { return SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex); } @Override public Set getRoles() { if (!(headerSource instanceof RoleSource)) throw new IllegalStateException("RoleSource was not available"); return ((RoleSource)headerSource).getRoles(); } protected void throwFaultException(SOAPFaultImpl fault) throws Exception { throw SOAPFaultHelperJAXRPC.getSOAPFaultException(fault); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/LiteralTypeMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/LiteralTypeMappi0000644000175000017500000001206110642000211031550 0ustar godgod/* * 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.core.jaxrpc; // $Id: LiteralTypeMapping.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.awt.Image; import javax.activation.DataHandler; import javax.mail.internet.MimeMultipart; import javax.xml.soap.SOAPElement; import javax.xml.transform.Source; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxrpc.binding.ElementDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.ElementSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.SOAPElementDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.SOAPElementSerializerFactory; import org.w3c.dom.Element; /** * This is the representation of a type mapping. * This TypeMapping implementation supports the literal encoding style. * * The TypeMapping instance maintains a tuple of the type * {XML typeQName, Java Class, SerializerFactory, DeserializerFactory}. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class LiteralTypeMapping extends TypeMappingImpl { /** * Construct the default literal type mapping. * Registers javaTypes for all standard XMLSchema types specified by JAXRPC. * * Note, the order of registered types is important * The last xmlType wins for a given javaType * */ public LiteralTypeMapping() { // XOP default mapping JBossXBSerializerFactory jbxbSF = new JBossXBSerializerFactory(); JBossXBDeserializerFactory jbxbDF = new JBossXBDeserializerFactory(); register(DataHandler.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); register(DataHandler.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); register(DataHandler.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); register(DataHandler.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); register(DataHandler.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); register(String.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); register(Image.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); register(Source.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); register(MimeMultipart.class, Constants.TYPE_XMIME_DEFAULT, jbxbSF, jbxbDF); registerStandardLiteralTypes(); // register default mime mappings register(DataHandler.class, Constants.TYPE_MIME_APPLICATION_XML, null, null); register(DataHandler.class, Constants.TYPE_MIME_IMAGE_GIF, null, null); register(DataHandler.class, Constants.TYPE_MIME_IMAGE_JPEG, null, null); register(DataHandler.class, Constants.TYPE_MIME_TEXT_PLAIN, null, null); register(DataHandler.class, Constants.TYPE_MIME_TEXT_XML, null, null); register(MimeMultipart.class, Constants.TYPE_MIME_MULTIPART_MIXED, null, null); // register mapping for xsd:anyType register(SOAPElement.class, Constants.TYPE_LITERAL_ANYTYPE, new SOAPElementSerializerFactory(), new SOAPElementDeserializerFactory()); register(Element.class, Constants.TYPE_LITERAL_ANYTYPE, new ElementSerializerFactory(), new ElementDeserializerFactory()); } /** * Returns the encodingStyle URIs (as String[]) supported by this TypeMapping instance. * A TypeMapping that contains only encoding style independent serializers and deserializers * returns null from this method. * * @return Array of encodingStyle URIs for the supported encoding styles */ public String[] getSupportedEncodings() { return new String[] { "" }; } /** * Sets the encodingStyle URIs supported by this TypeMapping instance. A TypeMapping that contains only encoding * independent serializers and deserializers requires null as the parameter for this method. * * @param encodingStyleURIs Array of encodingStyle URIs for the supported encoding styles */ public void setSupportedEncodings(String[] encodingStyleURIs) { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/UnqualifiedFaultException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/UnqualifiedFault0000644000175000017500000000305310542776150031613 0ustar godgod/* * 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.core.jaxrpc; // $Id: UnqualifiedFaultException.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; /** * This type is used in when there is no XML/Java mapping available. * * @author Thomas.Diesler@jboss.org * @since 02-Aug-2005 */ public class UnqualifiedFaultException extends Exception { private QName xmlType; public UnqualifiedFaultException(QName xmlType) { this.xmlType = xmlType; } public String toString() { return getClass().getName() + "[xmlType=" + xmlType +"]"; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/EncodedTypeMapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/EncodedTypeMappi0000644000175000017500000002703610642000211031525 0ustar godgod/* * 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.core.jaxrpc; // $Id: EncodedTypeMapping.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; import java.util.Calendar; import java.util.Date; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxrpc.binding.Base64DeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.Base64SerializerFactory; import org.jboss.ws.core.jaxrpc.binding.CalendarDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.CalendarSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.DateDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.DateSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.ElementDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.ElementSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.HexDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.HexSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.QNameDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.QNameSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.SOAPElementDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.SOAPElementSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory; import org.w3c.dom.Element; /** * This is the representation of a type mapping. * This TypeMapping implementation supports the encoded encoding style. * * The TypeMapping instance maintains a tuple of the type * {XML typeQName, Java Class, SerializerFactory, DeserializerFactory}. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class EncodedTypeMapping extends TypeMappingImpl { /** * Construct the default encoded type mapping. * Registers javaTypes for all standard XMLSchema types specified by JAXRPC. * * Note, the order of registered types is important * The last xmlType wins for a given javaType * */ public EncodedTypeMapping() { registerStandardLiteralTypes(); registerStandardSOAP11EncodedTypes(); // register mapping for xsd:anyType register(SOAPElement.class, Constants.TYPE_LITERAL_ANYTYPE, new SOAPElementSerializerFactory(), new SOAPElementDeserializerFactory()); register(Element.class, Constants.TYPE_LITERAL_ANYTYPE, new ElementSerializerFactory(), new ElementDeserializerFactory()); // register mapping for soap11-enc:anyType register(SOAPElement.class, Constants.TYPE_SOAP11_ANYTYPE, new SOAPElementSerializerFactory(), new SOAPElementDeserializerFactory()); register(Element.class, Constants.TYPE_SOAP11_ANYTYPE, new ElementSerializerFactory(), new ElementDeserializerFactory()); } private void registerStandardSOAP11EncodedTypes() { register(BigDecimal.class, Constants.TYPE_SOAP11_DECIMAL, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_SOAP11_POSITIVEINTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_SOAP11_NEGATIVEINTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_SOAP11_NONPOSITIVEINTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_SOAP11_NONNEGATIVEINTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_SOAP11_UNSIGNEDLONG, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_SOAP11_INTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Date.class, Constants.TYPE_SOAP11_DATETIME, new DateSerializerFactory(), new DateDeserializerFactory()); register(Calendar.class, Constants.TYPE_SOAP11_DATE, new CalendarSerializerFactory(), new CalendarDeserializerFactory()); register(Calendar.class, Constants.TYPE_SOAP11_TIME, new CalendarSerializerFactory(), new CalendarDeserializerFactory()); register(Calendar.class, Constants.TYPE_SOAP11_DATETIME, new CalendarSerializerFactory(), new CalendarDeserializerFactory()); register(QName.class, Constants.TYPE_SOAP11_QNAME, new QNameSerializerFactory(), new QNameDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_ANYSIMPLETYPE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_DURATION, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_GDAY, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_GMONTH, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_GMONTHDAY, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_GYEAR, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_GYEARMONTH, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_ID, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_LANGUAGE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_NAME, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_NCNAME, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_NMTOKEN, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_NORMALIZEDSTRING, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_TOKEN, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_SOAP11_STRING, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String[].class, Constants.TYPE_SOAP11_NMTOKENS, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(URI.class, Constants.TYPE_SOAP11_ANYURI, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(boolean.class, Constants.TYPE_SOAP11_BOOLEAN, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Boolean.class, Constants.TYPE_SOAP11_BOOLEAN, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(byte.class, Constants.TYPE_SOAP11_BYTE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Byte.class, Constants.TYPE_SOAP11_BYTE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(byte[].class, Constants.TYPE_SOAP11_HEXBINARY, new HexSerializerFactory(), new HexDeserializerFactory()); register(Byte[].class, Constants.TYPE_SOAP11_HEXBINARY, new HexSerializerFactory(), new HexDeserializerFactory()); register(byte[].class, Constants.TYPE_SOAP11_BASE64BINARY, new Base64SerializerFactory(), new Base64DeserializerFactory()); register(Byte[].class, Constants.TYPE_SOAP11_BASE64BINARY, new Base64SerializerFactory(), new Base64DeserializerFactory()); register(byte[].class, Constants.TYPE_SOAP11_BASE64, new Base64SerializerFactory(), new Base64DeserializerFactory()); register(Byte[].class, Constants.TYPE_SOAP11_BASE64, new Base64SerializerFactory(), new Base64DeserializerFactory()); register(double.class, Constants.TYPE_SOAP11_DOUBLE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Double.class, Constants.TYPE_SOAP11_DOUBLE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(float.class, Constants.TYPE_SOAP11_FLOAT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Float.class, Constants.TYPE_SOAP11_FLOAT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(int.class, Constants.TYPE_SOAP11_UNSIGNEDSHORT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Integer.class, Constants.TYPE_SOAP11_UNSIGNEDSHORT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(int.class, Constants.TYPE_SOAP11_INT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Integer.class, Constants.TYPE_SOAP11_INT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(long.class, Constants.TYPE_SOAP11_UNSIGNEDINT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Long.class, Constants.TYPE_SOAP11_UNSIGNEDINT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(long.class, Constants.TYPE_SOAP11_LONG, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Long.class, Constants.TYPE_SOAP11_LONG, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(short.class, Constants.TYPE_SOAP11_UNSIGNEDBYTE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Short.class, Constants.TYPE_SOAP11_UNSIGNEDBYTE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(short.class, Constants.TYPE_SOAP11_SHORT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Short.class, Constants.TYPE_SOAP11_SHORT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); } /** * Returns the encodingStyle URIs (as String[]) supported by this TypeMapping instance. * A TypeMapping that contains only encoding style independent serializers and deserializers * returns null from this method. * * @return Array of encodingStyle URIs for the supported encoding styles */ public String[] getSupportedEncodings() { return new String[] { "encoded" }; } /** * Sets the encodingStyle URIs supported by this TypeMapping instance. A TypeMapping that contains only encoding * independent serializers and deserializers requires null as the parameter for this method. * * @param encodingStyleURIs Array of encodingStyle URIs for the supported encoding styles */ public void setSupportedEncodings(String[] encodingStyleURIs) { throw new NotImplementedException(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/0000755000175000017500000000000010755000265027674 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/HandlerRegistryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/HandlerRe0000644000175000017500000001256410642000211031455 0ustar godgod/* * 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.core.jaxrpc.client; // $Id: HandlerRegistryImpl.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.rpc.handler.HandlerChain; import javax.xml.rpc.handler.HandlerInfo; import javax.xml.rpc.handler.HandlerRegistry; import org.jboss.logging.Logger; import org.jboss.ws.core.jaxrpc.handler.ClientHandlerChain; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Provides support for the programmatic configuration of * handlers in a HandlerRegistry. * * A handler chain is registered per service endpoint, as indicated by the * qualified name of a port. The getHandlerChain returns the handler chain * (as a java.util.List) for the specified service endpoint. The returned * handler chain is configured using the java.util.List interface. Each element * in this list is required to be of the Java type * javax.xml.rpc.handler.HandlerInfo. * * @author Thomas.Diesler@jboss.org * @since 20-Jul-2005 */ public class HandlerRegistryImpl implements HandlerRegistry { // provide logging private static Logger log = Logger.getLogger(HandlerRegistryImpl.class); // Map the endpoint name to a HandlerChain private Map handlerChains = new HashMap(); // Maps the port name to a list of HandlerInfo objects private Map> handlerInfos = new HashMap>(); // The service this registry is associated with private ServiceMetaData serviceMetaData; public HandlerRegistryImpl(ServiceMetaData serviceMetaData) { this.serviceMetaData = serviceMetaData; } public List getHandlerChain(QName portName) { List list = handlerInfos.get(portName); if (list == null) list = new ArrayList(); return new ArrayList(list); } public void setHandlerChain(QName portName, List chain) { registerClientHandlerChain(portName, chain, null); } /** Get the handler chain for the given endpoint name, maybe null. */ HandlerChain getHandlerChainInstance(QName portName) { HandlerChain handlerChain = handlerChains.get(portName); return handlerChain; } /** Register a handler chain for the given endpoint name */ void registerClientHandlerChain(QName portName, List infos, Set roles) { ClientHandlerChain chain = new ClientHandlerChain(infos, roles); handlerChains.put(portName, chain); handlerInfos.put(portName, infos); EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName); if (epMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data for: " + portName); epMetaData.clearHandlers(); for (HandlerInfo info : infos) { HandlerMetaDataJAXRPC handler = new HandlerMetaDataJAXRPC(HandlerType.ENDPOINT); handler.setEndpointMetaData(epMetaData); handler.setHandlerClassName(info.getHandlerClass().getName()); handler.setSoapRoles(roles); // copy headers Set headers = new HashSet(); for (QName header : info.getHeaders()) headers.add(header); handler.setSoapHeaders(headers); // copy init params List initParams = new ArrayList(); Iterator entries = info.getHandlerConfig().entrySet().iterator(); while (entries.hasNext()) { Map.Entry entry = entries.next(); String key = (String)entry.getKey(); Object value = entry.getValue(); if (value instanceof String) initParams.add(new UnifiedInitParamMetaData(key, (String)value)); } handler.setInitParams(initParams); epMetaData.addHandler(handler); log.debug("Add handler to: " + portName + handler); } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceProxy.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServicePr0000644000175000017500000001231310561611275031525 0ustar godgod/* * 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. */ // $Id: ServiceProxy.java 2275 2007-02-05 11:19:25Z heiko.braun@jboss.com $ package org.jboss.ws.core.jaxrpc.client; // $Id: ServiceProxy.java 2275 2007-02-05 11:19:25Z heiko.braun@jboss.com $ import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.rmi.Remote; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.Service; import org.jboss.logging.Logger; /** * This is the proxy that implements the service interface . *

      * Additionally it handles some ws4ee functionality that is not part of jaxrpc behaviour. * * @author Thomas.Diesler@jboss.org * @since 15-May-2004 */ public class ServiceProxy implements InvocationHandler { // provide logging private static final Logger log = Logger.getLogger(ServiceProxy.class); // The underlying jaxrpc service private ServiceImpl jaxrpcService; // The methods from java.lang.Object private List objectMethods = new ArrayList(); // The methods from javax.xml.rpc.Service private List jaxrpcServiceMethods = new ArrayList(); // The methods from the service interface, in case of javax.xml.rpc.Service it is empty private List serviceInterfaceMethods = new ArrayList(); // The cached getPort method private Method getPortMethod; /** * Construct a client side service proxy. *

      * This proxy implements the (generated) service interface. * * @param service The underlying {@link javax.xml.rpc.Service} * @param siClass The service interface, a subclass of {@link javax.xml.rpc.Service} */ public ServiceProxy(ServiceImpl service, Class siClass) { this.jaxrpcService = service; // initialize java.lang.Object methods objectMethods.addAll(Arrays.asList(Object.class.getMethods())); // initialize javax.xml.rpc.Service methods jaxrpcServiceMethods.addAll(Arrays.asList(ServiceExt.class.getMethods())); // initialize SI methods if (siClass.getName().equals("javax.xml.rpc.Service") == false) serviceInterfaceMethods.addAll(Arrays.asList(siClass.getDeclaredMethods())); // initialize special ws4ee methods try { getPortMethod = Service.class.getMethod("getPort", new Class[]{Class.class}); } catch (NoSuchMethodException e) { throw new JAXRPCException(e.toString()); } } /** * Processes a method invocation on a proxy instance and returns * the result. */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); try { Object retObj = null; if (jaxrpcServiceMethods.contains(method)) { if(log.isDebugEnabled()) log.debug("Invoke on jaxrpc service: " + methodName); if (method.getName().equals("getPort")) { Remote port = (Remote)method.invoke(jaxrpcService, args); return port; } else { retObj = method.invoke(jaxrpcService, args); return retObj; } } if (serviceInterfaceMethods.contains(method)) { if(log.isDebugEnabled()) log.debug("Invoke on service interface: " + methodName); Class seiClass = method.getReturnType(); retObj = getPortMethod.invoke(jaxrpcService, new Object[]{seiClass}); return retObj; } if (objectMethods.contains(method)) { if(log.isDebugEnabled()) log.debug("Invoke on object: " + methodName); retObj = method.invoke(jaxrpcService, args); return retObj; } throw new JAXRPCException("Don't know how to invoke: " + method); } catch (Exception e) { handleException(e); return null; } } /** * Log the client side exception */ private void handleException(Exception ex) throws Throwable { Throwable th = ex; if (ex instanceof InvocationTargetException) th = ((InvocationTargetException)ex).getTargetException(); log.error("Service error", th); throw th; } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceExt.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceEx0000644000175000017500000000300110560061125031502 0ustar godgod/* * 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.core.jaxrpc.client; //$Id: ServiceExt.java 2209 2007-01-31 09:33:09Z thomas.diesler@jboss.com $ import javax.xml.rpc.Service; import javax.xml.rpc.handler.HandlerRegistry; /** * Extends the JAXRPC Service with JBoss propriatary behaviour * * @author Thomas.Diesler@jboss.org * @since 27-Jan-2005 */ public interface ServiceExt extends Service { /** * Get a HandlerRegistry that can be used to dynamically * change the client side handler chain */ HandlerRegistry getDynamicHandlerRegistry(); } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/NativeServiceRefBinderJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/NativeSer0000644000175000017500000000455410654112427031531 0ustar godgod/* * 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.core.jaxrpc.client; // $Id: NativeServiceRefBinderJAXRPC.java 4053 2007-08-01 14:13:43Z thomas.diesler@jboss.com $ import java.lang.reflect.AnnotatedElement; import javax.naming.Context; import javax.naming.NamingException; import org.jboss.logging.Logger; import org.jboss.util.naming.Util; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import org.jboss.wsf.spi.serviceref.ServiceRefBinder; /** * Binds a JAXRPC Service object in the client's ENC for every service-ref element in the * deployment descriptor. * * @author Thomas.Diesler@jboss.org * @since 04-Nov-2006 */ public class NativeServiceRefBinderJAXRPC implements ServiceRefBinder { // logging support private static Logger log = Logger.getLogger(NativeServiceRefBinderJAXRPC.class); /** * Binds a Service into the callers ENC for every service-ref element */ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader) throws NamingException { String externalName = encCtx.getNameInNamespace() + "/" + encName; log.info("setupServiceRef [jndi=" + externalName + "]"); // Do not use rebind, the binding should be unique ServiceReferenceable ref = new ServiceReferenceable(serviceRef); Util.bind(encCtx, encName, ref); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceIm0000644000175000017500000004525110654456445031531 0ustar godgod/* * 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.core.jaxrpc.client; // $Id: ServiceImpl.java 4126 2007-08-02 22:39:33Z darran.lofthouse@jboss.com $ import java.lang.reflect.Proxy; import java.net.URL; import java.rmi.Remote; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.rpc.Call; import javax.xml.rpc.ServiceException; import javax.xml.rpc.Stub; import javax.xml.rpc.encoding.TypeMappingRegistry; import javax.xml.rpc.handler.HandlerChain; import javax.xml.rpc.handler.HandlerInfo; import javax.xml.rpc.handler.HandlerRegistry; import org.jboss.logging.Logger; import org.jboss.ws.core.StubExt; import org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.wsf.common.ResourceLoaderAdapter; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Service class acts as a factory for: *

        *
      • Dynamic proxy for the target service endpoint. *
      • Instance of the type javax.xml.rpc.Call for the dynamic invocation of a * remote operation on the target service endpoint. *
      • Instance of a generated stub class *
      * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class ServiceImpl implements ServiceExt { // provide logging private static final Logger log = Logger.getLogger(ServiceImpl.class); // The service meta data that is associated with this JAXRPC Service private ServiceMetaData serviceMetaData; // The optional WSDL location private URL wsdlLocation; // The meta data private UnifiedServiceRefMetaData usrMetaData; // The handler registry private HandlerRegistryImpl handlerRegistry; /** * Construct a Service without WSDL meta data */ ServiceImpl(QName serviceName) { UnifiedMetaData wsMetaData = new UnifiedMetaData(new ResourceLoaderAdapter()); serviceMetaData = new ServiceMetaData(wsMetaData, serviceName); handlerRegistry = new HandlerRegistryImpl(serviceMetaData); } /** * Construct a Service that has access to some WSDL meta data */ ServiceImpl(QName serviceName, URL wsdlURL, URL mappingURL, URL securityURL) { this.wsdlLocation = wsdlURL; JAXRPCClientMetaDataBuilder builder = new JAXRPCClientMetaDataBuilder(); ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader(); serviceMetaData = builder.buildMetaData(serviceName, wsdlURL, mappingURL, securityURL, null, ctxClassLoader); handlerRegistry = new HandlerRegistryImpl(serviceMetaData); } /** * Construct a Service that has access to some WSDL meta data */ ServiceImpl(QName serviceName, URL wsdlURL, JavaWsdlMapping mappingURL, WSSecurityConfiguration securityConfig, UnifiedServiceRefMetaData usrMetaData) { this.wsdlLocation = wsdlURL; this.usrMetaData = usrMetaData; JAXRPCClientMetaDataBuilder builder = new JAXRPCClientMetaDataBuilder(); ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader(); serviceMetaData = builder.buildMetaData(serviceName, wsdlURL, mappingURL, securityConfig, usrMetaData, ctxClassLoader); handlerRegistry = new HandlerRegistryImpl(serviceMetaData); } public ServiceMetaData getServiceMetaData() { return serviceMetaData; } /** * Gets the location of the WSDL document for this Service. * * @return URL for the location of the WSDL document for this service */ public URL getWSDLDocumentLocation() { return wsdlLocation; } /** * Gets the name of this service. * * @return Qualified name of this service */ public QName getServiceName() { return serviceMetaData.getServiceName(); } /** * Creates a Call instance. * * @param portName * Qualified name for the target service endpoint * @return Call instance * @throws javax.xml.rpc.ServiceException * If any error in the creation of the Call object */ public Call createCall(QName portName) throws ServiceException { String nsURI = portName.getNamespaceURI(); serviceMetaData.assertTargetNamespace(nsURI); CallImpl call = new CallImpl(this, portName, null); initCallProperties(call, null); return call; } /** * Creates a Call instance. * * @param portName * Qualified name for the target service endpoint * @param operationName * Name of the operation for which this Call object is to be * created. * @return Call instance * @throws javax.xml.rpc.ServiceException * If any error in the creation of the Call object */ public Call createCall(QName portName, String operationName) throws ServiceException { String nsURI = portName.getNamespaceURI(); serviceMetaData.assertTargetNamespace(nsURI); QName opName = new QName(nsURI, operationName); CallImpl call = new CallImpl(this, portName, opName); initCallProperties(call, null); return call; } /** * Creates a Call instance. * * @param portName * Qualified name for the target service endpoint * @param opName * Qualified name of the operation for which this Call object is * to be created. * @return Call instance * @throws javax.xml.rpc.ServiceException * If any error in the creation of the Call object */ public Call createCall(QName portName, QName opName) throws ServiceException { serviceMetaData.assertTargetNamespace(portName.getNamespaceURI()); serviceMetaData.assertTargetNamespace(opName.getNamespaceURI()); CallImpl call = new CallImpl(this, portName, opName); initCallProperties(call, null); return call; } /** * Creates a Call object not associated with specific operation or target * service endpoint. This Call object needs to be configured using the * setter methods on the Call interface. * * @return Call object * @throws javax.xml.rpc.ServiceException * If any error in the creation of the Call object */ public Call createCall() throws ServiceException { CallImpl call = new CallImpl(this); initCallProperties(call, null); return call; } /** * Gets an array of preconfigured Call objects for invoking operations on * the specified port. There is one Call object per operation that can be * invoked on the specified port. Each Call object is pre-configured and * does not need to be configured using the setter methods on Call * interface.

      Each invocation of the getCalls method returns a new * array of preconfigured Call objects

      This method requires the Service * implementation class to have access to the WSDL related metadata. * * @param portName * Qualified name for the target service endpoint * @return Call[] Array of pre-configured Call objects * @throws javax.xml.rpc.ServiceException * If this Service class does not have access to the required * WSDL metadata or if an illegal endpointName is specified. */ public Call[] getCalls(QName portName) throws ServiceException { EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName); if (epMetaData == null) throw new ServiceException("Cannot find endpoint for name: " + portName); List calls = new ArrayList(); for (OperationMetaData opMetaData : epMetaData.getOperations()) { Call call = createCall(portName, opMetaData.getQName()); calls.add(call); } Call[] callArr = new Call[calls.size()]; calls.toArray(callArr); return callArr; } /** * J2EE components should not use the getHandlerRegistry() method. A * container provider must throw a java.lang.UnsupportedOperationException * from the getHandlerRegistry() method of the Service Interface. Handler * support is documented in Chapter 6 Handlers. */ public HandlerRegistry getHandlerRegistry() { throw new UnsupportedOperationException("Components should not use the getHandlerRegistry() method."); } /** * Get a HandlerRegistry that can be used to dynamically change the client * side handler chain associated with a given endpoint. */ public HandlerRegistry getDynamicHandlerRegistry() { return handlerRegistry; } /** * J2EE components should not use the getTypeMappingRegistry() method. A * container provider must throw a java.lang.UnsupportedOperationException * from the getTypeMappingRegistry() method of the Service Interface. */ public TypeMappingRegistry getTypeMappingRegistry() { throw new UnsupportedOperationException("Components should not use the getTypeMappingRegistry() method."); } /** * Returns an Iterator for the list of QNames of service endpoints grouped * by this service * * @return Returns java.util.Iterator with elements of type * javax.xml.namespace.QName * @throws javax.xml.rpc.ServiceException * If this Service class does not have access to the required * WSDL metadata */ public Iterator getPorts() throws ServiceException { ArrayList list = new ArrayList(); if (serviceMetaData != null) { for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints()) { list.add(epMetaData.getPortName()); } } return list.iterator(); } /** * The getPort method returns either an instance of a generated stub * implementation class or a dynamic proxy. The parameter * serviceEndpointInterface specifies the service endpoint interface that is * supported by the returned stub or proxy. In the implementation of this * method, the JAX-RPC runtime system takes the responsibility of selecting * a protocol binding (and a port) and configuring the stub accordingly. The * returned Stub instance should not be reconfigured by the client. */ public Remote getPort(Class seiClass) throws ServiceException { if (seiClass == null) throw new IllegalArgumentException("SEI class cannot be null"); String seiName = seiClass.getName(); if (Remote.class.isAssignableFrom(seiClass) == false) throw new ServiceException("SEI does not implement java.rmi.Remote: " + seiName); if (serviceMetaData == null) throw new ServiceException("Service meta data not available"); try { EndpointMetaData epMetaData = serviceMetaData.getEndpointByServiceEndpointInterface(seiName); if (epMetaData == null && serviceMetaData.getEndpoints().size() == 1) { epMetaData = serviceMetaData.getEndpoints().get(0); epMetaData.setServiceEndpointInterfaceName(seiName); } if (epMetaData == null) throw new ServiceException("Cannot find endpoint meta data for: " + seiName); return createProxy(seiClass, epMetaData); } catch (ServiceException ex) { throw ex; } catch (Exception ex) { throw new ServiceException("Cannot create proxy", ex); } } /** * The getPort method returns either an instance of a generated stub * implementation class or a dynamic proxy. A service client uses this * dynamic proxy to invoke operations on the target service endpoint. The * serviceEndpointInterface specifies the service endpoint interface that is * supported by the created dynamic proxy or stub instance. */ public Remote getPort(QName portName, Class seiClass) throws ServiceException { if (seiClass == null) throw new IllegalArgumentException("SEI class cannot be null"); if (serviceMetaData == null) throw new ServiceException("Service meta data not available"); String seiName = seiClass.getName(); if (Remote.class.isAssignableFrom(seiClass) == false) throw new ServiceException("SEI does not implement java.rmi.Remote: " + seiName); EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName); if (epMetaData == null) throw new ServiceException("Cannot obtain endpoint meta data for: " + portName); try { if (epMetaData.getServiceEndpointInterfaceName() == null) epMetaData.setServiceEndpointInterfaceName(seiName); return createProxy(seiClass, epMetaData); } catch (ServiceException ex) { throw ex; } catch (Exception ex) { throw new ServiceException("Cannot create proxy", ex); } } private Remote createProxy(Class seiClass, EndpointMetaData epMetaData) throws Exception { CallImpl call = new CallImpl(this, epMetaData); initStubProperties(call, seiClass.getName()); // JBoss-4.0.x does not support if (initCallProperties(call, seiClass.getName()) > 0) log.info("Deprecated use of on JAXRPC Stub. Use "); PortProxy handler = new PortProxy(call); ClassLoader cl = epMetaData.getClassLoader(); Remote proxy = (Remote)Proxy.newProxyInstance(cl, new Class[] { seiClass, Stub.class, StubExt.class }, handler); // Setup the handler chain setupHandlerChain(epMetaData); return proxy; } private int initStubProperties(CallImpl call, String seiName) { // nothing to do if (usrMetaData == null) return 0; int propCount = 0; for (UnifiedPortComponentRefMetaData upcRef : usrMetaData.getPortComponentRefs()) { if (seiName.equals(upcRef.getServiceEndpointInterface())) { for (UnifiedStubPropertyMetaData prop : upcRef.getStubProperties()) { call.setProperty(prop.getPropName(), prop.getPropValue()); propCount++; } } } return propCount; } private int initCallProperties(CallImpl call, String seiName) { setupHandlerChain(call.getEndpointMetaData()); // nothing to do if (usrMetaData == null) return 0; int propCount = 0; // General properties for (UnifiedCallPropertyMetaData prop : usrMetaData.getCallProperties()) { call.setProperty(prop.getPropName(), prop.getPropValue()); propCount++; } if (seiName != null) { for (UnifiedPortComponentRefMetaData upcRef : usrMetaData.getPortComponentRefs()) { if (seiName.equals(upcRef.getServiceEndpointInterface())) { for (UnifiedCallPropertyMetaData prop : upcRef.getCallProperties()) { call.setProperty(prop.getPropName(), prop.getPropValue()); propCount++; } } } } return propCount; } /** * Get the handler chain for the given endpoint name, maybe null. */ public HandlerChain getHandlerChain(QName portName) { return handlerRegistry.getHandlerChainInstance(portName); } /** * Register a handler chain for the given endpoint name */ public void registerHandlerChain(QName portName, List infos, Set roles) { handlerRegistry.registerClientHandlerChain(portName, infos, roles); } void setupHandlerChain(EndpointMetaData epMetaData) { if (epMetaData.isHandlersInitialized() == false) { QName portName = epMetaData.getPortName(); Set handlerRoles = new HashSet(); List handlerInfos = new ArrayList(); for (HandlerMetaData handlerMetaData : epMetaData.getHandlerMetaData(HandlerType.ALL)) { HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData; handlerRoles.addAll(jaxrpcMetaData.getSoapRoles()); HashMap hConfig = new HashMap(); for (UnifiedInitParamMetaData param : jaxrpcMetaData.getInitParams()) { hConfig.put(param.getParamName(), param.getParamValue()); } Set headers = jaxrpcMetaData.getSoapHeaders(); QName[] headerArr = new QName[headers.size()]; headers.toArray(headerArr); Class hClass = jaxrpcMetaData.getHandlerClass(); hConfig.put(HandlerType.class.getName(), jaxrpcMetaData.getHandlerType()); HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr); log.debug("Adding client side handler to endpoint '" + portName + "': " + info); handlerInfos.add(info); } // register the handlers with the client engine if (handlerInfos.size() > 0) registerHandlerChain(portName, handlerInfos, handlerRoles); epMetaData.setHandlersInitialized(true); } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/PortProxy.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/PortProxy0000644000175000017500000001615710650145103031612 0ustar godgod/* * 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.core.jaxrpc.client; // $Id: PortProxy.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.Stub; import javax.xml.rpc.soap.SOAPFaultException; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.StubExt; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.wsf.common.JavaUtils; /** * The dynamic proxy that delegates to the underlying Call implementation * * @author Thomas.Diesler@jboss.org * @since 07-Jan-2005 */ public class PortProxy implements InvocationHandler { // provide logging private static final Logger log = Logger.getLogger(PortProxy.class); // The underlying Call private CallImpl call; // List of the Stub methods private List stubMethods; // List of the Object methods private List objectMethods; // The set of standard properties private static final Set standardProperties = new HashSet(); static { standardProperties.add(Stub.ENDPOINT_ADDRESS_PROPERTY); standardProperties.add(Stub.SESSION_MAINTAIN_PROPERTY); standardProperties.add(Stub.USERNAME_PROPERTY); standardProperties.add(Stub.PASSWORD_PROPERTY); } // The map of jboss-ws4ee supported properties private static final Map legacyPropertyMap = new HashMap(); static { legacyPropertyMap.put("org.jboss.webservice.client.timeout", StubExt.PROPERTY_CLIENT_TIMEOUT); legacyPropertyMap.put("org.jboss.webservice.keyStore", StubExt.PROPERTY_KEY_STORE); legacyPropertyMap.put("org.jboss.webservice.keyStorePassword", StubExt.PROPERTY_KEY_STORE_PASSWORD); legacyPropertyMap.put("org.jboss.webservice.keyStoreType", StubExt.PROPERTY_KEY_STORE_TYPE); legacyPropertyMap.put("org.jboss.webservice.trustStore", StubExt.PROPERTY_TRUST_STORE); legacyPropertyMap.put("org.jboss.webservice.trustStorePassword", StubExt.PROPERTY_TRUST_STORE_PASSWORD); legacyPropertyMap.put("org.jboss.webservice.trustStoreType", StubExt.PROPERTY_TRUST_STORE_TYPE); } public PortProxy(CallImpl call) { this.call = call; this.stubMethods = new ArrayList(Arrays.asList(StubExt.class.getMethods())); this.stubMethods.addAll(Arrays.asList(Stub.class.getMethods())); this.objectMethods = Arrays.asList(Object.class.getMethods()); } /** Processes a method invocation on a proxy instance and returns the result. */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // An invocation on the Stub interface String methodName = method.getName(); if (stubMethods.contains(method)) { if (methodName.equals("_getPropertyNames")) { return call.getPropertyNames(); } else if (methodName.equals("_getProperty")) { return getProperty((String)args[0]); } else if (methodName.equals("_setProperty")) { setProperty((String)args[0], args[1]); return null; } else { Method callMethod = CallImpl.class.getMethod(methodName, method.getParameterTypes()); return callMethod.invoke(call, args); } } // An invocation on proxy's Object class else if (objectMethods.contains(method)) { Method callMethod = CallImpl.class.getMethod(methodName, method.getParameterTypes()); return callMethod.invoke(call, args); } // An invocation on the service endpoint interface else { EndpointMetaData epMetaData = call.getEndpointMetaData(); OperationMetaData opMetaData = epMetaData.getOperation(method); if (opMetaData == null) throw new WSException("Cannot obtain operation meta data for: " + methodName); call.setOperationName(opMetaData.getQName()); try { if (opMetaData.isOneWay()) { call.invokeOneWay(args); return null; } else { Object retObj = call.invoke(args); if (retObj != null) { Class retType = method.getReturnType(); if (retType == null) throw new WSException("Return value not supported by: " + opMetaData); if (JavaUtils.isPrimitive(retType)) retObj = JavaUtils.getPrimitiveValueArray(retObj); } return retObj; } } catch (Exception ex) { handleException(ex); return null; } } } private Object getProperty(String name) { name = assertPropertyName(name); return call.getProperty(name); } private void setProperty(String name, Object value) { name = assertPropertyName(name); call.setProperty(name, value); } private String assertPropertyName(String name) { if (name != null && name.startsWith("javax.xml.rpc") && standardProperties.contains(name) == false) throw new JAXRPCException("Unsupported property: " + name); if (legacyPropertyMap.keySet().contains(name)) { String jbosswsName = legacyPropertyMap.get(name); log.warn("Legacy propery '" + name + "' mapped to '" + jbosswsName + "'"); name = jbosswsName; } return name; } private void handleException(Exception ex) throws Throwable { Throwable th = ex; if (ex instanceof RemoteException && ex.getCause() instanceof SOAPFaultException) { SOAPFaultException faultEx = (SOAPFaultException)ex.getCause(); if (faultEx.getCause() != null) th = faultEx.getCause(); } throw th; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceReferenceable.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceRe0000644000175000017500000001525410654066746031533 0ustar godgod/* * 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. */ // $Id: ServiceReferenceable.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ package org.jboss.ws.core.jaxrpc.client; // $Id: ServiceReferenceable.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.File; import java.net.URL; import javax.naming.BinaryRefAddr; import javax.naming.NamingException; import javax.naming.Reference; import javax.naming.Referenceable; import javax.naming.StringRefAddr; import org.jboss.logging.Logger; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.ws.metadata.wsse.WSSecurityOMFactory; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.management.ServerConfig; import org.jboss.wsf.spi.management.ServerConfigFactory; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; /** * A JNDI reference to a javax.xml.rpc.Service *

      * It holds the information to reconstrut the javax.xml.rpc.Service * when the client does a JNDI lookup. * * @author Thomas.Diesler@jboss.org * @since 15-April-2004 */ public class ServiceReferenceable implements Referenceable { // provide logging private static Logger log = Logger.getLogger(ServiceReferenceable.class); public static final String SERVICE_REF_META_DATA = "SERVICE_REF_META_DATA"; public static final String SECURITY_CONFIG = "SECURITY_CONFIG"; public static final String PORT_COMPONENT_LINK = "PORT_COMPONENT_LINK"; public static final String PORT_COMPONENT_LINK_SERVLET = "PORT_COMPONENT_LINK_SERVLET"; private UnifiedServiceRefMetaData refMetaData; private UnifiedVirtualFile vfsRoot; /** * A service referenceable for a WSDL document that is part of the deployment */ public ServiceReferenceable(UnifiedServiceRefMetaData refMetaData) { this.refMetaData = refMetaData; this.vfsRoot = refMetaData.getVfsRoot(); } /** * Retrieves the Reference of this object. * * @return The non-null Reference of this object. * @throws javax.naming.NamingException If a naming exception was encountered while retrieving the reference. */ public Reference getReference() throws NamingException { Reference myRef = new Reference(ServiceReferenceable.class.getName(), ServiceObjectFactoryJAXRPC.class.getName(), null); // Add a reference to the ServiceRefMetaData and WSDLDefinitions myRef.add(new BinaryRefAddr(SERVICE_REF_META_DATA, marshallServiceRef())); // FIXME: JBWS-1431 Merge ws-security config with jaxrpc/jaxws config if (getSecurityConfig() != null) myRef.add(new BinaryRefAddr(SECURITY_CONFIG, marshallSecurityConfig())); // Add references to port component links for (UnifiedPortComponentRefMetaData pcr : refMetaData.getPortComponentRefs()) { String pcLink = pcr.getPortComponentLink(); if (pcLink != null) { myRef.add(new StringRefAddr(PORT_COMPONENT_LINK, pcLink)); try { SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); ServerConfig config = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig(); String host = config.getWebServiceHost(); int port = config.getWebServicePort(); String servletURL = "http://" + host + ":" + port + "/jbossws/pclink"; myRef.add(new StringRefAddr(PORT_COMPONENT_LINK_SERVLET, servletURL)); } catch (Exception ex) { throw new NamingException("Cannot obtain path to PortComponentLinkServlet: " + ex); } } } return myRef; } /** Marshall the ServiceRefMetaData to an byte array */ private byte[] marshallServiceRef() throws NamingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(512); try { ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(refMetaData); oos.close(); } catch (IOException e) { throw new NamingException("Cannot marshall service ref meta data, cause: " + e.toString()); } return baos.toByteArray(); } /** Marshall the WSSecurityConfiguration to an byte array */ private byte[] marshallSecurityConfig() throws NamingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(512); try { ObjectOutputStream oos = new ObjectOutputStream(baos); WSSecurityOMFactory factory = WSSecurityOMFactory.newInstance(); WSSecurityConfiguration securityConfig = factory.parse(getSecurityConfig()); oos.writeObject(securityConfig); oos.close(); } catch (IOException e) { throw new NamingException("Cannot marshall security config, cause: " + e.toString()); } return baos.toByteArray(); } private URL getSecurityConfig() { URL securityConfigURL = null; try { UnifiedVirtualFile vfConfig = vfsRoot.findChild("WEB-INF/" + WSSecurityOMFactory.CLIENT_RESOURCE_NAME); securityConfigURL = vfConfig.toURL(); } catch (IOException ex) { // ignore } try { UnifiedVirtualFile vfConfig = vfsRoot.findChild("META-INF/" + WSSecurityOMFactory.CLIENT_RESOURCE_NAME); securityConfigURL = vfConfig.toURL(); } catch (IOException ex) { // ignore } return securityConfigURL; } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/CallImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/CallImpl.0000644000175000017500000006027510650145103031377 0ustar godgod/* * 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.core.jaxrpc.client; // $Id: CallImpl.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.rpc.Call; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.ParameterMode; import javax.xml.rpc.ServiceException; import javax.xml.rpc.Stub; import javax.xml.rpc.encoding.SerializerFactory; import javax.xml.rpc.soap.SOAPFaultException; import javax.xml.soap.SOAPException; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.CommonBindingProvider; import org.jboss.ws.core.CommonClient; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.RoleSource; import org.jboss.ws.core.WSTimeoutException; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxrpc.SchemaGenerator; import org.jboss.ws.core.jaxrpc.UnqualifiedCallParameter; import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory; import org.jboss.ws.core.jaxrpc.handler.HandlerChainBaseImpl; import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC; import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.TypesMetaData; import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; import org.jboss.wsf.common.JavaUtils; /** Provides support for the dynamic invocation of a service endpoint. * The javax.xml.rpc.Service interface acts as a factory for the creation of Call instances. * * Once a Call instance is created, various setter and getter methods may be used to configure this Call instance. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class CallImpl extends CommonClient implements Call, RoleSource { // provide logging private static Logger log = Logger.getLogger(CallImpl.class); // The service that created this call private ServiceImpl jaxrpcService; // The port type name private QName portType; // A Map of Call properties private Map properties = new HashMap(); // The set of supported properties private static final Set standardProperties = new HashSet(); static { standardProperties.add(Call.ENCODINGSTYLE_URI_PROPERTY); standardProperties.add(Call.OPERATION_STYLE_PROPERTY); standardProperties.add(Call.SESSION_MAINTAIN_PROPERTY); standardProperties.add(Call.SOAPACTION_URI_PROPERTY); standardProperties.add(Call.SOAPACTION_USE_PROPERTY); standardProperties.add(Call.USERNAME_PROPERTY); standardProperties.add(Call.PASSWORD_PROPERTY); standardProperties.add(Stub.ENDPOINT_ADDRESS_PROPERTY); standardProperties.add(Stub.SESSION_MAINTAIN_PROPERTY); standardProperties.add(Stub.USERNAME_PROPERTY); standardProperties.add(Stub.PASSWORD_PROPERTY); } /** Create a call that needs to be configured manually */ CallImpl(ServiceImpl service) { super(service.getServiceMetaData()); this.jaxrpcService = service; if (epMetaData != null) setTargetEndpointAddress(epMetaData.getEndpointAddress()); } /** Create a call for a known WSDL endpoint. * * @param epMetaData A WSDLEndpoint */ CallImpl(ServiceImpl service, EndpointMetaData epMetaData) { super(epMetaData); this.jaxrpcService = service; setTargetEndpointAddress(epMetaData.getEndpointAddress()); } /** Create a call for a known WSDL endpoint. * * @param portName Qualified name for the target service endpoint * @throws ServiceException */ CallImpl(ServiceImpl service, QName portName, QName opName) throws ServiceException { super(service.getServiceMetaData(), portName, opName); this.jaxrpcService = service; if (epMetaData != null) setTargetEndpointAddress(epMetaData.getEndpointAddress()); } public ServiceImpl getServiceImpl() { return jaxrpcService; } @Override protected Map getRequestContext() { return properties; } /** Gets the address of a target service endpoint. */ public String getTargetEndpointAddress() { return (String)properties.get(Stub.ENDPOINT_ADDRESS_PROPERTY); } /** Sets the address of the target service endpoint. This address must correspond to the transport * specified in the binding for this Call instance. * * @param address Address of the target service endpoint; specified as an URI */ public void setTargetEndpointAddress(String address) { this.properties.put(Stub.ENDPOINT_ADDRESS_PROPERTY, address); } /** Adds a parameter type and mode for a specific operation. */ public void addParameter(String paramName, QName xmlType, ParameterMode parameterMode) { TypeMappingImpl typeMapping = getEndpointMetaData().getServiceMetaData().getTypeMapping(); Class javaType = typeMapping.getJavaType(xmlType); // CTS com/sun/ts/tests/jaxrpc/api/javax_xml_rpc/Call/AddGetRemoveAllParametersTest1 // tests addParameter/getParameter without giving the javaType for a custom parameter // IMHO, this flavour of addParameter should only be used for standard types, where // the javaType can be derived from the xmlType if (javaType == null) { log.warn("Register unqualified call parameter for: " + xmlType); javaType = new UnqualifiedCallParameter(xmlType).getClass(); typeMapping.register(javaType, xmlType, null, null); } addParameter(paramName, xmlType, javaType, parameterMode); } /** Adds a parameter type and mode for a specific operation. */ public void addParameter(String paramName, QName xmlType, Class javaType, ParameterMode mode) { QName xmlName = new QName(paramName); addParameter(xmlName, xmlType, javaType, mode, false); } /** Add a parameter to the current operation description. * This is a propriatary extension that gives full control over the parameter configuration. */ public void addParameter(QName xmlName, QName xmlType, Class javaType, ParameterMode mode, boolean inHeader) { if (xmlType == null || javaType == null) throw new IllegalArgumentException("Invalid null parameter"); OperationMetaData opMetaData = getOperationMetaData(); ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaType.getName()); paramMetaData.setMode(mode); paramMetaData.setInHeader(inHeader); paramMetaData.setIndex(opMetaData.getParameters().size()); opMetaData.addParameter(paramMetaData); registerParameterType(xmlType, javaType); } /** Removes all specified parameters from this Call instance. Note that this method removes only the parameters and * not the return type. The setReturnType(null) is used to remove the return type. * * @throws javax.xml.rpc.JAXRPCException This exception may be thrown If this method is called when the method isParameterAndReturnSpecRequired returns false for this Call's operation. */ public void removeAllParameters() { OperationMetaData opMetaData = getOperationMetaData(); opMetaData.removeAllParameters(); } /** Sets the return type for a specific operation. Invoking setReturnType(null) removes the return type for this Call object. */ public void setReturnType(QName xmlType) { Class javaType = getEndpointMetaData().getServiceMetaData().getTypeMapping().getJavaType(xmlType); setReturnType(xmlType, javaType); } /** Sets the return type for a specific operation. */ public void setReturnType(QName xmlType, Class javaType) { if (xmlType == null || javaType == null) throw new IllegalArgumentException("Invalid null parameter"); OperationMetaData opMetaData = getOperationMetaData(); QName xmlName = new QName(Constants.DEFAULT_RPC_RETURN_NAME); String javaTypeName = javaType.getName(); ParameterMetaData retMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaTypeName); opMetaData.setReturnParameter(retMetaData); registerParameterType(xmlType, javaType); } /** Invokes a remote method using the one-way interaction mode. */ public void invokeOneWay(Object[] inputParams) { try { invokeInternal(operationName, inputParams, true); } catch (RemoteException ex) { throw new JAXRPCException(ex); } } /** Invokes a specific operation using a synchronous request-response interaction mode. */ public Object invoke(Object[] inputParams) throws RemoteException { return invokeInternal(operationName, inputParams, false); } /** Invokes a specific operation using a synchronous request-response interaction mode. */ public Object invoke(QName operationName, Object[] inputParams) throws RemoteException { return invokeInternal(operationName, inputParams, false); } protected CommonMessageContext processPivot(CommonMessageContext requestContext) { return MessageContextJAXRPC.processPivot(requestContext); } /** Returns a List values for the output parameters of the last invoked operation. * * @return java.util.List Values for the output parameters. An empty List is returned if there are no output values. * @throws JAXRPCException If this method is invoked for a one-way operation or is invoked before any invoke method has been called. */ public List getOutputValues() { if (epInv == null) throw new JAXRPCException("Output params not available"); try { OperationMetaData opMetaData = getOperationMetaData(); List objPayload = new ArrayList(); for (QName xmlName : epInv.getResponseParamNames()) { Object paramValue = epInv.getResponseParamValue(xmlName); if (opMetaData.isDocumentWrapped()) { objPayload = Arrays.asList((Object[])paramValue); break; } else { objPayload.add(paramValue); } } return objPayload; } catch (SOAPException ex) { throw new JAXRPCException("Cannot obtain response payload", ex); } } /** Returns a Map of {name, value} for the output parameters of the last invoked operation. * The parameter names in the returned Map are of type java.lang.String. * * @return Map Output parameters for the last Call.invoke(). Empty Map is returned if there are no output parameters. * @throws JAXRPCException If this method is invoked for a one-way operation or is invoked before any invoke method has been called. */ public Map getOutputParams() { if (epInv == null) throw new JAXRPCException("Output params not available"); try { Map outMap = new LinkedHashMap(); for (QName xmlName : epInv.getResponseParamNames()) { Object value = epInv.getResponseParamValue(xmlName); outMap.put(xmlName.getLocalPart(), value); } return outMap; } catch (SOAPException ex) { throw new JAXRPCException("Cannot obtain response payload", ex); } } /** * Gets the qualified name of the port type. * * @return Qualified name of the port type */ public QName getPortTypeName() { if (portType != null) { return portType; } /* This code could be used to derive the portType from the endpoint meta data. * However, it breaks CTS com/sun/ts/tests/jaxrpc/api/javax_xml_rpc/Call/Client.java#SetGetPortTypeNameTest2 if (epMetaData != null) { ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData(); WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions(); WSDLService wsdlService = wsdlDefinitions.getService(new NCName(serviceMetaData.getName().getLocalPart())); WSDLEndpoint wsdlEndpoint = wsdlService.getEndpoint(epMetaData.getName()); WSDLInterface wsdlInterface = wsdlEndpoint.getInterface(); return wsdlInterface.getQName(); } */ // CTS com/sun/ts/tests/jaxrpc/api/javax_xml_rpc/Call/Client.java#SetGetPortTypeNameTest2 return new QName(""); } /** * Gets the return type for a specific operation * * @return Returns the XML type for the return value */ public QName getReturnType() { QName retType = null; if (operationName != null) { OperationMetaData opDesc = getOperationMetaData(); ParameterMetaData retMetaData = opDesc.getReturnParameter(); if (retMetaData != null) retType = retMetaData.getXmlType(); } return retType; } /** * Sets the qualified name of the interface. * * @param portType - Qualified name of the port type */ public void setPortTypeName(QName portType) { this.portType = portType; } /** * Indicates whether addParameter and setReturnType methods are to be invoked to specify the parameter and return * type specification for a specific operation. * * @param opName Qualified name of the operation * @return Returns true if the Call implementation class requires addParameter and setReturnType to be invoked in the client code for the specified operation. This method returns false otherwise. * @throws IllegalArgumentException If invalid operation name is specified */ public boolean isParameterAndReturnSpecRequired(QName opName) { setOperationName(opName); OperationMetaData opMetaData = getOperationMetaData(); return opMetaData.getParameters().size() == 0 && opMetaData.getReturnParameter() == null; } /** Gets the names of configurable properties supported by this Call object. * @return Iterator for the property names */ public Iterator getPropertyNames() { return standardProperties.iterator(); } /** Gets the value of a named property. */ public Object getProperty(String name) { if (null == name) throw new JAXRPCException("Unsupported property: " + name); // CTS: com/sun/ts/tests/jaxrpc/api/javax_xml_rpc/Call/Client.java#SetGetPropertyTest2 if (name.startsWith("javax.xml.rpc") && standardProperties.contains(name) == false) throw new JAXRPCException("Unsupported property: " + name); return properties.get(name); } /** Sets the value for a named property. */ public void setProperty(String name, Object value) { if (null == name) throw new JAXRPCException("Unsupported property: " + name); // CTS: com/sun/ts/tests/jaxrpc/api/javax_xml_rpc/Call/Client.java#SetGetPropertyTest2 if (name.startsWith("javax.xml.rpc") && standardProperties.contains(name) == false) throw new JAXRPCException("Unsupported property: " + name); if (log.isDebugEnabled()) log.debug("setProperty: [name=" + name + ",value=" + value + "]"); properties.put(name, value); } /** Removes a named property. */ public void removeProperty(String name) { properties.remove(name); } /** Gets the XML type of a parameter by name. */ public QName getParameterTypeByName(String paramName) { OperationMetaData opMetaData = getOperationMetaData(); ParameterMetaData paramMetaData = opMetaData.getParameter(new QName(paramName)); if (paramMetaData != null) return paramMetaData.getXmlType(); else return null; } protected CommonBindingProvider getCommonBindingProvider() { if (bindingProvider == null) { bindingProvider = new CommonBindingProvider(getEndpointMetaData()); } return bindingProvider; } @Override protected void setInboundContextProperties() { } @Override protected void setOutboundContextProperties() { } private Object invokeInternal(QName opName, Object[] inputParams, boolean forceOneway) throws RemoteException { if (opName.equals(operationName) == false) setOperationName(opName); OperationMetaData opMetaData = getOperationMetaData(); // Check or generate the the schema if this call is unconfigured generateOrUpdateSchemas(opMetaData); // Associate a message context with the current thread SOAPMessageContextJAXRPC msgContext = new SOAPMessageContextJAXRPC(); MessageContextAssociation.pushMessageContext(msgContext); Object retObj = null; try { retObj = super.invoke(opName, inputParams, forceOneway); return retObj; } catch (SOAPFaultException ex) { log.error("Call invocation failed", ex); String faultCode = ex.getFaultCode().getLocalPart(); throw new RemoteException("Call invocation failed with code [" + faultCode + "] because of: " + ex.getFaultString(), ex); } catch (RemoteException rex) { throw rex; } catch (WSTimeoutException toex) { throw toex; } catch (Exception ex) { throw new RemoteException("Call invocation failed", ex); } finally { // Reset the message context association MessageContextAssociation.popMessageContext(); } } @Override protected boolean callRequestHandlerChain(QName portName, HandlerType type) { SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext(); HandlerChainBaseImpl handlerChain = (HandlerChainBaseImpl)jaxrpcService.getHandlerChain(portName); boolean status = (handlerChain != null ? handlerChain.handleRequest(msgContext, type) : true); if (type == HandlerType.ENDPOINT) XOPContext.visitAndRestoreXOPData(); return status; } @Override protected boolean callResponseHandlerChain(QName portName, HandlerType type) { SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext(); HandlerChainBaseImpl handlerChain = (HandlerChainBaseImpl)jaxrpcService.getHandlerChain(portName); boolean status = true; if (handlerChain != null) { status = handlerChain.handleResponse(msgContext, type); } return status; } @Override protected boolean callFaultHandlerChain(QName portName, HandlerType type, Exception ex) { SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext(); HandlerChainBaseImpl handlerChain = (HandlerChainBaseImpl)jaxrpcService.getHandlerChain(portName); boolean status = true; if (handlerChain != null) { status = handlerChain.handleFault(msgContext, type); } return status; } @Override protected void closeHandlerChain(QName portName, HandlerType type) { // nothing to do for JAXRPC } /** Generate or update the XSD schema for all parameters and the return. * This should only be done when the Call is unconfigured, hence there is no WSDL */ private void generateOrUpdateSchemas(OperationMetaData opMetaData) { ServiceMetaData serviceMetaData = opMetaData.getEndpointMetaData().getServiceMetaData(); if (serviceMetaData.getWsdlLocation() == null) { TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData(); for (ParameterMetaData paramMetaData : opMetaData.getParameters()) { generateOrUpdateParameterSchema(typesMetaData, paramMetaData); } ParameterMetaData retMetaData = opMetaData.getReturnParameter(); if (retMetaData != null) { generateOrUpdateParameterSchema(typesMetaData, retMetaData); } } } /** Generate or update the XSD schema for a given parameter * This should only be done if the parameter is not an attachment */ private void generateOrUpdateParameterSchema(TypesMetaData typesMetaData, ParameterMetaData paramMetaData) { if (paramMetaData.isSwA() == false) { QName xmlType = paramMetaData.getXmlType(); Class javaType = paramMetaData.getJavaType(); ServiceMetaData serviceMetaData = getEndpointMetaData().getServiceMetaData(); TypeMappingImpl typeMapping = serviceMetaData.getTypeMapping(); SerializerFactory serFactory = typeMapping.getSerializer(javaType, xmlType); if (serFactory instanceof JBossXBSerializerFactory) { SchemaGenerator xsdGenerator = new SchemaGenerator(); JBossXSModel model = xsdGenerator.generateXSDSchema(xmlType, javaType); typesMetaData.addSchemaModel(model); } } } private void registerParameterType(QName xmlType, Class javaType) { ServiceMetaData serviceMetaData = getEndpointMetaData().getServiceMetaData(); String nsURI = xmlType.getNamespaceURI(); if (Constants.NS_ATTACHMENT_MIME_TYPE.equals(nsURI) == false) { TypeMappingImpl typeMapping = serviceMetaData.getTypeMapping(); Class regJavaType = typeMapping.getJavaType(xmlType); if (regJavaType == null) { typeMapping.register(javaType, xmlType, new JBossXBSerializerFactory(), new JBossXBDeserializerFactory()); } else if (regJavaType != null && JavaUtils.isAssignableFrom(regJavaType, javaType) == false) { throw new IllegalArgumentException("Different java type already registered: " + regJavaType.getName()); } } } @Override public void setConfigName(String configName, String configFile) { EndpointMetaData epMetaData = getEndpointMetaData(); epMetaData.setConfigName(configName, configFile); // Reinitialize the client handler chain jaxrpcService.setupHandlerChain(epMetaData); } public Set getHeaders() { HandlerChainBaseImpl handlerChain = (HandlerChainBaseImpl)jaxrpcService.getHandlerChain(epMetaData.getPortName()); return (handlerChain != null) ? handlerChain.getHeaders() : new HashSet(); } public Set getRoles() { HandlerChainBaseImpl handlerChain = (HandlerChainBaseImpl)jaxrpcService.getHandlerChain(epMetaData.getPortName()); Set set = new HashSet(); String[] roles = handlerChain.getRoles(); if (roles != null) Collections.addAll(set, roles); return set; } @Override protected boolean shouldMaintainSession() { Object bool = getRequestContext().get(Stub.SESSION_MAINTAIN_PROPERTY); return Boolean.TRUE.equals(bool); } }././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceOb0000644000175000017500000003032110721255025031476 0ustar godgod/* * 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. */ // $Id: ServiceObjectFactoryJAXRPC.java 5099 2007-11-22 10:29:41Z thomas.diesler@jboss.com $ package org.jboss.ws.core.jaxrpc.client; // $Id: ServiceObjectFactoryJAXRPC.java 5099 2007-11-22 10:29:41Z thomas.diesler@jboss.com $ import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; import java.net.URL; import java.net.URLEncoder; import java.rmi.Remote; import java.util.Hashtable; import java.util.List; import java.util.Properties; import javax.naming.Context; import javax.naming.Name; import javax.naming.NamingException; import javax.naming.RefAddr; import javax.naming.Reference; import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.Service; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.client.ServiceObjectFactory; import org.jboss.ws.core.server.PortComponentResolver; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.management.EndpointRegistry; import org.jboss.wsf.spi.management.EndpointRegistryFactory; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.SPIProvider; /** * This ServiceObjectFactory reconstructs a javax.xml.rpc.Service * for a given WSDL when the webservice client does a JNDI lookup *

      * It uses the information provided by the service-ref element in application-client.xml * * @author Thomas.Diesler@jboss.org * @since 15-April-2004 */ public class ServiceObjectFactoryJAXRPC extends ServiceObjectFactory { // provide logging private static final Logger log = Logger.getLogger(ServiceObjectFactoryJAXRPC.class); /** * Creates an object using the location or reference information specified. *

      * * @param obj The possibly null object containing location or reference * information that can be used in creating an object. * @param name The name of this object relative to nameCtx, * or null if no name is specified. * @param nameCtx The context relative to which the name * parameter is specified, or null if name is * relative to the default initial context. * @param environment The possibly null environment that is used in * creating the object. * @return The object created; null if an object cannot be created. * @throws Exception if this object factory encountered an exception * while attempting to create an object, and no other object factories are * to be tried. * @see javax.naming.spi.NamingManager#getObjectInstance * @see javax.naming.spi.NamingManager#getURLContext */ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { try { Reference ref = (Reference)obj; // Unmarshall the ServiceRefMetaData UnifiedServiceRefMetaData serviceRef = null; RefAddr metaRefAddr = ref.get(ServiceReferenceable.SERVICE_REF_META_DATA); ByteArrayInputStream bais = new ByteArrayInputStream((byte[])metaRefAddr.getContent()); try { ObjectInputStream ois = new ObjectInputStream(bais); serviceRef = (UnifiedServiceRefMetaData)ois.readObject(); ois.close(); } catch (IOException ex) { NamingException ne = new NamingException("Cannot unmarshall service ref meta data"); ne.setRootCause(ex); throw ne; } // Unmarshall the WSSecurityConfiguration WSSecurityConfiguration securityConfig = null; RefAddr wsseRefAddr = ref.get(ServiceReferenceable.SECURITY_CONFIG); if (wsseRefAddr != null) { bais = new ByteArrayInputStream((byte[])wsseRefAddr.getContent()); try { ObjectInputStream ois = new ObjectInputStream(bais); securityConfig = (WSSecurityConfiguration)ois.readObject(); ois.close(); } catch (IOException e) { throw new NamingException("Cannot unmarshall security config, cause: " + e.toString()); } } ServiceImpl jaxrpcService = null; URL wsdlLocation = serviceRef.getWsdlLocation(); if (wsdlLocation != null) { if (log.isDebugEnabled()) log.debug("Create jaxrpc service from wsdl"); // Create the actual service object QName serviceName = serviceRef.getServiceQName(); JavaWsdlMapping javaWsdlMapping = getJavaWsdlMapping(serviceRef); jaxrpcService = new ServiceImpl(serviceName, wsdlLocation, javaWsdlMapping, securityConfig, serviceRef); } else { if (log.isDebugEnabled()) log.debug("Create jaxrpc service with no wsdl"); jaxrpcService = new ServiceImpl(new QName(Constants.NS_JBOSSWS_URI, "AnonymousService")); } ServiceMetaData serviceMetaData = jaxrpcService.getServiceMetaData(); // Set any service level properties if (serviceRef.getCallProperties().size() > 0) { Properties callProps = new Properties(); serviceMetaData.setProperties(callProps); for (UnifiedCallPropertyMetaData prop : serviceRef.getCallProperties()) callProps.setProperty(prop.getPropName(), prop.getPropValue()); } // The web service client using a port-component-link, the contet is the URL to // the PortComponentLinkServlet that will return the actual endpoint address RefAddr pcLinkRef = ref.get(ServiceReferenceable.PORT_COMPONENT_LINK); if (pcLinkRef != null) { String pcLink = (String)pcLinkRef.getContent(); log.debug("Resolving port-component-link: " + pcLink); // First try to obtain the endpoint address loacally String endpointAddress = null; try { SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); EndpointRegistry epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry(); Endpoint endpoint = epRegistry.resolve( new PortComponentResolver(pcLink) ); if (endpoint == null) throw new WSException("Cannot resolve port-component-link: " + pcLink); ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); endpointAddress = sepMetaData.getEndpointAddress(); } catch (Throwable ex) { // ignore, we are probably a remote client } // We may be remote in the esoteric case where an appclient uses the port-comonent-link feature if (endpointAddress == null) { String servletPath = (String)ref.get(ServiceReferenceable.PORT_COMPONENT_LINK_SERVLET).getContent(); servletPath += "?pcLink=" + URLEncoder.encode(pcLink, "UTF-8"); InputStream is = new URL(servletPath).openStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); endpointAddress = br.readLine(); is.close(); } if (log.isDebugEnabled()) log.debug("Resolved to: " + endpointAddress); if (serviceMetaData.getEndpoints().size() == 1) { EndpointMetaData epMetaData = serviceMetaData.getEndpoints().get(0); epMetaData.setEndpointAddress(endpointAddress); } else { log.warn("Cannot set endpoint address for port-component-link, unsuported number of endpoints"); } } narrowPortSelection(serviceRef, serviceMetaData); /******************************************************** * Setup the Proxy that implements the service-interface ********************************************************/ // load the service interface class ClassLoader contextCL = Thread.currentThread().getContextClassLoader(); Class siClass = contextCL.loadClass(serviceRef.getServiceInterface()); if (Service.class.isAssignableFrom(siClass) == false) throw new JAXRPCException("The service interface does not implement javax.xml.rpc.Service: " + siClass.getName()); // load all service endpoint interface classes for (UnifiedPortComponentRefMetaData pcr : serviceRef.getPortComponentRefs()) { String seiName = pcr.getServiceEndpointInterface(); if (seiName != null) { Class seiClass = contextCL.loadClass(seiName); if (Remote.class.isAssignableFrom(seiClass) == false) throw new IllegalArgumentException("The SEI does not implement java.rmi.Remote: " + seiClass.getName()); } } // Setup the handler chain setupHandlerChain(jaxrpcService); InvocationHandler handler = new ServiceProxy(jaxrpcService, siClass); return Proxy.newProxyInstance(contextCL, new Class[] { siClass, ServiceExt.class }, handler); } catch (Exception ex) { log.error("Cannot create service", ex); throw ex; } } /** * Setup the handler chain(s) for this service */ private void setupHandlerChain(ServiceImpl jaxrpcService) throws Exception { List endpoints = jaxrpcService.getServiceMetaData().getEndpoints(); for (EndpointMetaData epMetaData : endpoints) { jaxrpcService.setupHandlerChain(epMetaData); } } private JavaWsdlMapping getJavaWsdlMapping(UnifiedServiceRefMetaData serviceRef) { JavaWsdlMapping javaWsdlMapping = null; if (serviceRef.getMappingFile() != null) { String mappingFile = serviceRef.getMappingFile(); try { JavaWsdlMappingFactory mappingFactory = JavaWsdlMappingFactory.newInstance(); URL mappingURL = serviceRef.getVfsRoot().findChild(mappingFile).toURL(); javaWsdlMapping = mappingFactory.parse(mappingURL); } catch (Exception e) { throw new WSException("Cannot unmarshal jaxrpc-mapping-file: " + mappingFile, e); } } return javaWsdlMapping; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/client/ServiceFa0000644000175000017500000001515010560061125031464 0ustar godgod/* * 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.core.jaxrpc.client; // $Id: ServiceFactoryImpl.java 2209 2007-01-31 09:33:09Z thomas.diesler@jboss.com $ import java.net.URL; import java.util.Properties; import javax.xml.namespace.QName; import javax.xml.rpc.Service; import javax.xml.rpc.ServiceException; import javax.xml.rpc.ServiceFactory; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; /** * Service class acts as a factory for: *

        *
      • Dynamic proxy for the target service endpoint. *
      • Instance of the type javax.xml.rpc.Call for the dynamic invocation of a remote operation on the target service endpoint. *
      • Instance of a generated stub class *
      * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public class ServiceFactoryImpl extends ServiceFactory { // provide logging private final Logger log = Logger.getLogger(ServiceFactoryImpl.class); /** * Create an instance of the generated service implementation class for a given service interface, if available. * * @param serviceInterface Service interface * @return A Service * @throws ServiceException If there is any error while creating the specified service, including the case where a * generated service implementation class cannot be located */ public Service loadService(Class serviceInterface) throws ServiceException { throw new NotImplementedException(); } /** * Create an instance of the generated service implementation class for a given service interface, if available. * An implementation may use the provided wsdlDocumentLocation and properties to help locate the generated implementation class. * If no such class is present, a ServiceException will be thrown. * * @param wsdlDocumentLocation URL for the WSDL document location for the service or null * @param serviceInterface Service interface * @param props A set of implementation-specific properties to help locate the generated service implementation class * @return A Service * @throws ServiceException If there is any error while creating the specified service, including the case where a * generated service implementation class cannot be located */ public Service loadService(URL wsdlDocumentLocation, Class serviceInterface, Properties props) throws ServiceException { throw new NotImplementedException(); } /** * Create an instance of the generated service implementation class for a given service, if available. * The service is uniquely identified by the wsdlDocumentLocation and serviceName arguments. * An implementation may use the provided properties to help locate the generated implementation class. * If no such class is present, a ServiceException will be thrown. * * @param wsdlDocumentLocation URL for the WSDL document location for the service or null * @param serviceName Qualified name for the service * @param props A set of implementation-specific properties to help locate the generated service implementation class * @return A Service * @throws ServiceException If there is any error while creating the specified service, including the case where a generated service implementation class cannot be located */ public Service loadService(URL wsdlDocumentLocation, QName serviceName, Properties props) throws ServiceException { throw new NotImplementedException(); } /** * Create a Service instance. * * @param serviceName QName for the service * @return Service. * @throws ServiceException If any error in creation of the specified service */ public Service createService(QName serviceName) throws ServiceException { return new ServiceImpl(serviceName); } /** * Create a Service instance. * * @param wsdlURL URL for the WSDL document location * @param serviceName QName for the service. * @return Service. * @throws ServiceException If any error in creation of the specified service */ public Service createService(URL wsdlURL, QName serviceName) throws ServiceException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL mappingURL = cl.getResource("META-INF/jaxrpc-mapping.xml"); if (mappingURL != null) log.info("Use jaxrpc-mapping from: " + mappingURL); return createService(wsdlURL, serviceName, mappingURL, null); } /** * Create a Service instance. * * @param wsdlURL URL for the WSDL document location * @param serviceName QName for the service. * @param mappingURL URL for the jaxrpc-mapping.xml document location * @return Service. * @throws ServiceException If any error in creation of the specified service */ public Service createService(URL wsdlURL, QName serviceName, URL mappingURL) throws ServiceException { return createService(wsdlURL, serviceName, mappingURL, null); } /** * Create a Service instance. * * @param wsdlURL URL for the WSDL document location * @param serviceName QName for the service. * @param mappingURL URL for the jaxrpc-mapping.xml document location * @param securityURL URL for the jboss-ws-security.xml file * @return Service. * @throws ServiceException If any error in creation of the specified service */ public Service createService(URL wsdlURL, QName serviceName, URL mappingURL, URL securityURL) throws ServiceException { ServiceImpl service = new ServiceImpl(serviceName, wsdlURL, mappingURL, securityURL); return service; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/ParameterWrapping.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/ParameterWrappin0000644000175000017500000003006310656142514031630 0ustar godgod/* * 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.core.jaxrpc; // $Id: ParameterWrapping.java 4241 2007-08-07 19:17:32Z heiko.braun@jboss.com $ import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; import java.util.Map; import javassist.ClassPool; import javassist.CtClass; import javassist.CtField; import javassist.CtNewMethod; import javassist.LoaderClassPath; import javassist.Modifier; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.utils.HolderUtils; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.TypeMappingMetaData; import org.jboss.ws.metadata.umdm.TypesMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.wsf.common.JavaUtils; /** A helper class to wrap/unwrap ducument style request/response structures. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 06-Jun-2005 */ public class ParameterWrapping { // provide logging private static Logger log = Logger.getLogger(ParameterWrapping.class); // This assertion should probably be moved somewhere earlier private static void assertOperationMetaData(OperationMetaData opMetaData) { if (opMetaData.getStyle() != Style.DOCUMENT) throw new WSException("Unexpected style: " + opMetaData.getStyle()); if (opMetaData.getParameterStyle() != ParameterStyle.WRAPPED) throw new WSException("Unexpected parameter style: " + opMetaData.getParameterStyle()); } private static Object holderValue(Object holder) { if (holder == null) return null; if (! HolderUtils.isHolderType(holder.getClass())) return holder; return HolderUtils.getHolderValue(holder); } public static Class getWrappedType(String variable, Class wrapperType) { try { PropertyDescriptor pd = new PropertyDescriptor(variable, wrapperType); Method method = pd.getWriteMethod(); return method.getParameterTypes()[0]; } catch (Exception ex) { if(log.isDebugEnabled()) log.debug("Invalid request wrapper: " + ex); return null; } } public static Object wrapRequestParameters(ParameterMetaData request, Object[] methodParams) { assertOperationMetaData(request.getOperationMetaData()); Class reqStructType = request.getJavaType(); if(log.isDebugEnabled()) log.debug("wrapRequestParameters: " + reqStructType.getName()); List wrappedParameters = request.getWrappedParameters(); try { Object reqStruct = reqStructType.newInstance(); for (WrappedParameter param : wrappedParameters) { Object value = holderValue(methodParams[param.getIndex()]); param.accessor().set(reqStruct, value); } return reqStruct; } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new WSException("Cannot wrap request structure: " + e); } } public static Map unwrapRequestParameters(ParameterMetaData request, Object reqStruct, Object[] methodParams) { OperationMetaData opMetaData = request.getOperationMetaData(); assertOperationMetaData(opMetaData); if (reqStruct == null) throw new IllegalArgumentException("Request struct cannot be null"); Class[] targetParameterTypes = opMetaData.getJavaMethod().getParameterTypes(); Map outParameters = new HashMap(targetParameterTypes.length); List wrappedParameters = request.getWrappedParameters(); Class reqStructType = reqStruct.getClass(); if(log.isDebugEnabled()) log.debug("unwrapRequestParameters: " + reqStructType.getName()); try { for (WrappedParameter param : wrappedParameters) { Class targetType = targetParameterTypes[param.getIndex()]; Object value = param.accessor().get(reqStruct); // INOUT Parameter if (HolderUtils.isHolderType(targetType)) { value = HolderUtils.createHolderInstance(value, targetType); outParameters.put(param.getIndex(), value); } methodParams[param.getIndex()] = value; } } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new IllegalArgumentException("Cannot unwrap request structure: " + e); } return outParameters; } public static Object wrapResponseParameters(ParameterMetaData returnMetaData, Object returnValue, Map outParameters) { assertOperationMetaData(returnMetaData.getOperationMetaData()); Class resStructType = returnMetaData.getJavaType(); if (returnValue != null && returnValue.getClass() == resStructType) { if(log.isDebugEnabled()) log.debug("Response parameter already wrapped" + resStructType.getName()); return returnValue; } if(log.isDebugEnabled()) log.debug("wrapResponseParameter: " + resStructType.getName()); List wrappedParameters = returnMetaData.getWrappedParameters(); try { Object resStruct = resStructType.newInstance(); for (WrappedParameter param : wrappedParameters) { Object value = (param.getIndex() < 0) ? returnValue : holderValue(outParameters.get(param.getIndex())); param.accessor().set(resStruct, value); } return resStruct; } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new WSException("Cannot wrap response structure: " + e); } } public static Object unwrapResponseParameters(ParameterMetaData retMetaData, Object resStruct, Object methodParams[]) { OperationMetaData operationMetaData = retMetaData.getOperationMetaData(); assertOperationMetaData(operationMetaData); Object retValue = null; if (resStruct != null) { Class resStructType = resStruct.getClass(); if(log.isDebugEnabled()) log.debug("unwrapResponseParameter: " + resStructType.getName()); List wrappedParameters = retMetaData.getWrappedParameters(); Class[] targetTypes = operationMetaData.getJavaMethod().getParameterTypes(); try { for (WrappedParameter param : wrappedParameters) { Object value = param.accessor().get(resStruct); if (param.getIndex() < 0) { retValue = value; } else { Class targetType = targetTypes[param.getIndex()]; if (HolderUtils.isHolderType(targetType)) HolderUtils.setHolderValue(methodParams[param.getIndex()], value); methodParams[param.getIndex()] = value; } } } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new IllegalArgumentException("Cannot unwrap request structure: " + e); } } return retValue; } /** * This is just a dummy marker class used to identify a generated * document/literal wrapped type * * @author Jason T. Greene * @version $Revision: 4241 $ */ public static class WrapperType { } /** * Generates a wrapper type and assigns it to the passed ParameterMetaData * object. This routine requires the pmd to contain completed wrappedTypes * and wrappedVariables properties of the passed ParameterMetaData object. * * @param pmd a document/literal wrapped parameter */ public static void generateWrapper(ParameterMetaData pmd, boolean addTypeMapping) { List wrappedParameters = pmd.getWrappedParameters(); OperationMetaData operationMetaData = pmd.getOperationMetaData(); EndpointMetaData endpointMetaData = operationMetaData.getEndpointMetaData(); ServiceMetaData serviceMetaData = endpointMetaData.getServiceMetaData(); ClassLoader loader = serviceMetaData.getUnifiedMetaData().getClassLoader(); if (operationMetaData.isDocumentWrapped() == false) throw new WSException("Operation is not document/literal (wrapped)"); if (wrappedParameters == null) throw new WSException("Cannot generate a type when their is no wrapped parameters"); String serviceName = serviceMetaData.getServiceName().getLocalPart(); String parameterName = pmd.getXmlName().getLocalPart(); String endpointName = endpointMetaData.getPortName().getLocalPart(); String packageName = endpointMetaData.getServiceEndpointInterface().getPackage().getName(); String wrapperName = packageName + "._JBossWS_" + serviceName + "_" + endpointName + "_" + parameterName; if(log.isDebugEnabled()) log.debug("Generating wrapper: " + wrapperName); Class wrapperType; try { ClassPool pool = new ClassPool(true); pool.appendClassPath(new LoaderClassPath(loader)); CtClass clazz = pool.makeClass(wrapperName); clazz.setSuperclass(pool.get(WrapperType.class.getName())); for (WrappedParameter param : wrappedParameters) { CtField field = new CtField(pool.get(param.getType()), param.getVariable(), clazz); field.setModifiers(Modifier.PRIVATE); clazz.addField(field); clazz.addMethod(CtNewMethod.getter("get" + JavaUtils.capitalize(param.getVariable()), field)); clazz.addMethod(CtNewMethod.setter("set" + JavaUtils.capitalize(param.getVariable()), field)); } wrapperType = (Class)pool.toClass(clazz, loader); } catch (Exception e) { throw new WSException("Could not generate wrapper type: " + wrapperName, e); } // Register type mapping if needed if (addTypeMapping) { QName xmlType = pmd.getXmlType(); TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData(); TypeMappingMetaData tmMetaData = new TypeMappingMetaData(typesMetaData, xmlType, wrapperName); typesMetaData.addTypeMapping(tmMetaData); TypeMappingImpl typeMapping = serviceMetaData.getTypeMapping(); typeMapping.register(wrapperType, xmlType, new JBossXBSerializerFactory(), new JBossXBDeserializerFactory()); } pmd.setJavaTypeName(wrapperName); } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxrpc/SerializationCon0000644000175000017500000001234110650145103031612 0ustar godgod/* * 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.core.jaxrpc; // $Id: SerializationContextJAXRPC.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import org.apache.xerces.xs.XSModel; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping; import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping; import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.TypesMetaData; import org.jboss.wsf.common.JavaUtils; /** * The serialization context for JAXRPC endpoints/clients * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class SerializationContextJAXRPC extends SerializationContext { // provide logging private static final Logger log = Logger.getLogger(SerializationContextJAXRPC.class); // XML mapping from jaxrpc-mapping.xml private JavaWsdlMapping jaxrpcMapping; public JavaWsdlMapping getJavaWsdlMapping() { if (jaxrpcMapping == null) { log.debug("Generate jaxrpcMapping from typeMapping"); jaxrpcMapping = new JavaWsdlMapping(); for (QName xmlType : getTypeMapping().getRegisteredXmlTypes()) { String nsURI = xmlType.getNamespaceURI(); if (!Constants.NS_SCHEMA_XSD.equals(nsURI) && !Constants.NS_ATTACHMENT_MIME_TYPE.equals(nsURI)) { Class javaType = getTypeMapping().getJavaType(xmlType); String javaTypeName = javaType.getName(); Class componentType = javaType; while (componentType.isArray()) componentType = componentType.getComponentType(); if (JavaUtils.isPrimitive(componentType)) componentType = JavaUtils.getWrapperType(componentType); Package packageObject = componentType.getPackage(); String packageName = (packageObject != null) ? packageObject.getName() : ""; String packageType = jaxrpcMapping.getPackageNameForNamespaceURI(nsURI); if (packageName.equals(packageType) == false) { PackageMapping packageMapping = new PackageMapping(jaxrpcMapping); packageMapping.setNamespaceURI(nsURI); packageMapping.setPackageType(packageName); jaxrpcMapping.addPackageMapping(packageMapping); if (log.isDebugEnabled()) log.debug("Add package mapping: " + packageMapping); } // Do not add mappings for array types if (javaType.isArray()) continue; JavaXmlTypeMapping xmlTypeMapping = jaxrpcMapping.getTypeMappingForQName(xmlType); if (xmlTypeMapping == null) { xmlTypeMapping = new JavaXmlTypeMapping(jaxrpcMapping); xmlTypeMapping.setQNameScope("complexType"); xmlTypeMapping.setJavaType(javaTypeName); xmlTypeMapping.setRootTypeQName(xmlType); jaxrpcMapping.addJavaXmlTypeMappings(xmlTypeMapping); if (log.isDebugEnabled()) log.debug("Add type mapping: " + xmlTypeMapping); } } } } return jaxrpcMapping; } public void setJavaWsdlMapping(JavaWsdlMapping jaxrpcMapping) { this.jaxrpcMapping = jaxrpcMapping; } public XSModel getXsModel() { SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); OperationMetaData opMetaData = msgContext.getOperationMetaData(); ServiceMetaData serviceMetaData = opMetaData.getEndpointMetaData().getServiceMetaData(); TypesMetaData typesMetaData = serviceMetaData.getTypesMetaData(); return typesMetaData.getSchemaModel(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/0000755000175000017500000000000010755000265026263 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/spi/0000755000175000017500000000000010755000265027056 5ustar godgod././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/spi/EndpointImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/spi/EndpointImpl.0000644000175000017500000002045610676430372031500 0ustar godgod/* * 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.core.jaxws.spi; // $Id: EndpointImpl.java 4630 2007-09-26 10:14:18Z heiko.braun@jboss.com $ import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.core.jaxws.binding.BindingProviderImpl; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.http.HttpContext; import org.jboss.wsf.spi.http.HttpServer; import org.jboss.wsf.spi.http.HttpServerFactory; import org.w3c.dom.Element; import javax.xml.transform.Source; import javax.xml.ws.Binding; import javax.xml.ws.BindingProvider; import javax.xml.ws.Endpoint21; import javax.xml.ws.EndpointReference; import javax.xml.ws.WebServicePermission; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.concurrent.Executor; /** * A Web service endpoint implementation. * * @author Thomas.Diesler@jboss.com * @since 07-Jul-2006 */ public class EndpointImpl extends Endpoint21 { // provide logging private final Logger log = Logger.getLogger(EndpointImpl.class); // The permission to publish an endpoint private static final WebServicePermission ENDPOINT_PUBLISH_PERMISSION = new WebServicePermission("publishEndpoint"); private Object implementor; private Executor executor; private List metadata; private BindingProvider bindingProvider; private Map properties = new HashMap(); private HttpContext serverContext; private boolean isPublished; private boolean isDestroyed; public EndpointImpl(String bindingId, Object implementor) { log.debug("new EndpointImpl(bindingId=" + bindingId + ",implementor=" + implementor + ")"); if (implementor == null) throw new IllegalArgumentException("Implementor cannot be null"); this.implementor = implementor; this.bindingProvider = new BindingProviderImpl(bindingId); } @Override public Binding getBinding() { return bindingProvider.getBinding(); } @Override public Object getImplementor() { return implementor; } /** * Publishes this endpoint at the given address. The necessary server infrastructure will be created and configured by the JAX-WS * implementation using some default configuration. In order to get more control over the server configuration, * please use the javax.xml.ws.Endpoint#publish(Object) method instead. * * @param address specifying the address to use. The address must be compatible with the binding specified at the time the endpoint was created. */ @Override public void publish(String address) { log.debug("publish: " + address); URI addrURI; try { addrURI = new URI(address); } catch (URISyntaxException e) { throw new IllegalArgumentException("Invalid address: " + address); } // Check with the security manger checkPublishEndpointPermission(); // Create and start the HTTP server SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); HttpServer httpServer = spiProvider.getSPI(HttpServerFactory.class).getHttpServer(); httpServer.setProperties(properties); httpServer.start(); String path = addrURI.getPath(); String contextRoot = "/" + new StringTokenizer(path, "/").nextToken(); HttpContext context = httpServer.createContext(contextRoot); publish(context); } /** * Publishes this endpoint at the provided server context. * A server context encapsulates the server infrastructure and addressing information for a particular transport. * For a call to this method to succeed, the server context passed as an argument to it must be compatible with the endpoint's binding. * * @param context An object representing a server context to be used for publishing the endpoint. */ @Override public void publish(Object context) { log.debug("publish: " + context); if (isDestroyed) throw new IllegalStateException("Endpoint already destroyed"); // Check with the security manger checkPublishEndpointPermission(); /* Check if we are standalone boolean isStandalone; try { SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); spiProvider.getSPI(ServerConfigFactory.class).getServerConfig(); isStandalone = false; } catch (Exception ex) { // ignore, there should be no ServerConfigFactory in VM isStandalone = true; } if (isStandalone == false) throw new IllegalStateException("Cannot publish endpoint from within server"); */ if (context instanceof HttpContext) { serverContext = (HttpContext)context; HttpServer httpServer = serverContext.getHttpServer(); httpServer.publish(serverContext, this); isPublished = true; } } @Override public void stop() { log.debug("stop"); if (serverContext == null || isPublished == false) log.error("Endpoint not published"); try { if (serverContext != null) { HttpServer httpServer = serverContext.getHttpServer(); httpServer.destroy(serverContext, this); } } catch (Exception ex) { log.error("Cannot stop endpoint", ex); } isPublished = false; isDestroyed = true; } @Override public boolean isPublished() { return isPublished; } @Override public List getMetadata() { return metadata; } @Override public void setMetadata(List list) { log.info("Ignore metadata, not implemented"); this.metadata = list; } @Override public Executor getExecutor() { return executor; } @Override public void setExecutor(Executor executor) { log.info("Ignore executor, not implemented"); this.executor = executor; } @Override public Map getProperties() { return properties; } @Override public void setProperties(Map map) { properties = map; } private void checkPublishEndpointPermission() { // 5.10 Conformance (Checking publishEndpoint Permission): When any of the publish methods defined // by the Endpoint class are invoked, an implementation MUST check whether a SecurityManager is // installed with the application. If it is, implementations MUST verify that the application has the // WebServicePermission identified by the target name publishEndpoint before proceeding. If the permission // is not granted, implementations MUST NOT publish the endpoint and they MUST throw a // java.lang.SecurityException. SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(ENDPOINT_PUBLISH_PERMISSION); } } @Override public EndpointReference getEndpointReference(Element... referenceParameters) { throw new NotImplementedException(); } @Override public T getEndpointReference(Class clazz, Element... referenceParameters) { throw new NotImplementedException(); } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/spi/ProviderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/spi/ProviderImpl.0000644000175000017500000001125310714611540031474 0ustar godgod/* * 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.core.jaxws.spi; // $Id: ProviderImpl.java 5015 2007-11-08 13:47:12Z heiko.braun@jboss.com $ import java.net.MalformedURLException; import java.net.URL; import java.util.List; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.ws.Endpoint; import javax.xml.ws.EndpointReference; import javax.xml.ws.WebServiceFeature; import javax.xml.ws.soap.SOAPBinding; import javax.xml.ws.spi.Provider; import javax.xml.ws.spi.ServiceDelegate; import javax.xml.ws.spi.Provider21; import javax.xml.ws.wsaddressing.W3CEndpointReference; import org.jboss.util.NotImplementedException; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Element; /** * Service provider for ServiceDelegate and Endpoint objects. * * @author Thomas.Diesler@jboss.com * @since 03-May-2006 */ public class ProviderImpl extends Provider21 { // 6.2 Conformance (Concrete javax.xml.ws.spi.Provider required): An implementation MUST provide // a concrete class that extends javax.xml.ws.spi.Provider. Such a class MUST have a public constructor // which takes no arguments. public ProviderImpl() { } @Override public ServiceDelegate createServiceDelegate(URL wsdlLocation, QName serviceName, Class serviceClass) { ServiceDelegateImpl delegate = new ServiceDelegateImpl(wsdlLocation, serviceName, serviceClass); DOMUtils.clearThreadLocals(); return delegate; } @Override public Endpoint createEndpoint(String bindingId, Object implementor) { EndpointImpl endpoint = new EndpointImpl(bindingId, implementor); return endpoint; } @Override public Endpoint createAndPublishEndpoint(String address, Object implementor) { // 6.3 Conformance (Provider createAndPublishEndpoint Method): The effect of invoking the createAnd- // PublishEndpoint method on a Provider MUST be the same as first invoking the createEndpoint // method with the binding ID appropriate to the URL scheme used by the address, then invoking the // publish(String address) method on the resulting endpoint. String bindingId = getBindingFromAddress(address); EndpointImpl endpoint = (EndpointImpl)createEndpoint(bindingId, implementor); endpoint.publish(address); return endpoint; } private String getBindingFromAddress(String address) { String bindingId; try { URL url = new URL(address); String protocol = url.getProtocol(); if (protocol.startsWith("http")) { bindingId = SOAPBinding.SOAP11HTTP_BINDING; } else { throw new IllegalArgumentException("Unsupported protocol: " + address); } } catch (MalformedURLException e) { throw new IllegalArgumentException("Invalid endpoint address: " + address); } return bindingId; } @Override public T createEndpointReference(Class clazz, QName serviceName, QName portName, Source wsdlDocumentLocation, Element... referenceParameters) { throw new NotImplementedException(); } @Override public W3CEndpointReference createW3CEndpointReference(String address, QName serviceName, QName portName, List metadata, String wsdlDocumentLocation, List referenceParameters) { throw new NotImplementedException(); } @Override public T getPort(EndpointReference endpointReference, Class serviceEndpointInterface, WebServiceFeature... features) { throw new NotImplementedException(); } @Override public EndpointReference readEndpointReference(Source eprInfoset) { throw new NotImplementedException(); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/spi/ServiceDelega0000644000175000017500000004315710723247145031522 0ustar godgod/* * 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.core.jaxws.spi; // $Id: ServiceDelegateImpl.java 5125 2007-11-28 11:17:57Z richard.opalka@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Proxy; import java.net.URL; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.jws.WebService; import javax.xml.bind.JAXBContext; import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import javax.xml.ws.Dispatch; import javax.xml.ws.EndpointReference; import javax.xml.ws.Service; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; import javax.xml.ws.Service.Mode; import javax.xml.ws.handler.HandlerResolver; import javax.xml.ws.spi.ServiceDelegate; import javax.xml.ws.spi.ServiceDelegate21; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.core.StubExt; import org.jboss.ws.core.jaxws.client.ClientImpl; import org.jboss.ws.core.jaxws.client.ClientProxy; import org.jboss.ws.core.jaxws.client.DispatchImpl; import org.jboss.ws.core.jaxws.client.ServiceObjectFactoryJAXWS; import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl; import org.jboss.ws.extensions.wsrm.api.RMProvider; import org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder; import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder; import org.jboss.ws.metadata.umdm.ClientEndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.ws.metadata.wsdl.WSDLUtils; import org.jboss.wsf.common.ResourceLoaderAdapter; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Service delegates are used internally by Service objects to allow pluggability of JAX-WS implementations. * * Every Service object has its own delegate, created using the javax.xml.ws.Provider#createServiceDelegate method. * A Service object delegates all of its instance methods to its delegate. * * @author Thomas.Diesler@jboss.com * @since 03-May-2006 */ public class ServiceDelegateImpl extends ServiceDelegate21 { // provide logging private final Logger log = Logger.getLogger(ServiceDelegateImpl.class); // The executor service private static ExecutorService defaultExecutor = Executors.newCachedThreadPool(); // The service meta data that is associated with this JAXWS Service private ServiceMetaData serviceMetaData; // The ServiceRefMetaData supplied by the ServiceObjectFactory private UnifiedServiceRefMetaData usRef; // The handler resolver private HandlerResolver handlerResolver; // The executor service private ExecutorService executor; // A list of annotated ports private List annotatedPorts = new ArrayList(); public ServiceDelegateImpl(URL wsdlURL, QName serviceName, Class serviceClass) { // If this Service was constructed through the ServiceObjectFactory // this thread local association should be available usRef = ServiceObjectFactoryJAXWS.getServiceRefAssociation(); UnifiedVirtualFile vfsRoot = (usRef != null ? vfsRoot = usRef.getVfsRoot() : new ResourceLoaderAdapter()); // Verify wsdl access if this is not a generic Service if (wsdlURL != null && serviceClass != Service.class) { try { InputStream is = wsdlURL.openStream(); is.close(); } catch (IOException e) { log.warn("Cannot access wsdlURL: " + wsdlURL); wsdlURL = null; } } if (wsdlURL != null) { JAXWSClientMetaDataBuilder builder = new JAXWSClientMetaDataBuilder(); serviceMetaData = builder.buildMetaData(serviceName, wsdlURL, vfsRoot); } else { UnifiedMetaData wsMetaData = new UnifiedMetaData(vfsRoot); serviceMetaData = new ServiceMetaData(wsMetaData, serviceName); wsMetaData.addService(serviceMetaData); } handlerResolver = new HandlerResolverImpl(); if (usRef != null) { serviceMetaData.setServiceRefName(usRef.getServiceRefName()); // Setup the service handlers if (usRef.getHandlerChain() != null) { String filename = usRef.getHandlerChain(); UnifiedHandlerChainsMetaData handlerChainsMetaData = JAXWSMetaDataBuilder.getHandlerChainsMetaData(serviceClass, filename); for (UnifiedHandlerChainMetaData UnifiedHandlerChainMetaData : handlerChainsMetaData.getHandlerChains()) { for (UnifiedHandlerMetaData uhmd : UnifiedHandlerChainMetaData.getHandlers()) { HandlerMetaDataJAXWS hmd = HandlerMetaDataJAXWS.newInstance(uhmd, HandlerType.ENDPOINT); serviceMetaData.addHandler(hmd); } } ((HandlerResolverImpl)handlerResolver).initServiceHandlerChain(serviceMetaData); } } } /** * The getPort method returns a stub. A service client uses this stub to invoke operations on the target service endpoint. * The serviceEndpointInterface specifies the service endpoint interface that is supported by the created dynamic proxy or stub instance. */ @Override public T getPort(QName portName, Class seiClass) { assertSEIConstraints(seiClass); if (serviceMetaData == null) throw new WebServiceException("Service meta data not available"); // com/sun/ts/tests/jaxws/api/javax_xml_ws/Service#GetPort1NegTest1WithWsdl EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName); if (serviceMetaData.getEndpoints().size() > 0 && epMetaData == null) throw new WebServiceException("Cannot get port meta data for: " + portName); // This is the case when the service could not be created from wsdl if (serviceMetaData.getEndpoints().size() == 0) { log.warn("Cannot get port meta data for: " + portName); QName portType = getPortTypeName(seiClass); epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, portType, Type.JAXWS); } String seiClassName = seiClass.getName(); epMetaData.setServiceEndpointInterfaceName(seiClassName); return getPortInternal(epMetaData, seiClass); } /** * The getPort method returns a stub. A service client uses this stub to invoke operations on the target service endpoint. * The serviceEndpointInterface specifies the service endpoint interface that is supported by the created dynamic proxy or stub instance. */ @Override public T getPort(Class seiClass) { assertSEIConstraints(seiClass); if (serviceMetaData == null) throw new WebServiceException("Service meta data not available"); String seiClassName = seiClass.getName(); EndpointMetaData epMetaData = serviceMetaData.getEndpointByServiceEndpointInterface(seiClassName); if (epMetaData == null && serviceMetaData.getEndpoints().size() == 1) { epMetaData = serviceMetaData.getEndpoints().get(0); epMetaData.setServiceEndpointInterfaceName(seiClassName); } else { QName portTypeName = getPortTypeName(seiClass); for (EndpointMetaData epmd : serviceMetaData.getEndpoints()) { if (portTypeName.equals(epmd.getPortTypeName())) { epmd.setServiceEndpointInterfaceName(seiClass.getName()); epMetaData = epmd; break; } } } if (epMetaData == null) throw new WebServiceException("Cannot get port meta data for: " + seiClassName); return getPortInternal(epMetaData, seiClass); } private QName getPortTypeName(Class seiClass) { if (!seiClass.isAnnotationPresent(WebService.class)) throw new IllegalArgumentException("Cannot find @WebService on: " + seiClass.getName()); WebService anWebService = seiClass.getAnnotation(WebService.class); String localPart = anWebService.name(); if (localPart.length() == 0) localPart = WSDLUtils.getJustClassName(seiClass); String nsURI = anWebService.targetNamespace(); if (nsURI.length() == 0) nsURI = WSDLUtils.getTypeNamespace(seiClass); QName portType = new QName(nsURI, localPart); return portType; } private T getPortInternal(EndpointMetaData epMetaData, Class seiClass) { QName portName = epMetaData.getPortName(); // Adjust the endpoint meta data according to the annotations if (annotatedPorts.contains(portName) == false) { JAXWSClientMetaDataBuilder metaDataBuilder = new JAXWSClientMetaDataBuilder(); metaDataBuilder.rebuildEndpointMetaData(epMetaData, seiClass); annotatedPorts.add(portName); } return (T)createProxy(seiClass, epMetaData); } private void assertSEIConstraints(Class seiClass) { if (seiClass == null) throw new IllegalArgumentException("Service endpoint interface cannot be null"); if (!seiClass.isAnnotationPresent(WebService.class)) throw new WebServiceException("SEI is missing @WebService annotation: " + seiClass); } @Override /** * Creates a new port for the service. * Ports created in this way contain no WSDL port type information * and can only be used for creating Dispatchinstances. */ public void addPort(QName portName, String bindingId, String epAddress) { EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName); if (epMetaData == null) { epMetaData = new ClientEndpointMetaData(serviceMetaData, portName, null, Type.JAXWS); serviceMetaData.addEndpoint(epMetaData); } epMetaData.setBindingId(bindingId); epMetaData.setEndpointAddress(epAddress); } @Override public Dispatch createDispatch(QName portName, Class type, Mode mode) { ExecutorService executor = (ExecutorService)getExecutor(); EndpointMetaData epMetaData = getEndpointMetaData(portName); DispatchImpl dispatch = new DispatchImpl(executor, epMetaData, type, mode); return dispatch; } @Override public Dispatch createDispatch(QName portName, JAXBContext jbc, Mode mode) { ExecutorService executor = (ExecutorService)getExecutor(); EndpointMetaData epMetaData = getEndpointMetaData(portName); DispatchImpl dispatch = new DispatchImpl(executor, epMetaData, jbc, mode); return dispatch; } private EndpointMetaData getEndpointMetaData(QName portName) { EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName); if (epMetaData == null) throw new WebServiceException("Cannot find port: " + portName); return epMetaData; } /** Gets the name of this service. */ @Override public QName getServiceName() { return serviceMetaData.getServiceName(); } /** Returns an Iterator for the list of QNames of service endpoints grouped by this service */ @Override public Iterator getPorts() { ArrayList portNames = new ArrayList(); for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints()) { portNames.add(epMetaData.getPortName()); } return portNames.iterator(); } @Override public URL getWSDLDocumentLocation() { return serviceMetaData.getWsdlLocation(); } @Override public HandlerResolver getHandlerResolver() { return handlerResolver; } @Override public void setHandlerResolver(HandlerResolver handlerResolver) { this.handlerResolver = handlerResolver; } @Override public Executor getExecutor() { if (executor == null) { executor = defaultExecutor; } return executor; } @Override public void setExecutor(Executor executor) { if ((executor instanceof ExecutorService) == false) throw new IllegalArgumentException("Supported executors must implement " + ExecutorService.class.getName()); this.executor = (ExecutorService)executor; } private T createProxy(Class seiClass, EndpointMetaData epMetaData) throws WebServiceException { if (seiClass == null) throw new IllegalArgumentException("SEI class cannot be null"); try { ExecutorService executor = (ExecutorService)getExecutor(); ClientProxy handler = new ClientProxy(executor, new ClientImpl(epMetaData, handlerResolver)); ClassLoader cl = epMetaData.getClassLoader(); T proxy; try { proxy = (T)Proxy.newProxyInstance(cl, new Class[] { seiClass, RMProvider.class, BindingProvider.class, StubExt.class }, handler); } catch (RuntimeException rte) { URL codeLocation = seiClass.getProtectionDomain().getCodeSource().getLocation(); log.error("Cannot create proxy for SEI " + seiClass.getName() + " from: " + codeLocation); throw rte; } // Configure the stub configureStub((StubExt)proxy); return proxy; } catch (WebServiceException ex) { throw ex; } catch (Exception ex) { throw new WebServiceException("Cannot create proxy", ex); } } private void configureStub(StubExt stub) { EndpointMetaData epMetaData = stub.getEndpointMetaData(); String seiName = epMetaData.getServiceEndpointInterfaceName(); QName portName = epMetaData.getPortName(); if (usRef == null) { log.debug("No port configuration for: " + portName); return; } String configFile = usRef.getConfigFile(); String configName = usRef.getConfigName(); UnifiedPortComponentRefMetaData pcref = usRef.getPortComponentRef(seiName, portName); if (pcref != null) { if (pcref.getConfigFile() != null) configFile = pcref.getConfigFile(); if (pcref.getConfigName() != null) configName = pcref.getConfigName(); BindingProvider bp = (BindingProvider)stub; Map reqCtx = bp.getRequestContext(); for (UnifiedStubPropertyMetaData prop : pcref.getStubProperties()) { log.debug("Set stub property: " + prop); reqCtx.put(prop.getPropName(), prop.getPropValue()); } } if (configName != null || configFile != null) { log.debug("Configure Stub: [configName=" + configName + ",configFile=" + configFile + "]"); stub.setConfigName(configName, configFile); } } @Override public Dispatch createDispatch(QName portName, Class type, Mode mode, WebServiceFeature... features) { throw new NotImplementedException(); } @Override public Dispatch createDispatch(EndpointReference endpointReference, Class type, Mode mode, WebServiceFeature... features) { throw new NotImplementedException(); } @Override public Dispatch createDispatch(QName portName, JAXBContext context, Mode mode, WebServiceFeature... features) { throw new NotImplementedException(); } @Override public Dispatch createDispatch(EndpointReference endpointReference, JAXBContext context, Mode mode, WebServiceFeature... features) { throw new NotImplementedException(); } @Override public T getPort(QName portName, Class serviceEndpointInterface, WebServiceFeature... features) { throw new NotImplementedException(); } @Override public T getPort(EndpointReference endpointReference, Class serviceEndpointInterface, WebServiceFeature... features) { throw new NotImplementedException(); } @Override public T getPort(Class serviceEndpointInterface, WebServiceFeature... features) { throw new NotImplementedException(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/0000755000175000017500000000000010755000265027675 5ustar godgod././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/HTTPMessa0000644000175000017500000000753310604700017031373 0ustar godgod/* * 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.core.jaxws.binding; // $Id: HTTPMessageUnMarshaller.java 2755 2007-04-04 10:38:07Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import javax.xml.soap.MimeHeaders; import org.jboss.logging.Logger; import org.jboss.remoting.marshal.UnMarshaller; import org.jboss.remoting.transport.http.HTTPMetadataConstants; import org.jboss.ws.WSException; import org.jboss.ws.core.HTTPMessageImpl; /** * @author Thomas.Diesler@jboss.org * @since 25-Nov-2004 */ public class HTTPMessageUnMarshaller implements UnMarshaller { // Provide logging private static Logger log = Logger.getLogger(HTTPMessageUnMarshaller.class); private static List validResponseCodes = new ArrayList(); static { validResponseCodes.add(HttpServletResponse.SC_OK); validResponseCodes.add(HttpServletResponse.SC_ACCEPTED); validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException { if (log.isTraceEnabled()) { log.trace("Read input stream with metadata=" + metadata); } Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE); String resMessage = (String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE); if (resCode != null && validResponseCodes.contains(resCode) == false) throw new WSException("Invalid HTTP server response [" + resCode + "] - " + resMessage); MimeHeaders mimeHeaders = getMimeHeaders(metadata); HTTPMessageImpl soapMsg = new HTTPMessageImpl(mimeHeaders, inputStream); return soapMsg; } /** * Set the class loader to use for unmarhsalling. This may * be needed when need to have access to class definitions that * are not part of this unmarshaller's parent classloader (especially * when doing remote classloading). * * @param classloader */ public void setClassLoader(ClassLoader classloader) { //NO OP } public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException { return new HTTPMessageUnMarshaller(); } private MimeHeaders getMimeHeaders(Map metadata) { log.debug("getMimeHeaders from: " + metadata); MimeHeaders headers = new MimeHeaders(); Iterator i = metadata.keySet().iterator(); while (i.hasNext()) { String key = (String)i.next(); Object value = metadata.get(key); if (key != null && value instanceof List) { for (Object listValue : (List)value) { headers.addHeader(key, listValue.toString()); } } } return headers; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/HTTPMessa0000644000175000017500000000546510650145103031375 0ustar godgod/* * 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.core.jaxws.binding; import java.io.IOException; import java.io.OutputStream; import org.jboss.logging.Logger; import org.jboss.remoting.InvocationRequest; import org.jboss.remoting.invocation.OnewayInvocation; import org.jboss.remoting.marshal.Marshaller; import org.jboss.ws.core.HTTPMessageImpl; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * @author Thomas.Diesler@jboss.org * @since 25-Nov-2004 */ public class HTTPMessageMarshaller implements Marshaller { // Provide logging private static Logger log = Logger.getLogger(HTTPMessageMarshaller.class); /** * Marshaller will need to take the dataObject and convert * into primitive java data types and write to the * given output. * * @param dataObject Object to be writen to output * @param output The data output to write the object * data to. */ public void write(Object dataObject, OutputStream output) throws IOException { if (dataObject instanceof InvocationRequest) dataObject = ((InvocationRequest)dataObject).getParameter(); if (dataObject instanceof OnewayInvocation) dataObject = ((OnewayInvocation)dataObject).getParameters()[0]; if ((dataObject instanceof HTTPMessageImpl) == false) throw new IllegalArgumentException("Not a HTTPMessage: " + dataObject); HTTPMessageImpl httpMessage = (HTTPMessageImpl)dataObject; Element root = httpMessage.getXmlFragment().toElement(); // debug the outgoing message if (log.isTraceEnabled()) { log.trace("Outgoing Message\n" + DOMWriter.printNode(root, true)); } new DOMWriter(output).print(root); } public Marshaller cloneMarshaller() throws CloneNotSupportedException { return new HTTPMessageMarshaller(); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/MessageBinding.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/MessageBi0000644000175000017500000001433610642000211031450 0ustar godgod/* * 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.core.jaxws.binding; // $Id: MessageBinding.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.ws.handler.Handler; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonBinding; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.EndpointInvocation; import org.jboss.ws.core.HeaderSource; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS; import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.UnboundHeader; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** A binding for unprocessed SOAP Messages * * @author Thomas.Diesler@jboss.org * @since 27-Jun-2006 */ public class MessageBinding implements CommonBinding, BindingExt { // provide logging private static final Logger log = Logger.getLogger(MessageBinding.class); // Delegate to JAXWS binding private BindingImpl delegate = new BindingImpl(); /** On the client side, generate the payload from IN parameters. */ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map unboundHeaders) throws BindingException { throw new NotImplementedException(); } /** On the server side, extract the IN parameters from the payload and populate an Invocation object */ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction reqMessage) throws BindingException { log.debug("unbindRequestMessage: " + opMetaData.getQName()); try { // Construct the endpoint invocation object EndpointInvocation epInv = new EndpointInvocation(opMetaData); SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); ParameterMetaData paramMetaData = opMetaData.getParameters().get(0); QName xmlName = paramMetaData.getXmlName(); epInv.setRequestParamValue(xmlName, reqMessage); return epInv; } catch (Exception e) { handleException(e); return null; } } /** On the server side, generate the payload from OUT parameters. */ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException { log.debug("bindResponseMessage: " + opMetaData.getQName()); try { SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); // Associate current message with message context MessageAbstraction resMessage = (MessageAbstraction)epInv.getReturnValue(); msgContext.setMessageAbstraction(resMessage); return resMessage; } catch (Exception e) { handleException(e); return null; } } /** On the client side, extract the OUT parameters from the payload and return them to the client. */ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map unboundHeaders) throws BindingException { throw new NotImplementedException(); } public MessageAbstraction bindFaultMessage(Exception ex) { SOAPMessageImpl faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null) { msgContext.setSOAPMessage(faultMessage); } else { log.warn("Cannot set fault message in message context"); } return faultMessage; } public List getHandlerChain() { return delegate.getHandlerChain(); } public List getHandlerChain(HandlerType handlerType) { return delegate.getHandlerChain(handlerType); } public void setHandlerChain(List handlerChain) { delegate.setHandlerChain(handlerChain); } public void setHandlerChain(List handlerChain, HandlerType handlerType) { delegate.setHandlerChain(handlerChain, handlerType); } public String getBindingID() { throw new NotImplementedException(); } public void setHeaderSource(HeaderSource source) { // Not needed } private void handleException(Exception ex) throws BindingException { if (ex instanceof RuntimeException) throw (RuntimeException)ex; if (ex instanceof BindingException) throw (BindingException)ex; throw new BindingException(ex); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/BindingProviderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/BindingPr0000644000175000017500000000660110676430372031507 0ustar godgod/* * 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.core.jaxws.binding; // $Id: BindingProviderImpl.java 4630 2007-09-26 10:14:18Z heiko.braun@jboss.com $ import java.util.HashMap; import java.util.Map; import javax.xml.ws.Binding; import javax.xml.ws.BindingProvider; import javax.xml.ws.EndpointReference; import javax.xml.ws.WebServiceException; import javax.xml.ws.wsaddressing.BindingProvider21; import javax.xml.ws.Service.Mode; import javax.xml.ws.http.HTTPBinding; import org.jboss.util.NotImplementedException; import org.jboss.ws.core.CommonBindingProvider; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; /** * The BindingProvider interface provides access to the protocol binding and associated context objects * for request and response message processing. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public class BindingProviderImpl extends CommonBindingProvider implements BindingProvider21 { private Map requestContext = new HashMap(); private Map responseContext = new HashMap(); public BindingProviderImpl(EndpointMetaData epMetaData) { super(epMetaData); } public BindingProviderImpl(String bindingId) { super(bindingId, Type.JAXWS); } @Override protected void initBinding(String bindingId, Type type) { super.initBinding(bindingId, type); if (HTTPBinding.HTTP_BINDING.equals(bindingId) == false) { Mode serviceMode = (epMetaData != null ? epMetaData.getServiceMode() : null); if (serviceMode == Mode.MESSAGE) { binding = new MessageBinding(); } else if (serviceMode == Mode.PAYLOAD) { binding = new PayloadBinding(); } } if (binding == null) throw new WebServiceException("Unsupported binding: " + bindingId); } public Map getRequestContext() { return requestContext; } public Map getResponseContext() { return responseContext; } public Binding getBinding() { return (Binding)binding; } public EndpointReference getEndpointReference() { throw new NotImplementedException(); } public T getEndpointReference(Class clazz) { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/PayloadBinding.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/PayloadBi0000644000175000017500000001704310642000211031453 0ustar godgod/* * 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.core.jaxws.binding; // $Id: PayloadBinding.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPMessage; import javax.xml.transform.Source; import javax.xml.ws.handler.Handler; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonBinding; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.EndpointInvocation; import org.jboss.ws.core.HeaderSource; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS; import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.MessageFactoryImpl; import org.jboss.ws.core.soap.SOAPBodyElementDoc; import org.jboss.ws.core.soap.SOAPBodyImpl; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.UnboundHeader; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** A BindingProvider for a JAXWS payload * * @author Thomas.Diesler@jboss.org * @since 27-Jun-2006 */ public class PayloadBinding implements CommonBinding, BindingExt { // provide logging private static final Logger log = Logger.getLogger(PayloadBinding.class); // Delegate to JAXWS binding private BindingImpl delegate = new BindingImpl(); /** On the client side, generate the payload from IN parameters. */ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map unboundHeaders) throws BindingException { throw new NotImplementedException(); } /** On the server side, extract the IN parameters from the payload and populate an Invocation object */ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction payload) throws BindingException { log.debug("unbindRequestMessage: " + opMetaData.getQName()); try { // Construct the endpoint invocation object EndpointInvocation epInv = new EndpointInvocation(opMetaData); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); ParameterMetaData paramMetaData = opMetaData.getParameters().get(0); QName xmlName = paramMetaData.getXmlName(); SOAPMessage reqMessage = (SOAPMessage)payload; SOAPBodyImpl body = (SOAPBodyImpl)reqMessage.getSOAPBody(); SOAPContentElement bodyElement = (SOAPContentElement)body.getBodyElement(); Source source = bodyElement.getXMLFragment().getSource(); if (source == null) throw new IllegalStateException("Payload cannot be null"); epInv.setRequestParamValue(xmlName, source); return epInv; } catch (Exception e) { handleException(e); return null; } } /** On the server side, generate the payload from OUT parameters. */ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException { log.debug("bindResponseMessage: " + opMetaData.getQName()); try { SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); // Associate current message with message context MessageFactoryImpl factory = new MessageFactoryImpl(); factory.setEnvNamespace(Constants.NS_SOAP11_ENV); SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(); msgContext.setSOAPMessage(resMessage); ParameterMetaData retParameter = opMetaData.getReturnParameter(); QName xmlName = retParameter.getXmlName(); SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody(); SOAPContentElement bodyElement = new SOAPBodyElementDoc(xmlName); bodyElement = (SOAPContentElement)soapBody.addChildElement(bodyElement); Source payload = (Source)epInv.getReturnValue(); bodyElement.setXMLFragment(new XMLFragment(payload)); return resMessage; } catch (Exception e) { handleException(e); return null; } } /** On the client side, extract the OUT parameters from the payload and return them to the client. */ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map unboundHeaders) throws BindingException { throw new NotImplementedException(); } public MessageAbstraction bindFaultMessage(Exception ex) { SOAPMessageImpl faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null) { msgContext.setSOAPMessage(faultMessage); } else { log.warn("Cannot set fault message in message context"); } return faultMessage; } public List getHandlerChain() { return delegate.getHandlerChain(); } public List getHandlerChain(HandlerType handlerType) { return delegate.getHandlerChain(handlerType); } public void setHandlerChain(List handlerChain) { delegate.setHandlerChain(handlerChain); } public void setHandlerChain(List handlerChain, HandlerType handlerType) { delegate.setHandlerChain(handlerChain, handlerType); } private void handleException(Exception ex) throws BindingException { if (ex instanceof RuntimeException) throw (RuntimeException)ex; if (ex instanceof BindingException) throw (BindingException)ex; throw new BindingException(ex); } public String getBindingID() { throw new NotImplementedException(); } public void setHeaderSource(HeaderSource source) { // Not neeeded } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/BindingImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/BindingIm0000644000175000017500000000654710623427336031502 0ustar godgod/* * 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.core.jaxws.binding; // $Id: $ import java.util.ArrayList; import java.util.List; import javax.xml.ws.handler.Handler; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * The Binding interface is the base interface for JAXWS protocol bindings. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public class BindingImpl implements BindingExt { // provide logging private static Logger log = Logger.getLogger(BindingImpl.class); private List preHandlerChain = new ArrayList(); private List jaxwsHandlerChain = new ArrayList(); private List postHandlerChain = new ArrayList(); public List getHandlerChain(HandlerType handlerType) { List handlerChain = new ArrayList(); if (handlerType == HandlerType.PRE || handlerType == HandlerType.ALL) handlerChain.addAll(preHandlerChain); if (handlerType == HandlerType.ENDPOINT || handlerType == HandlerType.ALL) handlerChain.addAll(jaxwsHandlerChain); if (handlerType == HandlerType.POST || handlerType == HandlerType.ALL) handlerChain.addAll(postHandlerChain); return handlerChain; } public void setHandlerChain(List handlerChain, HandlerType handlerType) { if (handlerType == HandlerType.PRE || handlerType == HandlerType.ALL) { preHandlerChain.clear(); preHandlerChain.addAll(handlerChain); } if (handlerType == HandlerType.ENDPOINT || handlerType == HandlerType.ALL) { jaxwsHandlerChain.clear(); jaxwsHandlerChain.addAll(handlerChain); } if (handlerType == HandlerType.POST || handlerType == HandlerType.ALL) { postHandlerChain.clear(); postHandlerChain.addAll(handlerChain); } } public List getHandlerChain() { return new ArrayList(jaxwsHandlerChain); } public void setHandlerChain(List handlerChain) { log.debug("setHandlerChain: " + handlerChain); jaxwsHandlerChain.clear(); jaxwsHandlerChain.addAll(handlerChain); } public String getBindingID() { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/HTTPBindi0000644000175000017500000001316310642000211031333 0ustar godgod/* * 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.core.jaxws.binding; // $Id: HTTPBindingJAXWS.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.ws.handler.Handler; import javax.xml.ws.http.HTTPBinding; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonBinding; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.EndpointInvocation; import org.jboss.ws.core.HTTPMessageImpl; import org.jboss.ws.core.HeaderSource; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.UnboundHeader; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * The HTTPBinding interface is an abstraction for the XML/HTTP binding. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public class HTTPBindingJAXWS implements CommonBinding, BindingExt, HTTPBinding { // provide logging private static final Logger log = Logger.getLogger(HTTPBindingJAXWS.class); private BindingImpl delegate = new BindingImpl(); public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map unboundHeaders) throws BindingException { throw new NotImplementedException(); } public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction reqMessage) throws BindingException { log.debug("unbindRequestMessage: " + opMetaData.getQName()); try { // Construct the endpoint invocation object EndpointInvocation epInv = new EndpointInvocation(opMetaData); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); ParameterMetaData paramMetaData = opMetaData.getParameters().get(0); QName xmlName = paramMetaData.getXmlName(); HTTPMessageImpl httpMessage = (HTTPMessageImpl)reqMessage; Source source = httpMessage.getXmlFragment().getSource(); epInv.setRequestParamValue(xmlName, source); return epInv; } catch (Exception e) { handleException(e); return null; } } public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException { log.debug("bindResponseMessage: " + opMetaData.getQName()); try { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); // Associate current message with message context Source source = (Source)epInv.getReturnValue(); HTTPMessageImpl resMessage = new HTTPMessageImpl(source); msgContext.setMessageAbstraction(resMessage); return resMessage; } catch (Exception e) { handleException(e); return null; } } public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map unboundHeaders) throws BindingException { throw new NotImplementedException(); } public MessageAbstraction bindFaultMessage(Exception ex) { throw new NotImplementedException(); } public List getHandlerChain() { return delegate.getHandlerChain(); } public List getHandlerChain(HandlerType handlerType) { return delegate.getHandlerChain(handlerType); } public void setHandlerChain(List handlerChain) { delegate.setHandlerChain(handlerChain); } public void setHandlerChain(List handlerChain, HandlerType handlerType) { delegate.setHandlerChain(handlerChain, handlerType); } public String getBindingID() { return HTTPBinding.HTTP_BINDING; } public void setHeaderSource(HeaderSource source) { // Not needed } private void handleException(Exception ex) throws BindingException { if (ex instanceof RuntimeException) throw (RuntimeException)ex; if (ex instanceof BindingException) throw (BindingException)ex; throw new BindingException(ex); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/SOAPBindingJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/SOAPBindi0000644000175000017500000000626510577027146031352 0ustar godgod/* * 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.core.jaxws.binding; // $Id: SOAPBindingJAXWS.java 2635 2007-03-17 18:07:34Z thomas.diesler@jboss.com $ import java.util.HashSet; import java.util.Set; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPMessage; import javax.xml.ws.BindingProvider; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * The SOAPBinding interface is an abstraction for the SOAP binding. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ class SOAPBindingJAXWS extends BindingImpl { // provide logging private static Logger log = Logger.getLogger(SOAPBindingJAXWS.class); private Set roles = new HashSet(); public Set getRoles() { return roles; } public void setRoles(Set roles) { this.roles = roles; } public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); MimeHeaders mimeHeaders = reqMessage.getMimeHeaders(); String soapAction = opMetaData.getSOAPAction(); // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field // with a quoted value equal to the value of the soapAction attribute of // soapbind:operation, if present in the corresponding WSDL description. // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field // with a quoted empty string value, if in the corresponding WSDL description, // the soapAction attribute of soapbind:operation is either not present, or // present with an empty string as its value. if (msgContext.get(BindingProvider.SOAPACTION_USE_PROPERTY) != null) log.info("Ignore BindingProvider.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745"); String soapActionProperty = (String)msgContext.get(BindingProvider.SOAPACTION_URI_PROPERTY); if (soapActionProperty != null) soapAction = soapActionProperty; mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : ""); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/BindingExt.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/BindingEx0000644000175000017500000000326010702657335031500 0ustar godgod/* * 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.core.jaxws.binding; //$Id: BindingExt.java 4701 2007-10-09 10:58:37Z thomas.diesler@jboss.com $ import java.util.List; import javax.xml.ws.Binding21; import javax.xml.ws.handler.Handler; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Extension to JAXWS protocol bindings. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public interface BindingExt extends Binding21 { /** Get the handler chain for a given type */ List getHandlerChain(HandlerType handlerType); /** Set the handler chain for a given type */ void setHandlerChain(List handlerChain, HandlerType handlerType); } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/SOAP11Bin0000644000175000017500000000727710623427336031200 0ustar godgod/* * 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.core.jaxws.binding; // $Id: SOAPBindingImpl.java 716 2006-08-09 16:42:10Z thomas.diesler@jboss.com $ import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.soap.SOAPMessage; import javax.xml.ws.handler.Handler; import javax.xml.ws.soap.SOAPBinding; import org.jboss.ws.Constants; import org.jboss.ws.core.CommonSOAP11Binding; import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS; import org.jboss.ws.core.soap.SOAPFaultImpl; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * The JAXWS SOAP11Binding * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public class SOAP11BindingJAXWS extends CommonSOAP11Binding implements BindingExt, SOAPBinding { // Delegate to JAXWS SOAP binding private SOAPBindingJAXWS delegate = new SOAPBindingJAXWS(); public SOAP11BindingJAXWS() { setMTOMEnabled(false); } public SOAP11BindingJAXWS(boolean mtomEnabled) { setMTOMEnabled(mtomEnabled); } public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage) { delegate.setSOAPActionHeader(opMetaData, reqMessage); } public Set getRoles() { // 10.3 Conformance (Default role visibility): An implementation MUST include the required next and ultimate // receiver roles in the Set returned from SOAPBinding.getRoles. // In SOAP 1.1 the ultimate receiver role is identified by omission of the actor attribute from a SOAP header. Set soap11Roles = new HashSet(delegate.getRoles()); soap11Roles.add(Constants.URI_SOAP11_NEXT_ACTOR); return soap11Roles; } public void setRoles(Set roles) { delegate.setRoles(roles); } public List getHandlerChain() { return delegate.getHandlerChain(); } public List getHandlerChain(HandlerType handlerType) { return delegate.getHandlerChain(handlerType); } public void setHandlerChain(List handlerChain) { delegate.setHandlerChain(handlerChain); } public void setHandlerChain(List handlerChain, HandlerType handlerType) { delegate.setHandlerChain(handlerChain, handlerType); } public SOAPMessage createFaultMessageFromException(Exception ex) { return SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex); } protected void throwFaultException(SOAPFaultImpl fault) throws Exception { throw SOAPFaultHelperJAXWS.getSOAPFaultException(fault); } public String getBindingID() { return isMTOMEnabled() ? SOAPBinding.SOAP11HTTP_MTOM_BINDING : SOAPBinding.SOAP11HTTP_BINDING; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/binding/SOAP12Bin0000644000175000017500000001015610623427336031167 0ustar godgod/* * 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.core.jaxws.binding; // $Id: SOAPBindingImpl.java 716 2006-08-09 16:42:10Z thomas.diesler@jboss.com $ import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPMessage; import javax.xml.ws.WebServiceException; import javax.xml.ws.handler.Handler; import javax.xml.ws.soap.SOAPBinding; import org.jboss.ws.core.CommonSOAP12Binding; import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS; import org.jboss.ws.core.soap.SOAPFaultImpl; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * The SOAP11Binding * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public class SOAP12BindingJAXWS extends CommonSOAP12Binding implements BindingExt, SOAPBinding { // Delegate to JAXWS SOAP binding private SOAPBindingJAXWS delegate = new SOAPBindingJAXWS(); public SOAP12BindingJAXWS() { super(); setMTOMEnabled(false); } public SOAP12BindingJAXWS(boolean mtomEnabled) { setMTOMEnabled(mtomEnabled); } public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage) { delegate.setSOAPActionHeader(opMetaData, reqMessage); } public Set getRoles() { // 10.3 Conformance (Default role visibility): An implementation MUST include the required next and ultimate // receiver roles in the Set returned from SOAPBinding.getRoles. Set soap12Roles = new HashSet(delegate.getRoles()); soap12Roles.add(SOAPConstants.URI_SOAP_1_2_ROLE_NEXT); soap12Roles.add(SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER); return soap12Roles; } public void setRoles(Set roles) { // 10.5 Conformance (None role error): An implementation MUST throw WebServiceException if a client // attempts to configure the binding to play the none role via SOAPBinding.setRoles. for (String role : roles) { if (role.equals(SOAPConstants.URI_SOAP_1_2_ROLE_NONE)) throw new WebServiceException("Attempt to configure the binding to play the none role"); } delegate.setRoles(roles); } public List getHandlerChain() { return delegate.getHandlerChain(); } public List getHandlerChain(HandlerType handlerType) { return delegate.getHandlerChain(handlerType); } public void setHandlerChain(List handlerChain) { delegate.setHandlerChain(handlerChain); } public void setHandlerChain(List handlerChain, HandlerType handlerType) { delegate.setHandlerChain(handlerChain, handlerType); } public SOAPMessage createFaultMessageFromException(Exception ex) { return SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex); } protected void throwFaultException(SOAPFaultImpl fault) throws Exception { throw SOAPFaultHelperJAXWS.getSOAPFaultException(fault); } public String getBindingID() { return isMTOMEnabled() ? SOAPBinding.SOAP12HTTP_MTOM_BINDING : SOAPBinding.SOAP12HTTP_BINDING; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/0000755000175000017500000000000010755000265027700 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/MessageCo0000644000175000017500000001124110732534110031464 0ustar godgod/* * 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.core.jaxws.handler; // $Id: MessageContextImpl.java 275 2006-05-04 21:36:29Z jason.greene@jboss.com $ import javax.xml.ws.handler.MessageContext; import javax.xml.soap.AttachmentPart; import javax.xml.soap.SOAPException; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.jaxws.SerializationContextJAXWS; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.xb.binding.NamespaceRegistry; import java.util.Iterator; /** * The interface MessageContext abstracts the message context that is processed by a handler in the handle method. * * The MessageContext interface provides methods to manage a property set. * MessageContext properties enable handlers in a handler chain to share processing related state. * * @author Thomas.Diesler@jboss.org * @since 25-Jul-2006 */ public abstract class MessageContextJAXWS extends CommonMessageContext implements MessageContext { private static Logger log = Logger.getLogger(MessageContextJAXWS.class); public MessageContextJAXWS() { } public MessageContextJAXWS(CommonMessageContext msgContext) { super(msgContext); } /** Create the serialization context */ public SerializationContext createSerializationContext() { EndpointMetaData epMetaData = getEndpointMetaData(); ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData(); SerializationContextJAXWS jaxwsContext = new SerializationContextJAXWS(); jaxwsContext.setTypeMapping(serviceMetaData.getTypeMapping()); return jaxwsContext; } /** Gets the namespace registry for this message context */ public NamespaceRegistry getNamespaceRegistry() { return getSerializationContext().getNamespaceRegistry(); } /** Sets the scope of a property. */ public void setScope(String key, Scope scope) { ScopedProperty prop = scopedProps.get(key); if (prop == null) throw new IllegalArgumentException("Cannot find scoped property: " + key); scopedProps.put(key, new ScopedProperty(key, prop.getValue(), scope)); } /** Gets the scope of a property. */ public Scope getScope(String key) { ScopedProperty prop = scopedProps.get(key); if (prop == null) throw new IllegalArgumentException("Cannot find scoped property: " + key); return prop.getScope(); } public static MessageContextJAXWS processPivot(CommonMessageContext reqContext) { log.debug("Begin response processing"); Boolean outbound = (Boolean)reqContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outbound == null) throw new IllegalStateException("Cannot find property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY); MessageContextAssociation.popMessageContext(); SOAPMessageContextJAXWS resContext = new SOAPMessageContextJAXWS(reqContext); resContext.setSOAPMessage(null); // Reverse the direction resContext.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new Boolean(!outbound)); MessageContextAssociation.pushMessageContext(resContext); cleanupAttachments(reqContext); return resContext; } @Override public void setOperationMetaData(OperationMetaData opMetaData) { super.setOperationMetaData(opMetaData); if (opMetaData != null) this.put(MessageContext.WSDL_OPERATION, opMetaData.getQName()); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/PortInfoImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/PortInfoI0000644000175000017500000000437010620545543031504 0ustar godgod/* * 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.core.jaxws.handler; import javax.xml.namespace.QName; import javax.xml.ws.handler.PortInfo; /** * The PortInfo interface is used by a HandlerResolver to query information about the * port it is being asked to create a handler chain for. * * @author Thomas.Diesler@jboss.com * @since 03-May-2006 */ public class PortInfoImpl implements PortInfo { private QName serviceName; private QName portName; private String bindingID; public PortInfoImpl() { } public PortInfoImpl(QName serviceName, QName portName, String bindingID) { this.serviceName = serviceName; this.portName = portName; this.bindingID = bindingID; } public String getBindingID() { return bindingID; } public QName getPortName() { return portName; } public QName getServiceName() { return serviceName; } public int hashCode() { return toString().hashCode(); } public boolean equals(Object obj) { if (!(obj instanceof PortInfoImpl)) return false; return (obj != null ? toString().equals(obj.toString()) : false); } public String toString() { return "[service=" + serviceName + ",port=" + portName + ",binding=" + bindingID + "]"; } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/HandlerCh0000644000175000017500000002745510650145103031463 0ustar godgod/* * 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.core.jaxws.handler; // $Id:HandlerChainExecutor.java 710 2006-08-08 20:19:52Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.List; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.ws.WebServiceException; import javax.xml.ws.handler.Handler; import javax.xml.ws.handler.LogicalHandler; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.MessageContext.Scope; import javax.xml.ws.handler.soap.SOAPMessageContext; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS; import org.jboss.ws.core.soap.SOAPEnvelopeImpl; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.wsf.common.DOMWriter; /** * Executes a list of JAXWS handlers. * * @author Thomas.Diesler@jboss.org * @since 06-May-2004 */ public class HandlerChainExecutor { private static Logger log = Logger.getLogger(HandlerChainExecutor.class); // The endpoint meta data private EndpointMetaData epMetaData; // The list of handlers protected List handlers = new ArrayList(); // The list of executed handlers protected List executedHandlers = new ArrayList(); // The index of the first handler that returned false during processing protected int falseIndex = -1; // True if the current direction is outbound protected Boolean isOutbound; public HandlerChainExecutor(EndpointMetaData epMetaData, List unsortedChain) { this.epMetaData = epMetaData; // Sort handler logical handlers first List sortedChain = new ArrayList(); for (Handler handler : unsortedChain) { if (handler instanceof LogicalHandler) sortedChain.add(handler); } for (Handler handler : unsortedChain) { if ((handler instanceof LogicalHandler) == false) sortedChain.add(handler); } log.debug("Create a handler executor: " + sortedChain); for (Handler handler : sortedChain) { handlers.add(handler); } } /** * Indicates the end of lifecycle for a HandlerChain. */ public void close(MessageContext msgContext) { log.debug("close"); MessageContextJAXWS context = (MessageContextJAXWS)msgContext; for (int index = 1; index <= executedHandlers.size(); index++) { Handler currHandler = executedHandlers.get(executedHandlers.size() - index); try { context.setCurrentScope(Scope.HANDLER); currHandler.close(msgContext); } finally { context.setCurrentScope(Scope.APPLICATION); } } } public boolean handleMessage(MessageContext msgContext) { isOutbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (isOutbound == null) throw new IllegalStateException("Cannot find property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY); boolean doNext = true; if (handlers.size() > 0) { log.debug("Enter: handle" + (isOutbound ? "Out" : "In ") + "BoundMessage"); int index = getFirstHandler(); Handler currHandler = null; try { String lastMessageTrace = null; while (doNext && index >= 0) { currHandler = handlers.get(index); if (log.isTraceEnabled() && msgContext instanceof SOAPMessageContext) { SOAPPart soapPart = ((SOAPMessageContext)msgContext).getMessage().getSOAPPart(); lastMessageTrace = traceSOAPPart("BEFORE handleRequest - " + currHandler, soapPart, lastMessageTrace); } doNext = handleMessage(currHandler, msgContext); if (log.isTraceEnabled() && msgContext instanceof SOAPMessageContext) { SOAPPart soapPart = ((SOAPMessageContext)msgContext).getMessage().getSOAPPart(); lastMessageTrace = traceSOAPPart("AFTER handleRequest - " + currHandler, soapPart, lastMessageTrace); } if (doNext) index = getNextIndex(index); } } catch (RuntimeException ex) { doNext = false; processHandlerFailure(ex); } finally { // we start at this index in the response chain if (doNext == false) falseIndex = index; log.debug("Exit: handle" + (isOutbound ? "Out" : "In ") + "BoundMessage with status: " + doNext); } } return doNext; } public boolean handleFault(MessageContext msgContext, Exception ex) { isOutbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (isOutbound == null) throw new IllegalStateException("Cannot find property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY); boolean doNext = true; if (handlers.size() > 0) { log.debug("Enter: handle" + (isOutbound ? "Out" : "In ") + "BoundFault"); if (msgContext instanceof SOAPMessageContext) { SOAPMessageContext soapContext = (SOAPMessageContext)msgContext; SOAPMessage soapMessage = soapContext.getMessage(); // If the message is not already a fault message then it is replaced with a fault message try { if (soapMessage == null || soapMessage.getSOAPBody().getFault() == null) { soapMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex); soapContext.setMessage(soapMessage); } } catch (SOAPException se) { throw new WebServiceException("Cannot convert exception to fault message", ex); } } int index = getFirstHandler(); Handler currHandler = null; try { String lastMessageTrace = null; while (doNext && index >= 0) { currHandler = handlers.get(index); if (log.isTraceEnabled() && msgContext instanceof SOAPMessageContext) { SOAPPart soapPart = ((SOAPMessageContext)msgContext).getMessage().getSOAPPart(); lastMessageTrace = traceSOAPPart("BEFORE handleFault - " + currHandler, soapPart, lastMessageTrace); } doNext = handleFault(currHandler, msgContext); if (log.isTraceEnabled() && msgContext instanceof SOAPMessageContext) { SOAPPart soapPart = ((SOAPMessageContext)msgContext).getMessage().getSOAPPart(); lastMessageTrace = traceSOAPPart("AFTER handleFault - " + currHandler, soapPart, lastMessageTrace); } index = getNextIndex(index); } } catch (RuntimeException rte) { doNext = false; processHandlerFailure(rte); } finally { log.debug("Exit: handle" + (isOutbound ? "Out" : "In ") + "BoundFault with status: " + doNext); } } return doNext; } private int getFirstHandler() { int index; if (falseIndex == -1) { index = (isOutbound ? 0 : handlers.size() - 1); } else { index = getNextIndex(falseIndex); } return index; } private int getNextIndex(int prevIndex) { int nextIndex = (isOutbound ? prevIndex + 1 : prevIndex - 1); if (nextIndex >= handlers.size()) nextIndex = -1; return nextIndex; } // 4.14 Conformance (Exceptions During Handler Processing): Exceptions thrown during handler processing on // the client MUST be passed on to the application. If the exception in question is a subclass of WebService- // Exception then an implementation MUST rethrow it as-is, without any additional wrapping, otherwise it // MUST throw a WebServiceException whose cause is set to the exception that was thrown during handler processing. private void processHandlerFailure(Exception ex) { log.error("Exception during handler processing", ex); if (ex instanceof WebServiceException) { throw (WebServiceException)ex; } throw new WebServiceException(ex); } private boolean handleMessage(Handler currHandler, MessageContext msgContext) { CommonMessageContext context = (CommonMessageContext)msgContext; if (currHandler instanceof LogicalHandler) { if (msgContext instanceof SOAPMessageContextJAXWS) msgContext = new LogicalMessageContextImpl((SOAPMessageContextJAXWS)msgContext); } if (executedHandlers.contains(currHandler) == false) executedHandlers.add(currHandler); try { context.put(MessageContextJAXWS.ALLOW_EXPAND_TO_DOM, Boolean.TRUE); context.setCurrentScope(Scope.HANDLER); return currHandler.handleMessage(msgContext); } finally { context.setCurrentScope(Scope.APPLICATION); context.remove(MessageContextJAXWS.ALLOW_EXPAND_TO_DOM); } } private boolean handleFault(Handler currHandler, MessageContext msgContext) { CommonMessageContext context = (CommonMessageContext)msgContext; if (currHandler instanceof LogicalHandler) { if (msgContext instanceof SOAPMessageContextJAXWS) msgContext = new LogicalMessageContextImpl((SOAPMessageContextJAXWS)msgContext); } if (executedHandlers.contains(currHandler) == false) executedHandlers.add(currHandler); try { context.put(MessageContextJAXWS.ALLOW_EXPAND_TO_DOM, Boolean.TRUE); context.setCurrentScope(Scope.HANDLER); return currHandler.handleFault(msgContext); } finally { context.setCurrentScope(Scope.APPLICATION); context.remove(MessageContextJAXWS.ALLOW_EXPAND_TO_DOM); } } /** * Trace the SOAPPart, do nothing if the String representation is equal to the last one. */ protected String traceSOAPPart(String logMsg, SOAPPart soapPart, String lastMessageTrace) { try { SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope(); String envString = DOMWriter.printNode(soapEnv, true); if (envString.equals(lastMessageTrace)) { log.trace(logMsg + ": unchanged"); } else { log.trace(logMsg + "\n" + envString); lastMessageTrace = envString; } return lastMessageTrace; } catch (SOAPException e) { log.error("Cannot get SOAPEnvelope", e); return null; } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/HandlerRe0000644000175000017500000002537710740647062031513 0ustar godgod/* * 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.core.jaxws.handler; // $Id: HandlerResolverImpl.java 5411 2008-01-08 10:19:30Z thomas.diesler@jboss.com $ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.xml.namespace.QName; import javax.xml.ws.handler.Handler; import javax.xml.ws.handler.HandlerResolver; import javax.xml.ws.handler.PortInfo; import javax.xml.ws.handler.soap.SOAPHandler; import javax.xml.ws.http.HTTPBinding; import javax.xml.ws.soap.SOAPBinding; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaData; import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * HandlerResolver is an interface implemented by an application to get control over * the handler chain set on proxy/dispatch objects at the time of their creation. * * A HandlerResolver may be set on a Service using the setHandlerResolver method. * * When the runtime invokes a HandlerResolver, it will pass it a PortInfo object * containing information about the port that the proxy/dispatch object will be accessing. * * @author Thomas.Diesler@jboss.org * @since 08-Aug-2006 */ public class HandlerResolverImpl implements HandlerResolver { private static Logger log = Logger.getLogger(HandlerResolverImpl.class); private static final Map protocolMap = new HashMap(); static { protocolMap.put("##SOAP11_HTTP", SOAPBinding.SOAP11HTTP_BINDING); protocolMap.put("##SOAP11_HTTP_MTOM", SOAPBinding.SOAP11HTTP_MTOM_BINDING); protocolMap.put("##SOAP12_HTTP", SOAPBinding.SOAP12HTTP_BINDING); protocolMap.put("##SOAP12_HTTP_MTOM", SOAPBinding.SOAP12HTTP_MTOM_BINDING); protocolMap.put("##XML_HTTP", HTTPBinding.HTTP_BINDING); } private List preHandlers = new ArrayList(); private List jaxwsHandlers = new ArrayList(); private List postHandlers = new ArrayList(); // understood headers Set headers = new HashSet(); public Set getHeaders() { return headers; } public List getHandlerChain(PortInfo info) { return getHandlerChain(info, HandlerType.ENDPOINT); } public List getHandlerChain(PortInfo info, HandlerType type) { log.debug("getHandlerChain: [type=" + type + ",info=" + info + "]"); List handlers = new ArrayList(); for (ScopedHandler scopedHandler : getHandlerMap(type)) { if (scopedHandler.matches(info)) handlers.add(scopedHandler.handler); } return handlers; } public void initServiceHandlerChain(ServiceMetaData serviceMetaData) { log.debug("initServiceHandlerChain: " + serviceMetaData.getServiceName()); // clear all exisisting handler to avoid double registration List handlerMap = getHandlerMap(HandlerType.ENDPOINT); handlerMap.clear(); ClassLoader classLoader = serviceMetaData.getUnifiedMetaData().getClassLoader(); for (HandlerMetaData handlerMetaData : serviceMetaData.getHandlerMetaData()) addHandler(classLoader, HandlerType.ENDPOINT, handlerMetaData); } public void initHandlerChain(EndpointMetaData epMetaData, HandlerType type, boolean clearExistingHandlers) { log.debug("initHandlerChain: " + type); List handlerMap = getHandlerMap(type); if (clearExistingHandlers) handlerMap.clear(); ClassLoader classLoader = epMetaData.getClassLoader(); for (HandlerMetaData handlerMetaData : epMetaData.getHandlerMetaData(type)) addHandler(classLoader, type, handlerMetaData); } private void addHandler(ClassLoader classLoader, HandlerType type, HandlerMetaData handlerMetaData) { HandlerMetaDataJAXWS jaxwsMetaData = (HandlerMetaDataJAXWS)handlerMetaData; String handlerName = jaxwsMetaData.getHandlerName(); String className = jaxwsMetaData.getHandlerClassName(); Set soapHeaders = jaxwsMetaData.getSoapHeaders(); try { // Load the handler class using the deployments top level CL Class hClass = classLoader.loadClass(className); Handler handler = (Handler)hClass.newInstance(); if (handler instanceof GenericHandler) ((GenericHandler)handler).setHandlerName(handlerName); if (handler instanceof GenericSOAPHandler) ((GenericSOAPHandler)handler).setHeaders(soapHeaders); // Inject resources injectResources(handler); // Call @PostConstruct callPostConstruct(handler); addHandler(jaxwsMetaData, handler, type); } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WSException("Cannot load handler: " + className, ex); } } private void injectResources(Handler handler) { ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); try { ctxLoader.loadClass("javax.annotation.Resource"); } catch (Throwable th) { log.debug("Cannot inject resources: " + th.toString()); return; } Class handlerClass = handler.getClass(); for (Field field : handlerClass.getFields()) { if (field.isAnnotationPresent(Resource.class)) throw new NotImplementedException("@Resource not implemented for handler: " + handlerClass.getName()); } for (Method method : handlerClass.getMethods()) { if (method.isAnnotationPresent(Resource.class)) throw new NotImplementedException("@Resource not implemented for handler: " + handlerClass.getName()); } } private void callPostConstruct(Handler handler) throws Exception { ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); try { ctxLoader.loadClass("javax.annotation.PostConstruct"); } catch (Throwable th) { log.debug("Cannot call post construct: " + th.toString()); return; } Class handlerClass = handler.getClass(); for (Method method : handlerClass.getMethods()) { if (method.isAnnotationPresent(PostConstruct.class)) { method.invoke(handler, new Object[] {}); } } } private boolean addHandler(HandlerMetaDataJAXWS hmd, Handler handler, HandlerType type) { log.debug("addHandler: " + hmd); List handlerMap = getHandlerMap(type); ScopedHandler scopedHandler = new ScopedHandler(handler); scopedHandler.servicePattern = hmd.getServiceNamePattern(); scopedHandler.portPattern = hmd.getPortNamePattern(); scopedHandler.protocols = hmd.getProtocolBindings(); handlerMap.add(scopedHandler); // Ask all initialized handlers for what headers they understand if (handler instanceof SOAPHandler) { Set handlerHeaders = ((SOAPHandler)handler).getHeaders(); if (handlerHeaders != null) headers.addAll(handlerHeaders); } return true; } private List getHandlerMap(HandlerType type) { List handlers = null; if (type == HandlerType.PRE) handlers = preHandlers; else if (type == HandlerType.ENDPOINT) handlers = jaxwsHandlers; else if (type == HandlerType.POST) handlers = postHandlers; else throw new IllegalArgumentException("Illegal handler type: " + type); return handlers; } private class ScopedHandler { Handler handler; QName servicePattern; QName portPattern; String protocols; Set bindings; ScopedHandler(Handler handler) { this.handler = handler; } boolean matches(PortInfo info) { boolean match = true; if (servicePattern != null) { QName serviceName = info.getServiceName(); match = matchQNamePattern(servicePattern, serviceName); } if (match && portPattern != null) { QName portName = info.getPortName(); match = matchQNamePattern(portPattern, portName); } if (match && protocols != null) { boolean bindingMatch = false; String bindingID = info.getBindingID(); for (String protocol : protocols.split("\\s")) { String aux = protocolMap.get(protocol); if (aux != null && aux.equals(bindingID)) { bindingMatch = true; break; } } match = bindingMatch; } return match; } boolean matchQNamePattern(QName pattern, QName qname) { boolean match = true; String nsURI = pattern.getNamespaceURI(); String localPart = pattern.getLocalPart(); if (localPart.equals("*") == false) { if (localPart.endsWith("*")) localPart = localPart.substring(0, localPart.length() - 1); String qnameStr = qname.toString(); String patternStr = new QName(nsURI, localPart).toString(); match = qnameStr.startsWith(patternStr); } return match; } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/LogicalMe0000644000175000017500000001474210654321205031465 0ustar godgod/* * 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.core.jaxws.handler; // $Id: LogicalMessageImpl.java 4081 2007-08-02 09:23:17Z thomas.diesler@jboss.com $ import java.io.IOException; import javax.xml.bind.JAXBContext; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.ws.LogicalMessage; import javax.xml.ws.WebServiceException; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.ws.core.HTTPMessageImpl; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.soap.EnvelopeBuilder; import org.jboss.ws.core.soap.EnvelopeBuilderDOM; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.SOAPBodyImpl; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.spi.util.ServiceLoader; import org.w3c.dom.Element; /** * The LogicalMessageContext interface extends MessageContext to provide access to a the * contained message as a protocol neutral LogicalMessage. * * @author Thomas.Diesler@jboss.org * @since 31-Aug-2006 */ public class LogicalMessageImpl implements LogicalMessage { // provide logging private static final Logger log = Logger.getLogger(LogicalMessageImpl.class); private Style style; private MessageAbstraction message; public LogicalMessageImpl(MessageAbstraction message, Style style) { this.style = style; this.message = message; } public Source getPayload() { Source source = null; if (message instanceof SOAPMessage) { SOAPMessage soapMessage = (SOAPMessage)message; SOAPBodyImpl soapBody = getSOAPBody(soapMessage); SOAPElement bodyElement = (SOAPElement)soapBody.getFirstChild(); if (style == Style.RPC) { source = new DOMSource(bodyElement); } else { SOAPContentElement contentElement = (SOAPContentElement)bodyElement; source = contentElement.getXMLFragment().getSource(); } } else if (message instanceof HTTPMessageImpl) { HTTPMessageImpl httpMessage = (HTTPMessageImpl)message; source = httpMessage.getXmlFragment().getSource(); } return source; } public void setPayload(Source source) { if (message instanceof SOAPMessage) { SOAPMessage soapMessage = (SOAPMessage)message; SOAPBodyImpl soapBody = getSOAPBody(soapMessage); SOAPElement bodyElement = (SOAPElement)soapBody.getFirstChild(); try { if (style == Style.RPC) { try { soapBody.removeContents(); EnvelopeBuilder envBuilder = (EnvelopeBuilder)ServiceLoader.loadService(EnvelopeBuilder.class.getName(), EnvelopeBuilderDOM.class.getName()); envBuilder.setStyle(style); Element domBodyElement = DOMUtils.sourceToElement(source); envBuilder.buildBodyElementRpc(soapBody, domBodyElement); } catch (IOException ex) { WSException.rethrow(ex); } } else { SOAPContentElement contentElement = (SOAPContentElement)bodyElement; contentElement.setXMLFragment(new XMLFragment(source)); } } catch (SOAPException ex) { throw new WebServiceException("Cannot set xml payload", ex); } } else if (message instanceof HTTPMessageImpl) { HTTPMessageImpl httpMessage = (HTTPMessageImpl)message; httpMessage.setXmlFragment(new XMLFragment(source)); } MessageContextAssociation.peekMessageContext().setModified(true); } public Object getPayload(JAXBContext jaxbContext) { Object payload = null; if (message instanceof SOAPMessage) { SOAPMessage soapMessage = (SOAPMessage)message; SOAPBodyImpl soapBody = getSOAPBody(soapMessage); SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild(); if (bodyElement != null) { payload = bodyElement.getObjectValue(); } } else if (message instanceof HTTPMessageImpl) { throw new NotImplementedException(); } return payload; } public void setPayload(Object payload, JAXBContext jaxbContext) { if (message instanceof SOAPMessage) { SOAPMessage soapMessage = (SOAPMessage)message; SOAPBodyImpl soapBody = getSOAPBody(soapMessage); SOAPContentElement bodyElement = (SOAPContentElement)soapBody.getFirstChild(); if (bodyElement != null) { bodyElement.setObjectValue(payload); MessageContextAssociation.peekMessageContext().setModified(true); } } else if (message instanceof HTTPMessageImpl) { throw new NotImplementedException(); } } private SOAPBodyImpl getSOAPBody(SOAPMessage soapMessage) { SOAPBodyImpl soapBody = null; try { soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody(); } catch (SOAPException ex) { WSException.rethrow(ex); } return soapBody; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/SOAPMessageContextJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/SOAPMessa0000644000175000017500000001141510577027146031371 0ustar godgod/* * 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.core.jaxws.handler; // $Id: MessageContextImpl.java 275 2006-05-04 21:36:29Z jason.greene@jboss.com $ import java.net.URI; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.xml.bind.JAXBContext; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPHeaderElement; import javax.xml.soap.SOAPMessage; import javax.xml.ws.WebServiceException; import javax.xml.ws.handler.soap.SOAPMessageContext; import org.jboss.ws.core.CommonMessageContext; /** * The interface SOAPMessageContext provides access to the SOAP message for either RPC request or response. * The javax.xml.soap.SOAPMessage specifies the standard Java API for the representation of a SOAP 1.1 message with attachments. * * @author Thomas.Diesler@jboss.org * @since 25-Jul-2006 */ public class SOAPMessageContextJAXWS extends MessageContextJAXWS implements SOAPMessageContext { // The SOAP actor roles private Set roles = new HashSet(); /** Default ctor */ public SOAPMessageContextJAXWS() { } public SOAPMessageContextJAXWS(CommonMessageContext msgContext) { super(msgContext); } /** * Gets the SOAPMessage from this message context. * Modifications to the returned SOAPMessage change the message in-place, there is no need to susequently call setMessage. */ public SOAPMessage getMessage() { return getSOAPMessage(); } /** * Sets the SOAPMessage in this message context */ public void setMessage(SOAPMessage soapMessage) { setSOAPMessage(soapMessage); } /** * Gets headers that have a particular qualified name from the message in the message context. * Note that a SOAP message can contain multiple headers with the same qualified name. */ public Object[] getHeaders(QName qname, JAXBContext context, boolean allRoles) { List headers = new ArrayList(); if (getSOAPMessage() != null) { try { SOAPHeader soapHeader = getSOAPMessage().getSOAPHeader(); Iterator headerElements = soapHeader.examineAllHeaderElements(); while (headerElements.hasNext()) { SOAPHeaderElement hElement = headerElements.next(); Name hName = hElement.getElementName(); if (qname.equals(new QName(hName.getURI(), hName.getLocalName()))) { URI actor = new URI(hElement.getActor()); if (roles.contains(actor) || allRoles) { headers.add(hElement); // FIXME // SOAPMessageContext.getHeaders should return unmarshalled objects // http://jira.jboss.org/jira/browse/JBWS-1105 } } } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WebServiceException("Cannot get headers", ex); } } Object[] arr = new Object[headers.size()]; headers.toArray(arr); return arr; } /** * Gets the SOAP actor roles associated with an execution of the handler chain. * Note that SOAP actor roles apply to the SOAP node and are managed using SOAPBinding.setRoles and SOAPBinding.getRoles. * Handler instances in the handler chain use this information about the SOAP actor roles to process the SOAP header blocks. * Note that the SOAP actor roles are invariant during the processing of SOAP message through the handler chain. */ public Set getRoles() { return roles; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/GenericLogicalHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/GenericLo0000644000175000017500000000266710650145103031500 0ustar godgod/* * 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.core.jaxws.handler; // $Id: GenericLogicalHandler.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.ws.handler.LogicalHandler; import javax.xml.ws.handler.LogicalMessageContext; /** * A generic jaxws logical handler * * @author Thomas.Diesler@jboss.org * @since 13-Aug-2006 */ public class GenericLogicalHandler extends GenericHandler implements LogicalHandler { } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/HandlerDe0000644000175000017500000001534510623427336031467 0ustar godgod/* * 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.core.jaxws.handler; // $Id:HandlerDelegateJAXWS.java 710 2006-08-08 20:19:52Z thomas.diesler@jboss.com $ import java.util.List; import java.util.Observable; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.ws.handler.Handler; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.PortInfo; import org.jboss.logging.Logger; import org.jboss.ws.core.server.ServerHandlerDelegate; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Delegates to JAXWS handlers * * @author Thomas.Diesler@jboss.org * @since 19-Jan-2005 */ public class HandlerDelegateJAXWS extends ServerHandlerDelegate { // provide logging private static Logger log = Logger.getLogger(HandlerDelegateJAXWS.class); private HandlerResolverImpl resolver = new HandlerResolverImpl(); private ThreadLocal preExecutor = new ThreadLocal(); private ThreadLocal jaxwsExecutor = new ThreadLocal(); private ThreadLocal postExecutor = new ThreadLocal(); public HandlerDelegateJAXWS(ServerEndpointMetaData sepMetaData) { super(sepMetaData); sepMetaData.registerConfigObserver(this); } /** * For JAXWS PRE/POST are defined in the context of an outbound message */ public HandlerType[] getHandlerTypeOrder() { return new HandlerType[] { HandlerType.POST, HandlerType.ENDPOINT, HandlerType.PRE }; } public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { log.debug("callRequestHandlerChain: " + type); // Initialize the handler chain if (isInitialized() == false) { resolver.initHandlerChain(sepMetaData, HandlerType.PRE, true); resolver.initHandlerChain(sepMetaData, HandlerType.ENDPOINT, true); resolver.initHandlerChain(sepMetaData, HandlerType.POST, true); setInitialized(true); } HandlerChainExecutor executor = createExecutor(sepMetaData, type); MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); return executor.handleMessage(msgContext); } public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { log.debug("callResponseHandlerChain: " + type); HandlerChainExecutor executor = getExecutor(type); MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); return (executor != null ? executor.handleMessage(msgContext) : true); } public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { log.debug("closeHandlerChain"); HandlerChainExecutor executor = getExecutor(type); MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); if (executor != null) { executor.close(msgContext); removeExecutor(type); } } public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex) { log.debug("callFaultHandlerChain: " + type); HandlerChainExecutor executor = getExecutor(type); MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); return (executor != null ? executor.handleFault(msgContext, ex) : true); } private List getHandlerChain(EndpointMetaData epMetaData, HandlerType type) { PortInfo info = getPortInfo(epMetaData); return resolver.getHandlerChain(info, type); } private PortInfo getPortInfo(EndpointMetaData epMetaData) { QName serviceName = epMetaData.getServiceMetaData().getServiceName(); QName portName = epMetaData.getPortName(); String bindingId = epMetaData.getBindingId(); PortInfo info = new PortInfoImpl(serviceName, portName, bindingId); return info; } public Set getHeaders() { return resolver.getHeaders(); } private HandlerChainExecutor createExecutor(ServerEndpointMetaData sepMetaData, HandlerType type) { if (type == HandlerType.ALL) throw new IllegalArgumentException("Invalid handler type: " + type); HandlerChainExecutor executor = new HandlerChainExecutor(sepMetaData, getHandlerChain(sepMetaData, type)); if (type == HandlerType.PRE) preExecutor.set(executor); else if (type == HandlerType.ENDPOINT) jaxwsExecutor.set(executor); else if (type == HandlerType.POST) postExecutor.set(executor); return executor; } private HandlerChainExecutor getExecutor(HandlerType type) { if (type == HandlerType.ALL) throw new IllegalArgumentException("Invalid handler type: " + type); HandlerChainExecutor executor = null; if (type == HandlerType.PRE) executor = preExecutor.get(); else if (type == HandlerType.ENDPOINT) executor = jaxwsExecutor.get(); else if (type == HandlerType.POST) executor = postExecutor.get(); return executor; } private void removeExecutor(HandlerType type) { if (type == HandlerType.ALL) throw new IllegalArgumentException("Invalid handler type: " + type); if (type == HandlerType.PRE) preExecutor.remove(); else if (type == HandlerType.ENDPOINT) jaxwsExecutor.remove(); else if (type == HandlerType.POST) postExecutor.remove(); } public void update(Observable observable, Object object) { } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/LogicalMe0000644000175000017500000000727310630511747031474 0ustar godgod/* * 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.core.jaxws.handler; // $Id:LogicalMessageContextImpl.java 888 2006-09-02 00:37:13Z thomas.diesler@jboss.com $ import java.util.Collection; import java.util.Map; import java.util.Set; import javax.xml.ws.LogicalMessage; import javax.xml.ws.handler.LogicalMessageContext; import javax.xml.ws.handler.MessageContext; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.soap.Style; /** * The LogicalMessageContext interface extends MessageContext to provide access to a the * contained message as a protocol neutral LogicalMessage. * * @author Thomas.Diesler@jboss.org * @since 31-Aug-2006 */ public class LogicalMessageContextImpl implements LogicalMessageContext { // The LogicalMessage in this message context private LogicalMessage logicalMessage; private MessageContext delegate; public LogicalMessageContextImpl(MessageContextJAXWS msgContext) { this.delegate = msgContext; Style style = msgContext.getEndpointMetaData().getStyle(); MessageAbstraction message = msgContext.getMessageAbstraction(); logicalMessage = new LogicalMessageImpl(message, style); } /** * Gets the message from this message context * @return The contained message; returns null if no message is present in this message context */ public LogicalMessage getMessage() { return logicalMessage; } // MessageContext delegation public void clear() { delegate.clear(); } public boolean containsKey(Object key) { return delegate.containsKey(key); } public boolean containsValue(Object value) { return delegate.containsValue(value); } public Set> entrySet() { return delegate.entrySet(); } public boolean equals(Object o) { return delegate.equals(o); } public Object get(Object key) { return delegate.get(key); } public Scope getScope(String name) { return delegate.getScope(name); } public int hashCode() { return delegate.hashCode(); } public boolean isEmpty() { return delegate.isEmpty(); } public Set keySet() { return delegate.keySet(); } public Object put(String key, Object value) { return delegate.put(key, value); } public void putAll(Map t) { delegate.putAll(t); } public Object remove(Object key) { return delegate.remove(key); } public void setScope(String name, Scope scope) { delegate.setScope(name, scope); } public int size() { return delegate.size(); } public Collection values() { return delegate.values(); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/GenericHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/GenericHa0000644000175000017500000000456410650145103031454 0ustar godgod/* * 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.core.jaxws.handler; // $Id: GenericHandler.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.ws.handler.Handler; import javax.xml.ws.handler.MessageContext; /** * A generic jaxws handler * * @author Thomas.Diesler@jboss.org * @since 13-Aug-2006 */ public abstract class GenericHandler implements Handler { private String handlerName; public String getHandlerName() { return handlerName; } public void setHandlerName(String handlerName) { this.handlerName = handlerName; } public boolean handleMessage(MessageContext msgContext) { Boolean outbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outbound == null) throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY); return outbound ? handleOutbound(msgContext) : handleInbound(msgContext); } protected boolean handleOutbound(MessageContext msgContext) { return true; } protected boolean handleInbound(MessageContext msgContext) { return true; } public boolean handleFault(MessageContext messagecontext) { return true; } public void close(MessageContext messageContext) { } public String toString() { return (handlerName != null ? handlerName : super.toString()); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/GenericSOAPHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/handler/GenericSO0000644000175000017500000000371610650145103031443 0ustar godgod/* * 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.core.jaxws.handler; // $Id: GenericSOAPHandler.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.util.HashSet; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.ws.handler.LogicalMessageContext; import javax.xml.ws.handler.soap.SOAPHandler; /** * A generic jaxws soap handler * * @author Thomas.Diesler@jboss.org * @since 13-Aug-2006 */ public abstract class GenericSOAPHandler extends GenericHandler implements SOAPHandler { // The header blocks that can be processed by this Handler instance private Set headers = new HashSet(); /** Gets the header blocks that can be processed by this Handler instance. */ public Set getHeaders() { return headers; } /** Sets the header blocks that can be processed by this Handler instance. */ public void setHeaders(Set headers) { this.headers = headers; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBDeserializerF0000644000175000017500000000315010642000211031364 0ustar godgod/* * 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.core.jaxws; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; // $Id: JAXBDeserializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Deserializer that can handle complex types * by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class JAXBDeserializerFactory extends AbstractDeserializerFactory { public DeserializerSupport getDeserializer() throws BindingException { return new JAXBDeserializer(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/SerializationContextJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/SerializationCont0000644000175000017500000000325710644464306031665 0ustar godgod/* * 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.core.jaxws; // $Id: SerializationContextJAXWS.java 3828 2007-07-09 16:56:38Z heiko.braun@jboss.com $ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.umdm.EndpointMetaData; /** * The serialization context for JAXWS endpoints/clients * * @author Thomas.Diesler@jboss.org * @since 03-Jul-2006 */ public class SerializationContextJAXWS extends SerializationContext { public static final String JAXB_CONTEXT_TYPES = "org.jboss.ws.jaxb.context.types"; } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBSerializerFac0000644000175000017500000000313010642000211031355 0ustar godgod/* * 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.core.jaxws; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; // $Id: JAXBSerializerFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** * A factory for a Serializer that can handle complex types * by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class JAXBSerializerFactory extends AbstractSerializerFactory { public SerializerSupport getSerializer() throws BindingException { return new JAXBSerializer(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/0000755000175000017500000000000010755000266027542 5ustar godgod././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/DispatchHT0000644000175000017500000000772710642000211031456 0ustar godgod/* * 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.core.jaxws.client; // $Id: DispatchHTTPBinding.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import org.jboss.logging.Logger; import org.jboss.ws.core.HTTPMessageImpl; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.binding.BufferedStreamResult; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.transform.Source; import javax.xml.ws.Service.Mode; import javax.xml.ws.WebServiceException; /** * The Dispatch interface provides support for the dynamic invocation of a service endpoint operations. * The javax.xml.ws.Service interface acts as a factory for the creation of Dispatch instances. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public class DispatchHTTPBinding extends DispatchBinding { // provide logging private final Logger log = Logger.getLogger(DispatchHTTPBinding.class); private JAXBContext jaxbContext; private Class type; private Mode mode; public DispatchHTTPBinding(Mode mode, Class type, JAXBContext jaxbContext) { this.mode = mode; this.type = type; this.jaxbContext = jaxbContext; } public MessageAbstraction getRequestMessage(Object obj) { HTTPMessageImpl reqMsg = null; try { if (Source.class.isAssignableFrom(type)) { Source source = (Source)obj; reqMsg = new HTTPMessageImpl(source); if(validateDispatch) reqMsg.doValidate(); } else if (jaxbContext != null) { Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); BufferedStreamResult result = new BufferedStreamResult(); marshaller.marshal(obj, result); reqMsg = new HTTPMessageImpl(result); } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WebServiceException("Cannot create request message", ex); } if (reqMsg == null) throw new WebServiceException("Cannot create request message for: " + obj); return reqMsg; } public Object getReturnObject(MessageAbstraction message) { HTTPMessageImpl resMsg = (HTTPMessageImpl)message; Object retObj = null; try { if (Source.class.isAssignableFrom(type)) { retObj = resMsg.getXmlFragment().getSource(); } else if (jaxbContext != null) { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Source source = resMsg.getXmlFragment().getSource(); retObj = unmarshaller.unmarshal(source); } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WebServiceException("Cannot process response message", ex); } return retObj; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ResponseImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ResponseIm0000644000175000017500000000626010577175077031574 0ustar godgod/* * 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.core.jaxws.client; // $Id: ResponseImpl.java 2637 2007-03-18 08:37:19Z thomas.diesler@jboss.com $ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import javax.xml.ws.Response; import javax.xml.ws.WebServiceException; /** * The Response interface provides methods used to obtain the payload and context of a * message sent in response to an operation invocation. * * @author Thomas.Diesler@jboss.com * @since 15-Sep-2006 */ public class ResponseImpl implements Response { private Future delegate; private Object result; private WebServiceException exception; private Map context = new HashMap(); public void setException(WebServiceException ex) { this.exception = ex; } public Future getFuture() { if (delegate == null) throw new IllegalStateException("Future not available"); if (exception != null) throw exception; return delegate; } public void setFuture(Future delegate) { this.delegate = delegate; } public Map getContext() { return context; } void set(Object result) { this.result = result; } public boolean cancel(boolean mayInterruptIfRunning) { return getFuture().cancel(mayInterruptIfRunning); } public Object get() throws InterruptedException, ExecutionException { if (result == null) { getFuture().get(); } if (exception != null) throw new ExecutionException(exception); return result; } public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (result == null) { getFuture().get(timeout, unit); } if (exception != null) throw new ExecutionException(exception); return result; } public boolean isCancelled() { return getFuture().isCancelled(); } public boolean isDone() { return getFuture().isDone(); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ClientImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ClientImpl0000644000175000017500000005375310750144631031542 0ustar godgod/* * 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.core.jaxws.client; // $Id: ClientImpl.java 5551 2008-01-30 19:01:45Z richard.opalka@jboss.com $ import java.net.URI; import java.rmi.RemoteException; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Observable; import java.util.Set; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.ws.Binding; import javax.xml.ws.BindingProvider; import javax.xml.ws.EndpointReference; import javax.xml.ws.WebServiceException; import javax.xml.ws.addressing.AddressingBuilder; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.JAXWSAConstants; import javax.xml.ws.handler.Handler; import javax.xml.ws.handler.HandlerResolver; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.PortInfo; import javax.xml.ws.handler.soap.SOAPHandler; import javax.xml.ws.http.HTTPBinding; import javax.xml.ws.http.HTTPException; import javax.xml.ws.soap.SOAPBinding; import javax.xml.ws.soap.SOAPFaultException; import javax.xml.ws.wsaddressing.BindingProvider21; import org.jboss.logging.Logger; import org.jboss.remoting.transport.http.HTTPMetadataConstants; import org.jboss.util.NotImplementedException; import org.jboss.ws.core.CommonBindingProvider; import org.jboss.ws.core.CommonClient; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.jaxws.binding.BindingExt; import org.jboss.ws.core.jaxws.binding.BindingProviderImpl; import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor; import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl; import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS; import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.extensions.addressing.AddressingClientUtil; import org.jboss.ws.extensions.wsrm.RMAddressingConstants; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.RMClientSequence; import org.jboss.ws.extensions.wsrm.api.RMException; import org.jboss.ws.extensions.wsrm.common.RMHelper; import org.jboss.ws.extensions.wsrm.spi.RMConstants; import org.jboss.ws.extensions.wsrm.spi.RMProvider; import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested; import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement; import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable; import org.jboss.ws.metadata.config.Configurable; import org.jboss.ws.metadata.config.ConfigurationProvider; import org.jboss.ws.metadata.umdm.ClientEndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Provides support for the dynamic invocation of a service endpoint. * * @author Thomas.Diesler@jboss.org * @since 04-Jul-2006 */ public class ClientImpl extends CommonClient implements org.jboss.ws.extensions.wsrm.api.RMProvider, BindingProvider21, Configurable { // provide logging private static Logger log = Logger.getLogger(ClientImpl.class); // the associated endpoint meta data private final ClientEndpointMetaData epMetaData; // Keep a handle on the resolver so that updateConfig calls may revisit the associated chains private final HandlerResolver handlerResolver; private Map executorMap = new HashMap(); private static HandlerType[] HANDLER_TYPES = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST }; // WS-RM sequence associated with the proxy private RMClientSequence wsrmSequence; public final void setWSRMSequence(RMClientSequence wsrmSequence) { this.wsrmSequence = wsrmSequence; } public final RMClientSequence getWSRMSequence() { return this.wsrmSequence; } public ClientImpl(EndpointMetaData epMetaData, HandlerResolver handlerResolver) { super(epMetaData); setTargetEndpointAddress(epMetaData.getEndpointAddress()); this.epMetaData = (ClientEndpointMetaData)epMetaData; this.handlerResolver = handlerResolver; initBindingHandlerChain(false); // The config may change at some later point in time // when applications utilize the ServiceDecorator API // When clients change the config-name, we need reset the handlerchain ((ConfigurationProvider)epMetaData).registerConfigObserver(this); } /** * Reset or create the client handler chain in the binding.
      */ private void initBindingHandlerChain(boolean clearExistingHandlers) { BindingExt binding = (BindingExt)getBindingProvider().getBinding(); PortInfo portInfo = epMetaData.getPortInfo(); if (handlerResolver != null) { boolean jbossHandlerResolver = handlerResolver instanceof HandlerResolverImpl; if (jbossHandlerResolver) // knows about PRE and POST handlers { HandlerResolverImpl impl = (HandlerResolverImpl)handlerResolver; impl.initHandlerChain(epMetaData, HandlerType.PRE, clearExistingHandlers); impl.initHandlerChain(epMetaData, HandlerType.ENDPOINT, clearExistingHandlers); impl.initHandlerChain(epMetaData, HandlerType.POST, clearExistingHandlers); List preChain = impl.getHandlerChain(portInfo, HandlerType.PRE); List postChain = impl.getHandlerChain(portInfo, HandlerType.POST); binding.setHandlerChain(postChain, HandlerType.POST); binding.setHandlerChain(preChain, HandlerType.PRE); } // The regular handler chain List endpointChain = handlerResolver.getHandlerChain(portInfo); binding.setHandlerChain(endpointChain); } } /** * Callback when the config-name or config-file changes. */ public void update(Observable observable, Object object) { log.debug("Configuration change event received. Reconfigure handler chain: " + object); // re-populate the binding handler chain initBindingHandlerChain(true); } @Override protected boolean callRequestHandlerChain(QName portName, HandlerType type) { BindingExt binding = (BindingExt)getBindingProvider().getBinding(); HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, binding.getHandlerChain(type)); executorMap.put(type, executor); MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); return executor.handleMessage(msgContext); } @Override protected boolean callResponseHandlerChain(QName portName, HandlerType type) { MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); HandlerChainExecutor executor = executorMap.get(type); return (executor != null ? executor.handleMessage(msgContext) : true); } @Override protected boolean callFaultHandlerChain(QName portName, HandlerType type, Exception ex) { MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); HandlerChainExecutor executor = executorMap.get(type); return (executor != null ? executor.handleFault(msgContext, ex) : true); } @Override protected void closeHandlerChain(QName portName, HandlerType type) { MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); HandlerChainExecutor executor = executorMap.get(type); if (executor != null) executor.close(msgContext); } @Override protected void setInboundContextProperties() { MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); // Map of attachments to a message for the inbound message, key is the MIME Content-ID, value is a DataHandler msgContext.put(MessageContext.INBOUND_MESSAGE_ATTACHMENTS, new HashMap()); // Remoting meta data are available on successfull call completion if (msgContext.containsKey(CommonMessageContext.REMOTING_METADATA)) { Map remotingMetadata = (Map)msgContext.get(CommonMessageContext.REMOTING_METADATA); // Get the HTTP_RESPONSE_CODE Integer resposeCode = (Integer)remotingMetadata.get(HTTPMetadataConstants.RESPONSE_CODE); if (resposeCode != null) msgContext.put(MessageContextJAXWS.HTTP_RESPONSE_CODE, resposeCode); // [JBREM-728] Improve access to HTTP response headers Map headers = new HashMap(); for (Map.Entry en : remotingMetadata.entrySet()) { if (en.getKey() instanceof String && en.getValue() instanceof List) headers.put((String)en.getKey(), (List)en.getValue()); } msgContext.put(MessageContext.HTTP_RESPONSE_HEADERS, headers); } } @Override protected void setOutboundContextProperties() { // Mark the message context as outbound CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE); // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler msgContext.put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap()); } // Invoked by the proxy invokation handler public Object invoke(QName opName, Object[] args, Map resContext) throws RemoteException { // Associate a message context with the current thread CommonMessageContext msgContext = new SOAPMessageContextJAXWS(); MessageContextAssociation.pushMessageContext(msgContext); // The contents of the request context are used to initialize the message context (see section 9.4.1) // prior to invoking any handlers (see chapter 9) for the outbound message. Each property within the // request context is copied to the message context with a scope of HANDLER. Map reqContext = getBindingProvider().getRequestContext(); if (this.wsrmSequence != null) { if (RMConstant.PROTOCOL_OPERATION_QNAMES.contains(opName) == false) { if (this.wsrmSequence.getBackPort() != null) { // rewrite ReplyTo to use client addressable back port Map requestContext = getBindingProvider().getRequestContext(); AddressingProperties addressingProps = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND); addressingProps.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(this.wsrmSequence.getBackPort())); } Map rmRequestContext = new HashMap(); List outMsgs = new LinkedList(); outMsgs.add(RMProvider.get().getConstants().getSequenceQName()); outMsgs.add(RMProvider.get().getConstants().getAckRequestedQName()); if (wsrmSequence.isAckRequested()) { // piggy backing outMsgs.add(RMProvider.get().getConstants().getSequenceAcknowledgementQName()); } rmRequestContext.put(RMConstant.PROTOCOL_MESSAGES, outMsgs); rmRequestContext.put(RMConstant.SEQUENCE_REFERENCE, wsrmSequence); reqContext.put(RMConstant.REQUEST_CONTEXT, rmRequestContext); } } msgContext.putAll(reqContext); try { Object retObj = invoke(opName, args, false); return retObj; } catch (Exception ex) { OperationMetaData opMetaData = getOperationMetaData(); if (opMetaData.isOneWay()) { handleOneWayException(opMetaData, ex); } else { handleRemoteException(opMetaData, ex); } return null; } finally { msgContext = MessageContextAssociation.peekMessageContext(); if (this.wsrmSequence != null) { if (RMConstant.PROTOCOL_OPERATION_QNAMES.contains(opName) == false) { Map wsrmResCtx = (Map) msgContext.get(RMConstant.RESPONSE_CONTEXT); if (wsrmResCtx != null) { RMConstants wsrmConstants = RMProvider.get().getConstants(); Map mapping = (Map)wsrmResCtx.get(RMConstant.PROTOCOL_MESSAGES_MAPPING); QName seq = wsrmConstants.getSequenceQName(); if (mapping.keySet().contains(seq)) { RMHelper.handleSequenceHeader((RMSequence)mapping.get(seq), this.wsrmSequence); } QName seqAck = wsrmConstants.getSequenceAcknowledgementQName(); if (mapping.keySet().contains(seqAck)) { RMHelper.handleSequenceAcknowledgementHeader((RMSequenceAcknowledgement)mapping.get(seqAck), this.wsrmSequence); } QName ackReq = wsrmConstants.getAckRequestedQName(); if (mapping.keySet().contains(ackReq)) { RMHelper.handleAckRequestedHeader((RMAckRequested)mapping.get(ackReq), this.wsrmSequence); } } } } // Copy the inbound msg properties to the binding's response context for (String key : msgContext.keySet()) { Object value = msgContext.get(key); resContext.put(key, value); } // Reset the message context association MessageContextAssociation.popMessageContext(); } } protected CommonMessageContext processPivot(CommonMessageContext reqMessageContext) { MessageContextJAXWS resMessageContext = MessageContextJAXWS.processPivot(reqMessageContext); return resMessageContext; } /** * 6.7 Conformance (One-way operations): When sending a one-way message, implementations * a WebServiceException if any error is detected when sending the message. */ private void handleOneWayException(OperationMetaData opMetaData, Exception ex) { if (ex instanceof WebServiceException) { throw (WebServiceException)ex; } else { throw new WebServiceException(ex); } } /** * 4.2.4 Conformance (Remote Exceptions): If an error occurs during a remote operation invocation, an implemention * MUST throw a service specific exception if possible. If the error cannot be mapped to a service * specific exception, an implementation MUST throw a ProtocolException or one of its subclasses, as * appropriate for the binding in use. See section 6.4.1 for more details. */ private void handleRemoteException(OperationMetaData opMetaData, Exception ex) { String bindingId = opMetaData.getEndpointMetaData().getBindingId(); if (bindingId.startsWith(SOAPBinding.SOAP11HTTP_BINDING) || bindingId.startsWith(SOAPBinding.SOAP12HTTP_BINDING)) { if (ex instanceof SOAPFaultException) { throw (SOAPFaultException)ex; } else if (ex instanceof WebServiceException) { throw (WebServiceException)ex; } else { throw new WebServiceException(ex); } } else if (HTTPBinding.HTTP_BINDING.equals(bindingId)) { // FIXME: provide actual status code WebServiceException wsEx = new HTTPException(-1); wsEx.initCause(ex); throw wsEx; } else { throw new WebServiceException("Unsuported binding: " + bindingId, ex); } } @Override public void setTargetEndpointAddress(String endpointAddress) { getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress); } @Override public String getTargetEndpointAddress() { return (String)getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY); } @Override protected CommonBindingProvider getCommonBindingProvider() { if (bindingProvider == null) { bindingProvider = new BindingProviderImpl(getEndpointMetaData()); } return bindingProvider; } public Map getRequestContext() { return getBindingProvider().getRequestContext(); } public Map getResponseContext() { return getBindingProvider().getResponseContext(); } public Binding getBinding() { return getBindingProvider().getBinding(); } public BindingProvider getBindingProvider() { return (BindingProvider)getCommonBindingProvider(); } public EndpointReference getEndpointReference() { throw new NotImplementedException(); } public T getEndpointReference(Class clazz) { throw new NotImplementedException(); } public void setConfigName(String configName, String configFile) { ConfigurationProvider configProvider = (ConfigurationProvider)getEndpointMetaData(); configProvider.setConfigName(configName, configFile); } /** * Retrieve header names that can be processed by this binding * @return */ public Set getHeaders() { Set headers = new HashSet(); BindingExt binding = (BindingExt)getBinding(); for (HandlerType type : HANDLER_TYPES) { for (Handler bindingHandler : binding.getHandlerChain(type)) { if (bindingHandler instanceof SOAPHandler) headers.addAll(((SOAPHandler)bindingHandler).getHeaders()); } } return headers; } @Override protected boolean shouldMaintainSession() { Object bool = getRequestContext().get(BindingProvider.SESSION_MAINTAIN_PROPERTY); return Boolean.TRUE.equals(bool); } /////////////////// // WS-RM support // /////////////////// @SuppressWarnings("unchecked") public void createSequence() throws RMException { if (this.wsrmSequence != null) throw new IllegalStateException("Sequence already registered with proxy instance"); try { // set up addressing data RMClientSequence candidateSequence = new RMClientSequence(getEndpointMetaData().getConfig().getRMMetaData()); String address = getEndpointMetaData().getEndpointAddress(); String action = RMAddressingConstants.CREATE_SEQUENCE_WSA_ACTION; AddressingProperties addressingProps = null; URI backPort = candidateSequence.getBackPort(); if (backPort != null) { addressingProps = AddressingClientUtil.createDefaultProps(action, address); addressingProps.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(backPort)); } else { addressingProps = AddressingClientUtil.createAnonymousProps(action, address); } Map requestContext = getBindingProvider().getRequestContext(); requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addressingProps); // set up wsrm request context QName createSequenceQN = RMProvider.get().getConstants().getCreateSequenceQName(); Map rmRequestContext = new HashMap(); List outMsgs = new LinkedList(); outMsgs.add(createSequenceQN); rmRequestContext.put(RMConstant.PROTOCOL_MESSAGES, outMsgs); rmRequestContext.put(RMConstant.SEQUENCE_REFERENCE, candidateSequence); requestContext.put(RMConstant.REQUEST_CONTEXT, rmRequestContext); // invoke stub method invoke(createSequenceQN, new Object[] {}, getBindingProvider().getResponseContext()); // read WSRM sequence id from response context Map rmResponseContext = (Map)getBindingProvider().getResponseContext().get(RMConstant.RESPONSE_CONTEXT); RMCreateSequenceResponse createSequenceResponse = ((RMCreateSequenceResponse)((Map)rmResponseContext.get(RMConstant.PROTOCOL_MESSAGES_MAPPING)).get(RMProvider.get().getConstants().getCreateSequenceResponseQName())); String outboundId = createSequenceResponse.getIdentifier(); candidateSequence.setClient(this); candidateSequence.setOutboundId(outboundId); candidateSequence.setBehavior(createSequenceResponse.getIncompleteSequenceBehavior()); candidateSequence.setDuration(RMHelper.durationToLong(createSequenceResponse.getExpires())); this.wsrmSequence = candidateSequence; } catch (Exception e) { throw new RMException("Unable to create WSRM sequence", e); } } public void closeSequence() { try { this.wsrmSequence.close(); } finally { this.wsrmSequence = null; } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ClientProxy.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ClientProx0000644000175000017500000002505210750313651031560 0ustar godgod/* * 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.core.jaxws.client; // $Id:ClientProxy.java 1054 2006-09-26 10:33:43Z thomas.diesler@jboss.com $ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import javax.xml.namespace.QName; import javax.xml.soap.SOAPException; import javax.xml.ws.AsyncHandler; import javax.xml.ws.BindingProvider; import javax.xml.ws.Response; import javax.xml.ws.WebServiceException; import javax.xml.ws.soap.SOAPFaultException; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.StubExt; import org.jboss.ws.extensions.wsrm.api.RMProvider; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.wsf.common.JavaUtils; /** * The dynamic proxy that delegates to the underlying client implementation * * @author Thomas.Diesler@jboss.org * @since 04-Jul-2006 */ public class ClientProxy implements InvocationHandler { // provide logging private static final Logger log = Logger.getLogger(ClientProxy.class); // The underlying Call private ClientImpl client; // List of the Stub methods private List stubMethods; // List of the Object methods private List objectMethods; // The service configured executor private ExecutorService executor; // The set of standard properties private static final Set standardProperties = new HashSet(); static { standardProperties.add(BindingProvider.ENDPOINT_ADDRESS_PROPERTY); standardProperties.add(BindingProvider.SESSION_MAINTAIN_PROPERTY); standardProperties.add(BindingProvider.USERNAME_PROPERTY); standardProperties.add(BindingProvider.PASSWORD_PROPERTY); standardProperties.add(BindingProvider.SOAPACTION_USE_PROPERTY); standardProperties.add(BindingProvider.SOAPACTION_URI_PROPERTY); } public ClientProxy(ExecutorService executor, ClientImpl client) { this.client = client; this.executor = executor; this.stubMethods = new ArrayList(Arrays.asList(BindingProvider.class.getMethods())); this.stubMethods.addAll(Arrays.asList(StubExt.class.getMethods())); this.stubMethods.addAll(Arrays.asList(RMProvider.class.getMethods())); this.objectMethods = Arrays.asList(Object.class.getMethods()); } /** Processes a method invocation on a proxy instance and returns the result. */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // An invocation on the Stub interface String methodName = method.getName(); if (stubMethods.contains(method)) { Method stubMethod = ClientImpl.class.getMethod(methodName, method.getParameterTypes()); return stubMethod.invoke(client, args); } // An invocation on proxy's Object class else if (objectMethods.contains(method)) { Method objMethod = ClientImpl.class.getMethod(methodName, method.getParameterTypes()); return objMethod.invoke(client, args); } // An invocation on the service endpoint interface else { EndpointMetaData epMetaData = client.getEndpointMetaData(); OperationMetaData opMetaData = epMetaData.getOperation(method); if (opMetaData == null) throw new WSException("Cannot obtain operation meta data for: " + methodName); QName opName = opMetaData.getQName(); if (log.isTraceEnabled()) log.trace("Invoke method: " + method + opMetaData); try { Object retObj; Class retType = method.getReturnType(); boolean isAsync = methodName.endsWith(Constants.ASYNC_METHOD_SUFFIX); // Invoke asynchronously if (isAsync && JavaUtils.isAssignableFrom(Response.class, retType)) { retObj = invokeAsync(opName, args, retType); } // Invoke asynchronously with handler else if (isAsync && JavaUtils.isAssignableFrom(Future.class, retType) && args.length > 1) { Object handler = args[args.length - 1]; retObj = invokeAsync(opName, args, retType, (AsyncHandler)handler); } // Invoke synchronously else { Map resContext = client.getBindingProvider().getResponseContext(); retObj = invoke(opName, args, retType, resContext); } return retObj; } catch (Exception ex) { handleException(ex); return null; } } } private Object invoke(QName opName, Object[] args, Class retType, Map resContext) throws RemoteException { boolean rmDetected = this.client.getEndpointMetaData().getConfig().getRMMetaData() != null; boolean rmActivated = client.getWSRMSequence() != null; if (rmDetected && !rmActivated) { client.createSequence(); } Object retObj = client.invoke(opName, args, resContext); if (retObj != null) { if (retType == null) throw new WSException("Return value not supported by: " + opName); if (JavaUtils.isPrimitive(retType)) retObj = JavaUtils.getPrimitiveValueArray(retObj); } return retObj; } private Response invokeAsync(QName opName, Object[] args, Class retType) { ResponseImpl response = new ResponseImpl(); Runnable task = new AsyncRunnable(response, null, opName, args, retType); if(log.isDebugEnabled()) log.debug("Schedule task " + ((AsyncRunnable)task).getTaskID().toString()); Future future = executor.submit(task); response.setFuture(future); return response; } private Future invokeAsync(QName opName, Object[] args, Class retType, AsyncHandler handler) { ResponseImpl response = new ResponseImpl(); Runnable task = new AsyncRunnable(response, handler, opName, args, retType); Future future = executor.submit(task); response.setFuture(future); return response; } /** * 4.2.4 Conformance (Remote Exceptions): If an error occurs during a remote operation invocation, an implemention * MUST throw a service specific exception if possible. If the error cannot be mapped to a service * specific exception, an implementation MUST throw a ProtocolException or one of its subclasses, as * appropriate for the binding in use. See section 6.4.1 for more details. */ private void handleException(Exception ex) throws Throwable { if (ex instanceof SOAPFaultException) { // Unwrap the cause if it is an Application Exception, otherwise use a protocol exception Throwable cause = ex.getCause(); if (cause instanceof Exception) { // Throw unwrapped WebServiceException if (cause instanceof WebServiceException) throw (WebServiceException)cause; // Throw wrapped SOAPException if (cause instanceof SOAPException) throw (SOAPFaultException)ex; // Throw wrapped RuntimeException if (cause instanceof RuntimeException) throw (SOAPFaultException)ex; // Throw all other causes throw (Exception)cause; } } throw ex; } class AsyncRunnable implements Runnable { private ResponseImpl response; private AsyncHandler handler; private QName opName; private Object[] args; private Class retType; private UUID uuid; public AsyncRunnable(ResponseImpl response, AsyncHandler handler, QName opName, Object[] args, Class retType) { this.response = response; this.handler = handler; this.opName = opName; this.args = args; this.retType = retType; this.uuid = UUID.randomUUID(); } public void run() { try { Map resContext = response.getContext(); Object result = invoke(opName, args, retType, resContext); if(log.isDebugEnabled()) log.debug("Finished task " + getTaskID().toString()+": " + result); response.set(result); // Call the handler if available if (handler != null) handler.handleResponse(response); } catch (Exception ex) { handleAsynInvokeException(ex); } } // 4.18 Conformance (Failed Dispatch.invokeAsync): When an operation is invoked using an invokeAsync // method, an implementation MUST throw a WebServiceException if there is any error in the configuration // of the Dispatch instance. Errors that occur during the invocation are reported when the client // attempts to retrieve the results of the operation. private void handleAsynInvokeException(Exception ex) { String msg = "Cannot dispatch message"; log.error(msg, ex); WebServiceException wsex; if (ex instanceof WebServiceException) { wsex = (WebServiceException)ex; } else { wsex = new WebServiceException(msg, ex); } response.setException(wsex); } public UUID getTaskID() { return uuid; } } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/DispatchBinding.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/DispatchBi0000644000175000017500000000275410606734477031524 0ustar godgod/* * 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.core.jaxws.client; import org.jboss.ws.metadata.config.Configurable; import java.util.Observable; public abstract class DispatchBinding implements Configurable { protected boolean validateDispatch; public boolean isValidateDispatch() { return validateDispatch; } public void setValidateDispatch(boolean validateDispatch) { this.validateDispatch = validateDispatch; } public void update(Observable o, Object arg) { // todo } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/DispatchImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/DispatchIm0000644000175000017500000005312210741424331031513 0ustar godgod/* * 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.core.jaxws.client; // $Id: DispatchImpl.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import javax.xml.bind.JAXBContext; import javax.xml.namespace.QName; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFactory; import javax.xml.soap.SOAPFault; import javax.xml.soap.SOAPMessage; import javax.xml.transform.Source; import javax.xml.ws.AsyncHandler; import javax.xml.ws.Binding; import javax.xml.ws.Binding21; import javax.xml.ws.BindingProvider; import javax.xml.ws.Dispatch; import javax.xml.ws.EndpointReference; import javax.xml.ws.Response; import javax.xml.ws.WebServiceException; import javax.xml.ws.Service.Mode; import javax.xml.ws.handler.Handler; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.PortInfo; import javax.xml.ws.http.HTTPBinding; import javax.xml.ws.soap.SOAPFaultException; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.ConfigProvider; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.client.EndpointInfo; import org.jboss.ws.core.client.HTTPProtocolConnection; import org.jboss.ws.core.client.RemoteConnection; import org.jboss.ws.core.client.SOAPProtocolConnectionHTTP; import org.jboss.ws.core.jaxws.binding.BindingExt; import org.jboss.ws.core.jaxws.binding.BindingProviderImpl; import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor; import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl; import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS; import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.metadata.config.ConfigurationProvider; import org.jboss.ws.metadata.umdm.ClientEndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * The Dispatch interface provides support for the dynamic invocation of a service endpoint operations. * The javax.xml.ws.Service interface acts as a factory for the creation of Dispatch instances. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public class DispatchImpl implements Dispatch, ConfigProvider { // provide logging private final Logger log = Logger.getLogger(DispatchImpl.class); private BindingProvider bindingProvider; private HandlerResolverImpl handlerResolver; private ClientEndpointMetaData epMetaData; private JAXBContext jaxbContext; private ExecutorService executor; private String securityConfig; private Class type; private Mode mode; private Map executorMap = new HashMap(); public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, Class type, Mode mode) { this.bindingProvider = new BindingProviderImpl(epMetaData); this.epMetaData = (ClientEndpointMetaData)epMetaData; this.executor = executor; this.type = type; this.mode = mode; initDispatch(); } public DispatchImpl(ExecutorService executor, EndpointMetaData epMetaData, JAXBContext jbc, Mode mode) { this.bindingProvider = new BindingProviderImpl(epMetaData); this.epMetaData = (ClientEndpointMetaData)epMetaData; this.executor = executor; this.type = Object.class; this.jaxbContext = jbc; this.mode = mode; initDispatch(); } public T invoke(T obj) { T retObj = null; try { retObj = (T)invokeInternal(obj, getResponseContext()); } catch (Exception ex) { handleInvokeException(ex); } return retObj; } private Object invokeInternal(Object obj, Map resContext) throws Exception { Object retObj = null; BindingExt binding = (BindingExt)bindingProvider.getBinding(); String bindingID = binding.getBindingID(); if (bindingID.indexOf("soap") > 0) { // Init the handler chain if (handlerResolver == null) { handlerResolver = new HandlerResolverImpl(); handlerResolver.initHandlerChain(epMetaData, HandlerType.PRE, true); handlerResolver.initHandlerChain(epMetaData, HandlerType.ENDPOINT, true); handlerResolver.initHandlerChain(epMetaData, HandlerType.POST, true); PortInfo portInfo = epMetaData.getPortInfo(); List preChain = handlerResolver.getHandlerChain(portInfo, HandlerType.PRE); List epChain = handlerResolver.getHandlerChain(portInfo, HandlerType.ENDPOINT); List postChain = handlerResolver.getHandlerChain(portInfo, HandlerType.POST); binding.setHandlerChain(preChain, HandlerType.PRE); binding.setHandlerChain(epChain, HandlerType.ENDPOINT); binding.setHandlerChain(postChain, HandlerType.POST); } retObj = invokeInternalSOAP(obj); } else { retObj = invokeInternalNonSOAP(obj); } return retObj; } private Object invokeInternalSOAP(Object obj) throws Exception { Object retObj = null; SOAPMessageImpl reqMsg = (SOAPMessageImpl)getRequestMessage(obj); String targetAddress = epMetaData.getEndpointAddress(); // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field // with a quoted value equal to the value of the soapAction attribute of // soapbind:operation, if present in the corresponding WSDL description. // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field // with a quoted empty string value, if in the corresponding WSDL description, // the soapAction attribute of soapbind:operation is either not present, or // present with an empty string as its value. String soapAction = null; Map reqContext = getRequestContext(); Boolean useSOAPAction = (Boolean)reqContext.get(BindingProvider.SOAPACTION_USE_PROPERTY); if (Boolean.TRUE.equals(useSOAPAction)) { soapAction = (String)reqContext.get(BindingProvider.SOAPACTION_URI_PROPERTY); if (soapAction == null) throw new IllegalStateException("Cannot obtain: " + BindingProvider.SOAPACTION_URI_PROPERTY); } MimeHeaders mimeHeaders = reqMsg.getMimeHeaders(); mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : ""); // Get the order of pre/post handlerchains HandlerType[] handlerType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST }; HandlerType[] faultType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST }; // Associate a message context with the current thread CommonMessageContext msgContext = new SOAPMessageContextJAXWS(); MessageContextAssociation.pushMessageContext(msgContext); msgContext.setEndpointMetaData(epMetaData); msgContext.setSOAPMessage(reqMsg); msgContext.putAll(reqContext); // The contents of the request context are used to initialize the message context (see section 9.4.1) // prior to invoking any handlers (see chapter 9) for the outbound message. Each property within the // request context is copied to the message context with a scope of HANDLER. msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE); QName portName = epMetaData.getPortName(); try { // Call the request handlers boolean handlerPass = callRequestHandlerChain(portName, handlerType[0]); handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[1]); handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[2]); // Handlers might have replaced the message reqMsg = (SOAPMessageImpl)msgContext.getSOAPMessage(); MessageAbstraction resMsg = null; if (handlerPass) { Map callProps = new HashMap(getRequestContext()); EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps); resMsg = getRemotingConnection().invoke(reqMsg, epInfo, false); // Call the response handler chain, removing the fault type entry will not call handleFault for that chain handlerPass = callResponseHandlerChain(portName, handlerType[2]); faultType[2] = null; handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[1]); faultType[1] = null; handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[0]); faultType[0] = null; } if (handlerPass) { retObj = getReturnObject(resMsg); } } catch (Exception ex) { if (faultType[2] != null) callFaultHandlerChain(portName, faultType[2], ex); if (faultType[1] != null) callFaultHandlerChain(portName, faultType[1], ex); if (faultType[0] != null) callFaultHandlerChain(portName, faultType[0], ex); throw ex; } finally { closeHandlerChain(portName, handlerType[2]); closeHandlerChain(portName, handlerType[1]); closeHandlerChain(portName, handlerType[0]); MessageContextAssociation.popMessageContext(); } return retObj; } private Object invokeInternalNonSOAP(Object obj) throws IOException { MessageAbstraction reqMsg = getRequestMessage(obj); String targetAddress = epMetaData.getEndpointAddress(); MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress, false); Object retObj = getReturnObject(resMsg); return retObj; } private RemoteConnection getRemotingConnection() { String bindingID = ((Binding21)bindingProvider.getBinding()).getBindingID(); if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false) throw new IllegalStateException("Unsupported binding: " + bindingID); RemoteConnection remotingConnection; if (HTTPBinding.HTTP_BINDING.equals(bindingID)) { remotingConnection = new HTTPProtocolConnection(); } else { remotingConnection = new SOAPProtocolConnectionHTTP(); } return remotingConnection; } public Response invokeAsync(T msg) { ResponseImpl response = new ResponseImpl(); Runnable task = new AsyncRunnable(response, null, msg); Future future = executor.submit(task); response.setFuture(future); return response; } public Future invokeAsync(T obj, AsyncHandler handler) { ResponseImpl response = new ResponseImpl(); Runnable task = new AsyncRunnable(response, handler, obj); Future future = executor.submit(task); response.setFuture(future); return response; } public void invokeOneWay(T msg) { CommonMessageContext msgContext = new SOAPMessageContextJAXWS(); MessageContextAssociation.pushMessageContext(msgContext); msgContext.setEndpointMetaData(epMetaData); try { MessageAbstraction reqMsg = getRequestMessage(msg); String targetAddress = epMetaData.getEndpointAddress(); getRemotingConnection().invoke(reqMsg, targetAddress, true); } catch (Exception ex) { handleInvokeException(ex); } finally { MessageContextAssociation.popMessageContext(); } } // 4.17. Conformance (Failed Dispatch.invoke): When an operation is invoked using an invoke method, an // implementation MUST throw a WebServiceException if there is any error in the configuration of the // Dispatch instance or a ProtocolException if an error occurs during the remote operation invocation. // // 4.19 Conformance (Failed Dispatch.invokeOneWay): When an operation is invoked using an invoke- // OneWay method, an implementation MUST throw a WebServiceException if there is any error in the // configuration of the Dispatch instance or if an error is detected1 during the remote operation invocation. private void handleInvokeException(Exception ex) { if (ex instanceof WebServiceException) { throw (WebServiceException)ex; } String msg = "Cannot dispatch message"; log.error(msg, ex); throw new WebServiceException(msg, ex); } public Map getRequestContext() { return bindingProvider.getRequestContext(); } public Map getResponseContext() { return bindingProvider.getResponseContext(); } public Binding getBinding() { return bindingProvider.getBinding(); } private void initDispatch() { if (SOAPMessage.class.isAssignableFrom(type) && mode == Mode.MESSAGE) { // accepted } else if (Source.class.isAssignableFrom(type)) { // accepted } else if (jaxbContext != null && mode == Mode.PAYLOAD) { // accepted } else { throw new WebServiceException("Illegal argument combination [type=" + (type != null ? type.getName() : null) + ",mode=" + mode + "]"); } } private MessageAbstraction getRequestMessage(Object obj) { // jaxws/api/javax_xml_ws/Dispatch/Client.java#invokeTestJAXBNull if (obj == null) { try { SOAPFactory factory = SOAPFactory.newInstance(); SOAPFault fault = factory.createFault("Request object cannot be null", new QName("http://org.jboss.ws", "Dispatch")); fault.setFaultActor("client"); throw new SOAPFaultException(fault); } catch (SOAPException e) { // } } String bindingID = ((Binding21)bindingProvider.getBinding()).getBindingID(); if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false) throw new IllegalStateException("Unsupported binding: " + bindingID); MessageAbstraction message; if (HTTPBinding.HTTP_BINDING.equals(bindingID)) { DispatchHTTPBinding helper = new DispatchHTTPBinding(mode, type, jaxbContext); ((ConfigurationProvider)epMetaData).configure(helper); message = helper.getRequestMessage(obj); } else { DispatchSOAPBinding helper = new DispatchSOAPBinding(mode, type, jaxbContext); ((ConfigurationProvider)epMetaData).configure(helper); message = helper.getRequestMessage(obj); } return message; } private Object getReturnObject(MessageAbstraction resMsg) { String bindingID = ((Binding21)bindingProvider.getBinding()).getBindingID(); if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false) throw new IllegalStateException("Unsupported binding: " + bindingID); Object retObj = null; if (HTTPBinding.HTTP_BINDING.equals(bindingID)) { DispatchHTTPBinding helper = new DispatchHTTPBinding(mode, type, jaxbContext); retObj = helper.getReturnObject(resMsg); } else { DispatchSOAPBinding helper = new DispatchSOAPBinding(mode, type, jaxbContext); retObj = helper.getReturnObject(resMsg); } return retObj; } class AsyncRunnable implements Runnable { private ResponseImpl response; private AsyncHandler handler; private Object payload; public AsyncRunnable(ResponseImpl response, AsyncHandler handler, Object payload) { if (response == null) throw new IllegalArgumentException("Async response cannot be null"); if (payload == null) throw new IllegalArgumentException("Async payload cannot be null"); this.response = response; this.handler = handler; this.payload = payload; } public void run() { try { Map resContext = response.getContext(); Object result = invokeInternal(payload, resContext); response.set(result); } catch (Exception ex) { handleAsynInvokeException(ex); } finally { // Call the handler if available if (handler != null) handler.handleResponse(response); } } // 4.18 Conformance (Failed Dispatch.invokeAsync): When an operation is invoked using an invokeAsync // method, an implementation MUST throw a WebServiceException if there is any error in the configuration // of the Dispatch instance. Errors that occur during the invocation are reported when the client // attempts to retrieve the results of the operation. private void handleAsynInvokeException(Exception ex) { String msg = "Cannot dispatch message"; log.error(msg, ex); WebServiceException wsex; if (ex instanceof WebServiceException) { wsex = (WebServiceException)ex; } else { wsex = new WebServiceException(msg, ex); } response.setException(wsex); } } public EndpointReference getEndpointReference() { throw new NotImplementedException(); } public T getEndpointReference(Class clazz) { throw new NotImplementedException(); } public String getConfigFile() { return epMetaData.getConfigFile(); } public String getConfigName() { return epMetaData.getConfigName(); } public void setConfigName(String configName) { epMetaData.setConfigName(configName); } public void setConfigName(String configName, String configFile) { epMetaData.setConfigName(configName, configFile); } public String getSecurityConfig() { return securityConfig; } public void setSecurityConfig(String securityConfig) { this.securityConfig = securityConfig; if (securityConfig != null) { ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData(); if (serviceMetaData.getSecurityConfiguration() == null) { try { WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance(); UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile(); WSSecurityConfiguration config = wsseConfFactory.createConfiguration(vfsRoot, securityConfig); serviceMetaData.setSecurityConfiguration(config); } catch (IOException ex) { WSException.rethrow("Cannot set security config", ex); } } } } private boolean callRequestHandlerChain(QName portName, HandlerType type) { BindingExt binding = (BindingExt)bindingProvider.getBinding(); HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, binding.getHandlerChain(type)); executorMap.put(type, executor); MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); return executor.handleMessage(msgContext); } private boolean callResponseHandlerChain(QName portName, HandlerType type) { MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); HandlerChainExecutor executor = executorMap.get(type); return (executor != null ? executor.handleMessage(msgContext) : true); } private boolean callFaultHandlerChain(QName portName, HandlerType type, Exception ex) { MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); HandlerChainExecutor executor = executorMap.get(type); return (executor != null ? executor.handleFault(msgContext, ex) : true); } private void closeHandlerChain(QName portName, HandlerType type) { MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext(); HandlerChainExecutor executor = executorMap.get(type); if (executor != null) executor.close(msgContext); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/NameValuePair.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/NameValueP0000644000175000017500000000363310554132747031476 0ustar godgod/* * 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.core.jaxws.client; //$Id: NameValuePair.java 2009 2007-01-19 12:13:27Z thomas.diesler@jboss.com $ import java.io.Serializable; /** * Represents a name value pair * * @author Thomas.Diesler@jboss.com */ public class NameValuePair implements Serializable { private static final long serialVersionUID = -7833097600256899477L; private String name; private String value; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String toString() { StringBuffer sb = new StringBuffer(100); sb.append('['); sb.append("name=").append(name); sb.append(",value=").append(value); sb.append(']'); return sb.toString(); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ServiceReferenceable.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ServiceRef0000644000175000017500000000702310623427336031531 0ustar godgod/* * 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. */ // $Id: ServiceReferenceable.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ package org.jboss.ws.core.jaxws.client; // $Id: ServiceReferenceable.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import javax.naming.BinaryRefAddr; import javax.naming.NamingException; import javax.naming.Reference; import javax.naming.Referenceable; import javax.naming.StringRefAddr; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; /** * A JNDI reference to a javax.xml.ws.Service * * It holds the information to reconstrut the javax.xml.ws.Service * when the client does a JNDI lookup. * * @author Thomas.Diesler@jboss.org * @since 24-Oct-2006 */ public class ServiceReferenceable implements Referenceable { public static final String SERVICE_REF_META_DATA = "SERVICE_REF_META_DATA"; public static final String SERVICE_IMPL_CLASS = "SERVICE_CLASS_NAME"; public static final String TARGET_CLASS_NAME = "TARGET_CLASS_NAME"; private String serviceImplClass; private String targetClassName; private UnifiedServiceRefMetaData serviceRef; public ServiceReferenceable(String serviceImplClass, String targetClassName, UnifiedServiceRefMetaData serviceRef) { this.serviceImplClass = serviceImplClass; this.targetClassName = targetClassName; this.serviceRef = serviceRef; } /** * Retrieves the Reference of this object. * * @return The non-null Reference of this object. * @throws javax.naming.NamingException If a naming exception was encountered while retrieving the reference. */ public Reference getReference() throws NamingException { Reference myRef = new Reference(ServiceReferenceable.class.getName(), ServiceObjectFactoryJAXWS.class.getName(), null); myRef.add(new StringRefAddr(SERVICE_IMPL_CLASS, serviceImplClass)); myRef.add(new StringRefAddr(TARGET_CLASS_NAME, targetClassName)); myRef.add(new BinaryRefAddr(SERVICE_REF_META_DATA, marshall(serviceRef))); return myRef; } private byte[] marshall(Object obj) throws NamingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(512); try { ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(obj); oos.close(); } catch (IOException e) { throw new NamingException("Cannot marshall object, cause: " + e.toString()); } return baos.toByteArray(); } }././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/NativeServiceRefBinderJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/NativeServ0000644000175000017500000001725310654112427031564 0ustar godgod/* * 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.core.jaxws.client; // $Id: NativeServiceRefBinderJAXWS.java 4053 2007-08-01 14:13:43Z thomas.diesler@jboss.com $ import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; import javax.jws.HandlerChain; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.Referenceable; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceRef; import javax.xml.ws.WebServiceRefs; import org.jboss.logging.Logger; import org.jboss.util.naming.Util; import org.jboss.wsf.spi.WSFException; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import org.jboss.wsf.spi.serviceref.ServiceRefBinder; /** * Binds a JAXWS Service object in the client's ENC * * @author Thomas.Diesler@jboss.org * @since 17-Jan-2007 */ public class NativeServiceRefBinderJAXWS implements ServiceRefBinder { // logging support private static Logger log = Logger.getLogger(NativeServiceRefBinderJAXWS.class); public void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader) throws NamingException { WebServiceRef wsref = null; if (null == loader) throw new IllegalArgumentException("There needs to be a classloader available"); // Build the list of @WebServiceRef relevant annotations List wsrefList = new ArrayList(); if (anElement != null) { for (Annotation an : anElement.getAnnotations()) { if (an instanceof WebServiceRef) wsrefList.add((WebServiceRef)an); if (an instanceof WebServiceRefs) { WebServiceRefs wsrefs = (WebServiceRefs)an; for (WebServiceRef aux : wsrefs.value()) wsrefList.add(aux); } } } // Use the single @WebServiceRef if (wsrefList.size() == 1) { wsref = wsrefList.get(0); } else { for (WebServiceRef aux : wsrefList) { if (encName.endsWith("/" + aux.name())) { wsref = aux; break; } } } Class targetClass = null; if (anElement instanceof Field) { targetClass = ((Field)anElement).getType(); } else if (anElement instanceof Method) { targetClass = ((Method)anElement).getParameterTypes()[0]; } else { if (wsref != null && (wsref.type() != Object.class)) targetClass = wsref.type(); } String targetClassName = (targetClass != null ? targetClass.getName() : null); String externalName = encCtx.getNameInNamespace() + "/" + encName; log.debug("setupServiceRef [jndi=" + externalName + ",target=" + targetClassName + "]"); String serviceImplClass = null; // #1 Use the explicit @WebServiceRef.value if (wsref != null && wsref.value() != Object.class) serviceImplClass = wsref.value().getName(); // #2 Use the target ref type if (serviceImplClass == null && targetClass != null && Service.class.isAssignableFrom(targetClass)) serviceImplClass = targetClass.getName(); // #3 Use if (serviceImplClass == null && serviceRef.getServiceInterface() != null) serviceImplClass = serviceRef.getServiceInterface(); // #4 Use javax.xml.ws.Service if (serviceImplClass == null) serviceImplClass = Service.class.getName(); // #1 Use the explicit @WebServiceRef.type if (wsref != null && wsref.type() != Object.class) targetClassName = wsref.type().getName(); // #2 Use the target ref type if (targetClassName == null && targetClass != null && Service.class.isAssignableFrom(targetClass) == false) targetClassName = targetClass.getName(); // Set the wsdlLocation if there is no override already if (serviceRef.getWsdlOverride() == null && wsref != null && wsref.wsdlLocation().length() > 0) serviceRef.setWsdlOverride(wsref.wsdlLocation()); // Set the handlerChain from @HandlerChain on the annotated element String handlerChain = serviceRef.getHandlerChain(); if (anElement != null) { HandlerChain anHandlerChain = anElement.getAnnotation(HandlerChain.class); if (handlerChain == null && anHandlerChain != null && anHandlerChain.file().length() > 0) handlerChain = anHandlerChain.file(); } // Resolve path to handler chain if (handlerChain != null) { try { new URL(handlerChain); } catch (MalformedURLException ex) { Class declaringClass = null; if (anElement instanceof Field) declaringClass = ((Field)anElement).getDeclaringClass(); else if (anElement instanceof Method) declaringClass = ((Method)anElement).getDeclaringClass(); else if (anElement instanceof Class) declaringClass = (Class)anElement; handlerChain = declaringClass.getPackage().getName().replace('.', '/') + "/" + handlerChain; } serviceRef.setHandlerChain(handlerChain); } // Extract service QName for target service if (null == serviceRef.getServiceQName()) { try { Class serviceClass = loader.loadClass(serviceImplClass); if (serviceClass.getAnnotation(WebServiceClient.class) != null) { WebServiceClient clientDecl = (WebServiceClient)serviceClass.getAnnotation(WebServiceClient.class); serviceRef.setServiceQName(new QName(clientDecl.targetNamespace(), clientDecl.name())); } } catch (ClassNotFoundException e) { WSFException.rethrow("Cannot extract service QName for target service", e); } } // Do not use rebind, the binding should be unique // [JBWS-1499] - Revisit WebServiceRefHandler JNDI rebind Referenceable serviceReferenceable = buildServiceReferenceable(serviceImplClass, targetClassName, serviceRef); Util.bind(encCtx, encName, serviceReferenceable); } protected Referenceable buildServiceReferenceable(String serviceImplClass, String targetClassName, UnifiedServiceRefMetaData serviceRef) { return new ServiceReferenceable(serviceImplClass, targetClassName, serviceRef); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ServiceObjectFactoryJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/ServiceObj0000644000175000017500000002244110743360125031523 0ustar godgod/* * 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. */ // $Id: ServiceObjectFactoryJAXWS.java 5476 2008-01-16 10:45:41Z heiko.braun@jboss.com $ package org.jboss.ws.core.jaxws.client; // $Id: ServiceObjectFactoryJAXWS.java 5476 2008-01-16 10:45:41Z heiko.braun@jboss.com $ import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.ConfigProvider; import org.jboss.ws.core.client.ServiceObjectFactory; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; import javax.naming.*; import javax.xml.namespace.QName; import javax.xml.ws.Service; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.util.Hashtable; /** * This ServiceObjectFactory reconstructs a javax.xml.ws.Service * for a given WSDL when the webservice client does a JNDI lookup * * @author Thomas.Diesler@jboss.org * @since 24-Oct-2004 */ public class ServiceObjectFactoryJAXWS extends ServiceObjectFactory { // provide logging private static final Logger log = Logger.getLogger(ServiceObjectFactoryJAXWS.class); // The ServiceRefMetaData association private static ThreadLocal serviceRefAssociation = new ThreadLocal(); /** * Creates an object using the location or reference information specified. *

      * * @param obj The possibly null object containing location or reference * information that can be used in creating an object. * @param name The name of this object relative to nameCtx, * or null if no name is specified. * @param nameCtx The context relative to which the name * parameter is specified, or null if name is * relative to the default initial context. * @param environment The possibly null environment that is used in * creating the object. * @return The object created; null if an object cannot be created. * @throws Exception if this object factory encountered an exception * while attempting to create an object, and no other object factories are * to be tried. * @see javax.naming.spi.NamingManager#getObjectInstance * @see javax.naming.spi.NamingManager#getURLContext */ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { try { Reference ref = (Reference)obj; // Get the target class name String targetClassName = (String)ref.get(ServiceReferenceable.TARGET_CLASS_NAME).getContent(); // Unmarshall the UnifiedServiceRef UnifiedServiceRefMetaData serviceRef = unmarshallServiceRef(ref); String serviceRefName = serviceRef.getServiceRefName(); QName serviceQName = serviceRef.getServiceQName(); String serviceImplClass = serviceRef.getServiceImplClass(); if (serviceImplClass == null) serviceImplClass = (String)ref.get(ServiceReferenceable.SERVICE_IMPL_CLASS).getContent(); // If the target defaults to javax.xml.ws.Service, use the service as the target if (Service.class.getName().equals(targetClassName)) targetClassName = serviceImplClass; log.debug("[name=" + serviceRefName + ",service=" + serviceImplClass + ",target=" + targetClassName + "]"); // Load the service class ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); Class serviceClass = ctxLoader.loadClass(serviceImplClass); Class targetClass = (targetClassName != null ? ctxLoader.loadClass(targetClassName) : null); if (Service.class.isAssignableFrom(serviceClass) == false) throw new IllegalArgumentException("WebServiceRef type '" + serviceClass + "' is not assignable to javax.xml.ws.Service"); log.debug("Loaded Service '" + serviceClass.getName() + "' from: " + serviceClass.getProtectionDomain().getCodeSource()); // Receives either a javax.xml.ws.Service or a dynamic proxy Object target; // Get the URL to the wsdl URL wsdlURL = serviceRef.getWsdlLocation(); try { // Associate the ServiceRefMetaData with this thread serviceRefAssociation.set(serviceRef); // Generic javax.xml.ws.Service if (serviceClass == Service.class) { if (wsdlURL != null) { target = Service.create(wsdlURL, serviceQName); } else { throw new IllegalArgumentException("Cannot create generic javax.xml.ws.Service without wsdlLocation: " + serviceRefName); } } // Generated javax.xml.ws.Service subclass else { if (wsdlURL != null) { Constructor ctor = serviceClass.getConstructor(new Class[] { URL.class, QName.class }); target = ctor.newInstance(new Object[] { wsdlURL, serviceQName }); } else { target = (Service)serviceClass.newInstance(); } } } finally { serviceRefAssociation.set(null); } // Configure the service configureService((Service)target, serviceRef); if (targetClassName != null && targetClassName.equals(serviceImplClass) == false) { try { Object port = null; if (serviceClass != Service.class) { for (Method method : serviceClass.getDeclaredMethods()) { String methodName = method.getName(); Class retType = method.getReturnType(); if (methodName.startsWith("get") && targetClass.isAssignableFrom(retType)) { port = method.invoke(target, new Object[0]); target = port; break; } } } if (port == null) { Method method = serviceClass.getMethod("getPort", new Class[] { Class.class }); port = method.invoke(target, new Object[] { targetClass }); target = port; } } catch (InvocationTargetException ex) { throw ex.getTargetException(); } } return target; } catch (Throwable ex) { WSException.rethrow("Cannot create service", ex); return null; } } public static UnifiedServiceRefMetaData getServiceRefAssociation() { // The ServiceDelegateImpl get the usRef at ctor time return (UnifiedServiceRefMetaData)serviceRefAssociation.get(); } private void configureService(Service service, UnifiedServiceRefMetaData serviceRef) { String configFile = serviceRef.getConfigFile(); String configName = serviceRef.getConfigName(); if (service instanceof ConfigProvider) { if(log.isDebugEnabled()) log.debug("Configure Service: [configName=" + configName + ",configFile=" + configFile + "]"); ConfigProvider cp = (ConfigProvider)service; if (configName != null || configFile != null) cp.setConfigName(configName, configFile); } } private UnifiedServiceRefMetaData unmarshallServiceRef(Reference ref) throws ClassNotFoundException, NamingException { UnifiedServiceRefMetaData sref; RefAddr refAddr = ref.get(ServiceReferenceable.SERVICE_REF_META_DATA); ByteArrayInputStream bais = new ByteArrayInputStream((byte[])refAddr.getContent()); try { ObjectInputStream ois = new ObjectInputStream(bais); sref = (UnifiedServiceRefMetaData)ois.readObject(); ois.close(); } catch (IOException e) { throw new NamingException("Cannot unmarshall service ref meta data, cause: " + e.toString()); } return sref; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/client/DispatchSO0000644000175000017500000001576110650145103031472 0ustar godgod/* * 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.core.jaxws.client; // $Id: DispatchSOAPBinding.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.StringReader; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPFault; import javax.xml.soap.SOAPMessage; import javax.xml.transform.Source; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import javax.xml.ws.WebServiceException; import javax.xml.ws.Service.Mode; import javax.xml.ws.soap.SOAPFaultException; import org.jboss.logging.Logger; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.soap.SOAPBodyElementDoc; import org.jboss.ws.core.soap.SOAPBodyImpl; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.wsf.common.DOMWriter; /** * A helper that * * @author Thomas.Diesler@jboss.com * @since 02-Apr-2007 */ public class DispatchSOAPBinding extends DispatchBinding { // provide logging private final Logger log = Logger.getLogger(DispatchSOAPBinding.class); private JAXBContext jaxbContext; private Class type; private Mode mode; public DispatchSOAPBinding(Mode mode, Class type, JAXBContext jaxbContext) { this.mode = mode; this.type = type; this.jaxbContext = jaxbContext; } public MessageAbstraction getRequestMessage(Object obj) { SOAPMessageImpl reqMsg = null; try { MessageFactory factory = MessageFactory.newInstance(); if (SOAPMessage.class.isAssignableFrom(type)) { reqMsg = (SOAPMessageImpl)obj; } else if (Source.class.isAssignableFrom(type)) { Source source = (Source)obj; if (mode == Mode.PAYLOAD) { reqMsg = (SOAPMessageImpl)factory.createMessage(); SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody(); SOAPContentElement bodyElement = new SOAPBodyElementDoc(SOAPBodyElementDoc.GENERIC_PARAM_NAME); bodyElement = (SOAPContentElement)soapBody.addChildElement(bodyElement); XMLFragment xmlFragment = new XMLFragment(source); bodyElement.setXMLFragment(xmlFragment); // validate payload if necessary if (validateDispatch) { // expand to DOM will validate the contents xmlFragment.toElement(); } } if (mode == Mode.MESSAGE) { TransformerFactory tf = TransformerFactory.newInstance(); ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); tf.newTransformer().transform(source, new StreamResult(baos)); reqMsg = (SOAPMessageImpl)factory.createMessage(null, new ByteArrayInputStream(baos.toByteArray())); } } else if (jaxbContext != null) { Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); marshaller.marshal(obj, baos); reqMsg = (SOAPMessageImpl)factory.createMessage(); SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody(); SOAPContentElement bodyElement = new SOAPBodyElementDoc(SOAPBodyElementDoc.GENERIC_PARAM_NAME); bodyElement = (SOAPContentElement)soapBody.addChildElement(bodyElement); StreamSource source = new StreamSource(new ByteArrayInputStream(baos.toByteArray())); bodyElement.setXMLFragment(new XMLFragment(source)); } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WebServiceException("Cannot create request message", ex); } if (reqMsg == null) throw new WebServiceException("Cannot create request message for: " + obj); return reqMsg; } public Object getReturnObject(MessageAbstraction message) { SOAPMessage resMsg = (SOAPMessage)message; Object retObj = null; try { if (SOAPMessage.class.isAssignableFrom(type)) { retObj = resMsg; } else if (Source.class.isAssignableFrom(type)) { if (mode == Mode.PAYLOAD) { SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody(); SOAPFault soapFault = soapBody.getFault(); if (soapFault != null) throw new SOAPFaultException(soapFault); SOAPElement soapElement = soapBody.getBodyElement(); retObj = new DOMSource(soapElement); } if (mode == Mode.MESSAGE) { SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope(); String xmlMessage = DOMWriter.printNode(soapEnvelope, false); retObj = new StreamSource(new StringReader(xmlMessage)); } } else if (jaxbContext != null) { SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody(); SOAPElement soapElement = soapBody.getBodyElement(); log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false)); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); retObj = unmarshaller.unmarshal(soapElement); } } catch (RuntimeException rte) { throw rte; } catch (Exception ex) { throw new WebServiceException("Cannot process response message", ex); } return retObj; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/CustomizableJAXBC0000644000175000017500000001021210703163317031414 0ustar godgod/* * 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.core.jaxws; import com.sun.xml.bind.api.JAXBRIContext; import com.sun.xml.bind.api.TypeReference; import com.sun.xml.bind.v2.model.annotation.RuntimeAnnotationReader; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.wsf.spi.binding.BindingCustomization; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.invocation.EndpointAssociation; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import java.util.Collection; /** * The default factory checks if a {@link JAXBBindingCustomization} exists * and uses it to customize the JAXBContext that will be created. *

      * It uses the {@link org.jboss.wsf.spi.invocation.EndpointAssociation} to access customizations * if they are not passed explicitly. * * @see org.jboss.wsf.spi.deployment.Endpoint * @see org.jboss.wsf.spi.binding.BindingCustomization * @see JAXBBindingCustomization * * @see JAXBContext#newInstance(Class...) * @see JAXBContext#newInstance(String, ClassLoader, java.util.Map) * * @author Heiko.Braun@jboss.com * Created: Jun 26, 2007 */ public class CustomizableJAXBContextFactory extends JAXBContextFactory { protected Logger log = Logger.getLogger(CustomizableJAXBContextFactory.class); public JAXBContext createContext(Class clazz) throws WSException { return createContext(new Class[] {clazz}); } public JAXBContext createContext(Class[] clazzes) throws WSException { try { BindingCustomization customization = getCustomization(); JAXBContext jaxbCtx; if(null == customization) jaxbCtx = JAXBContext.newInstance(clazzes); else jaxbCtx = createContext(clazzes, customization); return jaxbCtx; } catch (JAXBException e) { throw new WSException("Failed to create JAXBContext", e); } } public JAXBContext createContext(Class[] clazzes, BindingCustomization bindingCustomization) throws WSException { try { return JAXBContext.newInstance(clazzes, bindingCustomization); } catch (JAXBException e) { throw new WSException("Failed to create JAXBContext", e); } } public JAXBRIContext createContext( Class[] classes, Collection typeReferences, String defaultNamespaceRemap, boolean c14nSupport, BindingCustomization bindingCustomization) { try { RuntimeAnnotationReader runtimeAnnotations = bindingCustomization!=null ? (RuntimeAnnotationReader)bindingCustomization.get(JAXBRIContext.ANNOTATION_READER) : null; return JAXBRIContext.newInstance( classes, typeReferences, null, defaultNamespaceRemap, c14nSupport , runtimeAnnotations ); } catch (JAXBException e) { throw new WSException("Failed to create JAXBContext", e); } } private BindingCustomization getCustomization() { Endpoint threadLocal = EndpointAssociation.getEndpoint(); return threadLocal!=null ? threadLocal.getAttachment(BindingCustomization.class):null; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBBindingCustomization.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBBindingCustom0000644000175000017500000000350410652261524031425 0ustar godgod/* * 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.core.jaxws; import org.jboss.wsf.spi.binding.BindingCustomization; import com.sun.xml.bind.api.JAXBRIContext; /** * Supported JAXB 2.1 customizations. * * @see org.jboss.wsf.spi.deployment.Endpoint * * @author Heiko.Braun@jboss.com * Created: Jun 28, 2007 */ public class JAXBBindingCustomization extends BindingCustomization { // Use an alternative RuntimeAnnotationReader implementation public final static String ANNOTATION_READER = JAXBRIContext.ANNOTATION_READER; // Reassign the default namespace URI to something else at the runtime public final static String DEFAULT_NAMESPACE_REMAP = JAXBRIContext.DEFAULT_NAMESPACE_REMAP; // Enable the c14n marshalling support in the JAXBContext. public final static String CANONICALIZATION_SUPPORT = JAXBRIContext.CANONICALIZATION_SUPPORT; } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/SOAPFaultHelperJA0000644000175000017500000003104410703452703031322 0ustar godgod/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. * * This is free software; you can redistribute it and/or modify it * under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as * published by JBoss Inc.; either version 1.0 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. */ package org.jboss.ws.core.jaxws; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.rpc.encoding.TypeMapping; import javax.xml.soap.Detail; import javax.xml.soap.DetailEntry; import javax.xml.soap.MessageFactory; import javax.xml.soap.Name; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFault; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.ws.WebServiceException; import javax.xml.ws.soap.SOAPFaultException; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.CommonSOAPFaultException; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.NameImpl; import org.jboss.ws.core.soap.SOAPFactoryImpl; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.w3c.dom.Element; /** * Helper methods to translate between SOAPFault and SOAPFaultException * as well as between Exception and SOAPMessage containing a fault. * @author Alejandro Guizar * @version $Revision: 4742 $ */ public class SOAPFaultHelperJAXWS { // provide logging private static Logger log = Logger.getLogger(SOAPFaultHelperJAXWS.class); /** Factory method for FaultException for a given SOAPFault */ public static SOAPFaultException getSOAPFaultException(SOAPFault soapFault) { if (soapFault == null) throw new IllegalArgumentException("SOAPFault cannot be null"); SOAPFaultException faultEx = new SOAPFaultException(soapFault); Detail detail = soapFault.getDetail(); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (detail != null && msgContext != null) { log.debug("Processing detail"); SerializationContext serContext = msgContext.getSerializationContext(); TypeMapping typeMapping = serContext.getTypeMapping(); Iterator it = detail.getDetailEntries(); while (it.hasNext()) { DetailEntry deElement = (DetailEntry)it.next(); QName xmlName = deElement.getElementQName(); log.debug("Processing detail entry: " + xmlName); OperationMetaData opMetaData = msgContext.getOperationMetaData(); FaultMetaData faultMetaData = opMetaData.getFault(xmlName); if (faultMetaData != null) { log.debug("Deserialize fault: " + faultMetaData); QName xmlType = faultMetaData.getXmlType(); Class faultBeanClass = faultMetaData.getFaultBean(); // Get the deserializer from the type mapping AbstractDeserializerFactory desFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(faultBeanClass, xmlType); if (desFactory == null) throw new WebServiceException("Cannot obtain deserializer factory: xmlType=" + xmlType + ", javaType=" + faultBeanClass); // http://jira.jboss.org/jira/browse/JBWS-955 // Cannot deserialize fault detail String prefix = deElement.getPrefix(); if (prefix != null && prefix.length() > 0) { String nsURI = deElement.getNamespaceURI(); if (nsURI.length() > 0 && deElement.getAttributeNS(Constants.NS_XMLNS, prefix).length() == 0) { try { deElement.addNamespaceDeclaration(prefix, nsURI); } catch (SOAPException e) { log.warn("Declaration of detail entry namespace failed", e); } } } // Try jaxb deserialization try { Class[] types = opMetaData.getEndpointMetaData().getRegisteredTypes().toArray(new Class[0]); serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES, types); Source source = new DOMSource(deElement); DeserializerSupport des = (DeserializerSupport)desFactory.getDeserializer(); Object faultBean = des.deserialize(xmlName, xmlType, source, serContext); Exception serviceEx = faultMetaData.toServiceException(faultBean, soapFault.getFaultString()); faultEx.initCause(serviceEx); } catch (BindingException e) { throw new WebServiceException(e); } } else log.debug("Cannot find fault meta data for: " + xmlName); } } return faultEx; } /** Translate the request exception into a SOAPFault message. */ public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx) { log.error("SOAP request exception", reqEx); try { SOAPMessageImpl faultMessage; Throwable cause = reqEx.getCause(); if (reqEx instanceof SOAPFaultException) { faultMessage = toSOAPMessage((SOAPFaultException)reqEx); } /* JAX-WS 6.4.1: When an implementation catches an exception thrown by a * service endpoint implementation and the cause of that exception is an * instance of the appropriate ProtocolException subclass for the protocol * in use, an implementation MUST reflect the information contained in the * ProtocolException subclass within the generated protocol level fault. */ else if (cause != null && cause instanceof SOAPFaultException) { faultMessage = toSOAPMessage((SOAPFaultException)cause); } else if (reqEx instanceof CommonSOAPFaultException) { faultMessage = SOAPFaultHelperJAXRPC.exceptionToFaultMessage(reqEx); } else { faultMessage = toSOAPMessage(reqEx); } return faultMessage; } catch (SOAPException ex) { log.error("Error creating SOAPFault message", ex); throw new WebServiceException("Cannot create SOAPFault message for: " + reqEx); } } private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws SOAPException { MessageFactory factory = MessageFactory.newInstance(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage(); SOAPBody soapBody = soapMessage.getSOAPBody(); populateSOAPFault(soapBody, faultEx); /* detail * X. Serialized service specific exception * 2. SOAPFaultException.getFault().getDetail() */ Detail detail = faultEx.getFault().getDetail(); if (detail != null) soapBody.getFault().addChildElement(detail); return soapMessage; } private static void populateSOAPFault(SOAPBody soapBody, SOAPFaultException faultEx) throws SOAPException { SOAPFault sourceFault = faultEx.getFault(); /* JAX-WS 10.2.2.3: the fields of the fault message are populated according to the * following rules of precedence: */ /* faultcode * 1. SOAPFaultException.getFault().getFaultCodeAsQName() * X. env:Server (Subcode omitted for SOAP 1.2) */ Name faultCode = sourceFault.getFaultCodeAsName(); if (faultCode != null) { faultCode = new NameImpl(faultCode.getLocalName(), "codeNS", faultCode.getURI()); } else { faultCode = getFallbackFaultCode(); } /* faultstring * 1. SOAPFaultException.getFault().getFaultString() * X. Exception.getMessage() * X. Exception.toString() */ String faultString = sourceFault.getFaultString(); if (faultString == null) faultString = getFallbackFaultString(faultEx); SOAPFault targetFault = soapBody.addFault(faultCode, faultString); /* faultactor * 1. SOAPFaultException.getFault().getFaultActor() * 2. Empty */ String faultActor = sourceFault.getFaultActor(); if (faultActor != null) targetFault.setFaultActor(faultActor); } private static SOAPMessageImpl toSOAPMessage(Exception ex) throws SOAPException { MessageFactory factory = MessageFactory.newInstance(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage(); SOAPBody soapBody = soapMessage.getSOAPBody(); SOAPFault soapFault = soapBody.addFault(getFallbackFaultCode(), getFallbackFaultString(ex)); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SerializationContext serContext = msgContext.getSerializationContext(); NameImpl faultCode = (NameImpl)soapFault.getFaultCodeAsName(); if (faultCode.getURI().length() > 0) serContext.getNamespaceRegistry().registerQName(faultCode.toQName()); OperationMetaData opMetaData = msgContext.getOperationMetaData(); Class exClass = ex.getClass(); if (opMetaData != null && opMetaData.getFaultMetaData(exClass) != null) { FaultMetaData faultMetaData = opMetaData.getFaultMetaData(exClass); Object faultBean = faultMetaData.toFaultBean(ex); Detail detail = soapFault.addDetail(); SOAPElement detailEntry = toDetailEntry(faultBean, serContext, faultMetaData); detail.addChildElement(detailEntry); } else log.debug("Cannot obtain fault meta data for: " + exClass); return soapMessage; } private static Name getFallbackFaultCode() { /* faultcode * X. SOAPFaultException.getFault().getFaultCodeAsQName() * 2. env:Server (Subcode omitted for SOAP 1.2) */ return new NameImpl(Constants.SOAP11_FAULT_CODE_SERVER); } private static String getFallbackFaultString(Exception ex) { /* faultstring * X. SOAPFaultException.getFault().getFaultString() * 2. Exception.getMessage() * 3. Exception.toString() */ String faultString = ex.getMessage(); if (faultString == null) faultString = ex.toString(); return faultString; } private static SOAPElement toDetailEntry(Object faultObject, SerializationContext serContext, FaultMetaData faultMetaData) throws SOAPException { QName xmlName = faultMetaData.getXmlName(); xmlName = serContext.getNamespaceRegistry().registerQName(xmlName); // Get the serializer from the type mapping QName xmlType = faultMetaData.getXmlType(); Class javaType = faultMetaData.getFaultBean(); serContext.setJavaType(javaType); AbstractSerializerFactory serFactory = (AbstractSerializerFactory)serContext.getTypeMapping().getSerializer(javaType, xmlType); if (serFactory == null) throw new WebServiceException("Cannot obtain serializer factory: xmlType=" + xmlType + ", javaType=" + javaType); try { SerializerSupport ser = serFactory.getSerializer(); Result result = ser.serialize(xmlName, xmlType, faultObject, serContext, null); XMLFragment xmlFragment = new XMLFragment(result); String xmlStr = xmlFragment.toXMLString(); log.debug("Fault detail: " + xmlStr); Element domElement = xmlFragment.toElement(); SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); return soapFactory.createElement(domElement); } catch (BindingException e) { throw new WebServiceException(e); } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBContextCustomisation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBContextCustom0000644000175000017500000000226710644464306031510 0ustar godgod/* * 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.core.jaxws; import java.util.HashMap; /** * @author Heiko.Braun@jboss.com * Created: Jun 27, 2007 */ public class JAXBContextCustomisation extends HashMap { } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/AbstractWrapperGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/AbstractWrapperGe0000755000175000017500000000560310560063272031576 0ustar godgod/* * 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.core.jaxws; import java.beans.Introspector; import java.lang.reflect.Method; import java.util.HashSet; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; /** * Base class for JAX-WS wrapper generation. * * @author Jason T. Greene * @version $Revision: 2210 $ */ public abstract class AbstractWrapperGenerator implements WrapperGenerator { private static Set excludedGetters; protected ClassLoader loader; public AbstractWrapperGenerator(ClassLoader loader) { this.loader = loader; } public void reset(ClassLoader loader) { this.loader = loader; } static { excludedGetters = new HashSet(4); excludedGetters.add("getCause"); excludedGetters.add("getClass"); excludedGetters.add("getLocalizedMessage"); excludedGetters.add("getStackTrace"); } protected SortedMap> getExceptionProperties(Class exception) { if (! Exception.class.isAssignableFrom(exception)) throw new IllegalArgumentException("Not an exception"); TreeMap> sortedGetters = new TreeMap>(); for (Method method : exception.getMethods()) { if (java.lang.reflect.Modifier.isStatic(method.getModifiers())) continue; Class returnType = method.getReturnType(); if (returnType == void.class) continue; String name = method.getName(); if (excludedGetters.contains(name)) continue; int offset; if (name.startsWith("get")) offset = 3; else if (name.startsWith("is")) offset = 2; else continue; name = Introspector.decapitalize(name.substring(offset)); sortedGetters.put(name, returnType); } return sortedGetters; } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBContextCache.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBContextCache.0000644000175000017500000000532710644464306031317 0ustar godgod/* * 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.core.jaxws; // $Id: JAXBContextCache.java 3828 2007-07-09 16:56:38Z heiko.braun@jboss.com $ import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.utils.HashCodeUtil; import org.jboss.ws.metadata.umdm.EndpointMetaData; import javax.xml.bind.JAXBContext; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * Cache JAXBContext's. * * @author Heiko.Braun@jboss.org * @since 26.01.2007 */ public class JAXBContextCache { private Map cache = new ConcurrentHashMap(); public JAXBContext get(Class[] clazzes) { Integer id = buildId(clazzes); return get(id); } public void add(Class[] clazzes, JAXBContext context) { Integer id = buildId(clazzes); add(id, context); } private JAXBContext get(Integer id) { return cache.get(id); } private void add(Integer id, JAXBContext context) { cache.put(id, context); } private static Integer buildId(Class[] classes) { int sum = HashCodeUtil.SEED; for (Class cls : classes) { sum = HashCodeUtil.hash(sum, cls.getName()); } return sum; } /** * Access the JAXBContext cache through the message context. * The actual instance is assiciated with the EndpointMetaData. * @return JAXBContextCache */ public static JAXBContextCache getContextCache() { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); EndpointMetaData epMetaData = msgContext.getEndpointMetaData(); return epMetaData.getJaxbCache(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBSerializer.ja0000644000175000017500000001150710703157542031365 0ustar godgod/* * 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.core.jaxws; // $Id: JAXBSerializer.java 4724 2007-10-10 14:19:14Z heiko.braun@jboss.com $ import org.jboss.logging.Logger; import org.jboss.ws.extensions.xop.jaxws.AttachmentMarshallerImpl; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.ComplexTypeSerializer; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.wsf.spi.binding.BindingCustomization; import org.w3c.dom.NamedNodeMap; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.Marshaller; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; import javax.xml.transform.Result; import javax.xml.ws.WebServiceException; /** * A Serializer that can handle complex types by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class JAXBSerializer extends ComplexTypeSerializer { // provide logging private static final Logger log = Logger.getLogger(JAXBSerializer.class); public JAXBSerializer() throws BindingException { } @Override public Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException { if (log.isDebugEnabled()) log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); Result result = null; try { // The serialization context contains the base type, which is needed for JAXB to marshall xsi:type correctly. // This should be more efficient and accurate than searching the type mapping Class expectedType = serContext.getJavaType(); Class actualType = value.getClass(); Class[] types = shouldFilter(actualType) ? new Class[]{expectedType} : new Class[]{expectedType, actualType}; JAXBContext jaxbContext = getJAXBContext(types); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); marshaller.setAttachmentMarshaller(new AttachmentMarshallerImpl()); // It's safe to pass a stream result, because the SCE will always be in XML_VALID state afterwards. // This state can safely be written to an outstream. See XMLFragment and XMLContent as well. result = new BufferedStreamResult(); marshaller.marshal(new JAXBElement(xmlName, expectedType, value), result); if (log.isDebugEnabled()) log.debug("serialized: " + result); } catch (Exception ex) { handleMarshallException(ex); } return result; } /** * Retrieve JAXBContext from cache or create new one and cache it. * @param types * @return JAXBContext */ private JAXBContext getJAXBContext(Class[] types){ JAXBContextCache cache = JAXBContextCache.getContextCache(); JAXBContext context = cache.get(types); if(null==context) { BindingCustomization bindingCustomization = getBindingCustomization(); context = JAXBContextFactory.newInstance().createContext(types, bindingCustomization); cache.add(types, context); } return context; } // Remove this when we add a XMLGregorianCalendar Serializer private boolean shouldFilter(Class actualType) { return XMLGregorianCalendar.class.isAssignableFrom(actualType); } // 4.21 Conformance (Marshalling failure): If an error occurs when using the supplied JAXBContext to marshall // a request or unmarshall a response, an implementation MUST throw a WebServiceException whose // cause is set to the original JAXBException. private void handleMarshallException(Exception ex) { if (ex instanceof WebServiceException) throw (WebServiceException)ex; throw new WebServiceException(ex); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/WrapperGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/WrapperGenerator.0000644000175000017500000000046410556503067031566 0ustar godgodpackage org.jboss.ws.core.jaxws; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; public interface WrapperGenerator { public void generate(ParameterMetaData pmd); public void generate(FaultMetaData fmd); public void reset(ClassLoader loader); }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBContextFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBContextFactor0000644000175000017500000000473710703157542031455 0ustar godgod/* * 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.core.jaxws; import org.jboss.ws.WSException; import org.jboss.wsf.spi.util.ServiceLoader; import org.jboss.wsf.spi.binding.BindingCustomization; import javax.xml.bind.JAXBContext; import com.sun.xml.bind.api.TypeReference; import com.sun.xml.bind.api.JAXBRIContext; import java.util.Collection; /** * Creates JAXBContext's.

      * * @author Heiko.Braun@jboss.com * Created: Jun 26, 2007 */ public abstract class JAXBContextFactory { public final static String DEFAULT_JAXB_CONTEXT_FACTORY = "org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory"; public abstract JAXBContext createContext(Class[] clazzes, BindingCustomization bindingCustomization) throws WSException; public abstract JAXBContext createContext(Class[] clazzes) throws WSException; public abstract JAXBContext createContext(Class clazz) throws WSException; public abstract JAXBRIContext createContext( Class[] classes, Collection typeReferences, String defaultNamespaceRemap, boolean c14nSupport, BindingCustomization bindingCustomization); /** * Retrieve JAXBContextFactory instance through the {@link org.jboss.wsf.spi.util.ServiceLoader}. * Defaults to {@link CustomizableJAXBContextFactory} * @return JAXBContextFactory */ public static JAXBContextFactory newInstance() { return (JAXBContextFactory)ServiceLoader.loadService( JAXBContextFactory.class.getName(), DEFAULT_JAXB_CONTEXT_FACTORY ); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/DynamicWrapperGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/DynamicWrapperGen0000755000175000017500000002346010650145103031570 0ustar godgod/* * 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.core.jaxws; import java.util.List; import java.util.SortedMap; import javassist.CannotCompileException; import javassist.ClassPool; import javassist.CtClass; import javassist.CtField; import javassist.CtMethod; import javassist.CtNewMethod; import javassist.LoaderClassPath; import javassist.Modifier; import javassist.NotFoundException; import javassist.bytecode.ConstPool; import javax.xml.bind.annotation.*; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.utils.JavassistUtils; import org.jboss.ws.metadata.umdm.FaultMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.TypeMappingMetaData; import org.jboss.ws.metadata.umdm.TypesMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.wsf.common.JavaUtils; public class DynamicWrapperGenerator extends AbstractWrapperGenerator { private static Logger log = Logger.getLogger(DynamicWrapperGenerator.class); protected ClassPool pool; protected boolean prune = true; public DynamicWrapperGenerator(ClassLoader loader) { super(loader); init(loader); } private void init(ClassLoader loader) { pool = new ClassPool(true); pool.appendClassPath(new LoaderClassPath(loader)); } @Override public void reset(ClassLoader loader) { super.reset(loader); init(loader); } /** * Generates a wrapper type and assigns it to the passed ParameterMetaData * object. This routine requires the pmd to contain completed wrappedTypes * and wrappedVariables properties of the passed ParameterMetaData object. * * @param pmd a document/literal wrapped parameter */ public void generate(ParameterMetaData pmd) { String wrapperName = pmd.getJavaTypeName(); List wrappedParameters = pmd.getWrappedParameters(); OperationMetaData opMetaData = pmd.getOperationMetaData(); if (opMetaData.isDocumentWrapped() == false) throw new WSException("Operation is not document/literal (wrapped)"); if (wrappedParameters == null) throw new WSException("Cannot generate a type when their is no wrapper parameters"); if(log.isDebugEnabled()) log.debug("Generating wrapper: " + wrapperName); QName xmlName = pmd.getXmlName(); QName xmlType = pmd.getXmlType(); try { CtClass clazz = pool.makeClass(wrapperName); clazz.getClassFile().setVersionToJava5(); addClassAnnotations(clazz, xmlName, xmlType, null); for (WrappedParameter parameter : wrappedParameters) { addProperty( clazz, parameter.getType(), parameter.getName(), parameter.getVariable(), parameter.getTypeArguments(), new boolean[] {parameter.isSwaRef(), parameter.isXop()} ); } clazz.stopPruning(!prune); pool.toClass(clazz, loader); JavaUtils.clearBlacklists(loader); } catch (Exception e) { throw new WSException("Could not generate wrapper type: " + wrapperName, e); } // Add the generated type to the types meta data TypesMetaData types = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData(); types.addTypeMapping(new TypeMappingMetaData(types, xmlType, wrapperName)); } public void generate(FaultMetaData fmd) { String faultBeanName = fmd.getFaultBeanName(); if(log.isDebugEnabled()) log.debug("Generating fault bean: " + faultBeanName); QName xmlType = fmd.getXmlType(); Class exception = fmd.getJavaType(); try { SortedMap> properties = getExceptionProperties(exception); String[] propertyOrder = properties.keySet().toArray(new String[0]); CtClass clazz = pool.makeClass(faultBeanName); clazz.getClassFile().setVersionToJava5(); addClassAnnotations(clazz, fmd.getXmlName(), fmd.getXmlType(), propertyOrder); for (String property : propertyOrder) addProperty( clazz, properties.get(property).getName(), new QName(property), property, null, new boolean[] {false, false} ); clazz.stopPruning(!prune); pool.toClass(clazz, loader); JavaUtils.clearBlacklists(loader); } catch (Exception e) { throw new WSException("Could not generate fault wrapper bean: " + faultBeanName, e); } // Add the generated type to the types meta data TypesMetaData types = fmd.getOperationMetaData().getEndpointMetaData().getServiceMetaData().getTypesMetaData(); types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName)); } private static String getterPrefix(CtClass type) { return type == CtClass.booleanType || "java.lang.Boolean".equals(type.getName()) ? "is" : "get"; } private String typeSignature(String type, String[] arguments) { StringBuilder ret = new StringBuilder(JavaUtils.toSignature(type)); ret.deleteCharAt(ret.length() - 1).append('<'); for (String arg : arguments) ret.append(JavaUtils.toSignature(arg)); return ret.append(">;").toString(); } private String getterSignature(String type) { return "()" + type; } private String setterSignature(String type) { return "(" + type + ")V"; } private void addProperty(CtClass clazz, String typeName, QName name, String variable, String[] typeArguments, boolean[] attachments) throws CannotCompileException, NotFoundException { ConstPool constPool = clazz.getClassFile().getConstPool(); String fieldName = JavaUtils.isReservedKeyword(variable) ? "_" + variable : variable; CtField field = new CtField(pool.get(typeName), fieldName, clazz); field.setModifiers(Modifier.PRIVATE); // Add generics attributes String typeSignature = null; if (typeArguments != null) { typeSignature = typeSignature(typeName, typeArguments); JavassistUtils.addSignature(field, typeSignature); } // Add @XmlElement JavassistUtils.Annotation annotation = JavassistUtils.createAnnotation(XmlElement.class, constPool); if (name.getNamespaceURI() != null) annotation.addParameter("namespace", name.getNamespaceURI()); annotation.addParameter("name", name.getLocalPart()); annotation.markField(field); // @XmlAttachmentRef if(attachments[0]) { annotation = JavassistUtils.createAnnotation(XmlAttachmentRef.class, constPool); annotation.markField(field); } // @XmlMimeType if(attachments[1]) { annotation = JavassistUtils.createAnnotation(XmlMimeType.class, constPool); annotation.addParameter("value", "application/octet-stream"); // TODO: default mime annotation.markField(field); } clazz.addField(field); // Add accessor methods CtMethod getter = CtNewMethod.getter(getterPrefix(field.getType()) + JavaUtils.capitalize(variable), field); CtMethod setter = CtNewMethod.setter("set" + JavaUtils.capitalize(variable), field); if (typeSignature != null) { JavassistUtils.addSignature(getter, getterSignature(typeSignature)); JavassistUtils.addSignature(setter, setterSignature(typeSignature)); } clazz.addMethod(getter); clazz.addMethod(setter); } private static void addClassAnnotations(CtClass clazz, QName xmlName, QName xmlType, String[] propertyOrder) { ConstPool constPool = clazz.getClassFile().getConstPool(); // Add @XmlRootElement JavassistUtils.Annotation annotation = JavassistUtils.createAnnotation(XmlRootElement.class, constPool); if (xmlName.getNamespaceURI() != null && xmlName.getNamespaceURI().length() > 0) annotation.addParameter("namespace", xmlName.getNamespaceURI()); annotation.addParameter("name", xmlName.getLocalPart()); annotation.markClass(clazz); // Add @XmlType; annotation = JavassistUtils.createAnnotation(XmlType.class, constPool); if (xmlType.getNamespaceURI() != null & xmlType.getNamespaceURI().length() > 0) annotation.addParameter("namespace", xmlType.getNamespaceURI()); annotation.addParameter("name", xmlType.getLocalPart()); if (propertyOrder != null) annotation.addParameter("propOrder", propertyOrder); annotation.markClass(clazz); // Add @XmlAccessorType annotation = JavassistUtils.createAnnotation(XmlAccessorType.class, constPool); annotation.addParameter("value", XmlAccessType.FIELD); annotation.markClass(clazz); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/jaxws/JAXBDeserializer.0000644000175000017500000001051610703157542031362 0ustar godgod/* * 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.core.jaxws; // $Id: JAXBDeserializer.java 4724 2007-10-10 14:19:14Z heiko.braun@jboss.com $ import org.jboss.ws.extensions.xop.jaxws.AttachmentUnmarshallerImpl; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.binding.ComplexTypeDeserializer; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.logging.Logger; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.binding.BindingCustomization; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.Unmarshaller; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.ws.WebServiceException; /** * A Deserializer that can handle complex types by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public class JAXBDeserializer extends ComplexTypeDeserializer { // provide logging private static final Logger log = Logger.getLogger(JAXBDeserializer.class); public JAXBDeserializer() throws BindingException { } public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException { if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]"); Object value = null; try { Class[] javaTypes = (Class[])serContext.getProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES); TypeMappingImpl typeMapping = serContext.getTypeMapping(); Class javaType = typeMapping.getJavaType(xmlType); JAXBContext jaxbContext = getJAXBContext(javaTypes); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setAttachmentUnmarshaller( new AttachmentUnmarshallerImpl()); JAXBElement jbe = unmarshaller.unmarshal(xmlFragment, javaType); value = jbe.getValue(); if(log.isDebugEnabled()) log.debug("deserialized: " + (value != null ? value.getClass().getName() : null)); } catch (Exception ex) { handleUnmarshallException(ex); } return value; } /** * Retrieve JAXBContext from cache or create new one and cache it. * @param types * @return JAXBContext */ private JAXBContext getJAXBContext(Class[] types){ JAXBContextCache cache = JAXBContextCache.getContextCache(); JAXBContext context = cache.get(types); if(null==context) { BindingCustomization bindingCustomization = getBindingCustomization(); context = JAXBContextFactory.newInstance().createContext(types, bindingCustomization); cache.add(types, context); } return context; } // 4.21 Conformance (Marshalling failure): If an error occurs when using the supplied JAXBContext to marshall // a request or unmarshall a response, an implementation MUST throw a WebServiceException whose // cause is set to the original JAXBException. private void handleUnmarshallException(Exception ex) { if (ex instanceof WebServiceException) throw (WebServiceException)ex; throw new WebServiceException(ex); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/transport/0000755000175000017500000000000010755000266027164 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/transport/jms/0000755000175000017500000000000010755000266027755 5ustar godgod././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/transport/jms/AbstractJMSTransportSupport.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/transport/jms/AbstractJ0000644000175000017500000002222510741136614031562 0ustar godgod/* * 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.core.transport.jms; // $Id:JMSTransportSupport.java 915 2006-09-08 08:40:45Z thomas.diesler@jboss.com $ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.rmi.RemoteException; import javax.ejb.EJBException; import javax.jms.BytesMessage; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import javax.management.ObjectName; import javax.naming.InitialContext; import javax.xml.soap.SOAPException; import org.jboss.logging.Logger; import org.jboss.util.NestedRuntimeException; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.deployment.Endpoint.EndpointState; import org.jboss.wsf.spi.invocation.EndpointAssociation; import org.jboss.wsf.spi.invocation.InvocationContext; import org.jboss.wsf.spi.invocation.RequestHandler; import org.jboss.wsf.spi.management.EndpointRegistry; import org.jboss.wsf.spi.management.EndpointRegistryFactory; /** * The abstract base class for MDBs that want to act as web service endpoints. * A subclass should only need to implement the service endpoint interface. * * @author Thomas.Diesler@jboss.org */ public abstract class AbstractJMSTransportSupport implements MessageListener { // logging support protected Logger log = Logger.getLogger(AbstractJMSTransportSupport.class); private QueueConnectionFactory conFactory; /** * All messages come in here, if it is a BytesMessage we pass it on for further processing. */ public void onMessage(Message message) { try { String msgStr = null; if (message instanceof BytesMessage) { msgStr = getMessageStr((BytesMessage)message); } else if (message instanceof TextMessage) { msgStr = ((TextMessage)message).getText(); } else { log.warn("Invalid message type: " + message); return; } log.debug("Incomming SOAP message: " + msgStr); String fromName = null; Destination destination = message.getJMSDestination(); if (destination instanceof Queue) fromName = "queue/" + ((Queue)destination).getQueueName(); if (destination instanceof Topic) fromName = "topic/" + ((Topic)destination).getTopicName(); InputStream inputStream = new ByteArrayInputStream(msgStr.getBytes()); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024); processSOAPMessage(fromName, inputStream, outputStream); msgStr = new String(outputStream.toByteArray()); log.debug("Outgoing SOAP message: " + msgStr); if (msgStr.length() > 0) { Queue replyQueue = getReplyQueue(message); if (replyQueue != null) { sendResponse(replyQueue, msgStr); } else { log.warn("No reply queue, ignore response message"); } } else { log.debug("SOAP response message is null"); } } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new EJBException(e); } } protected void processSOAPMessage(String fromName, InputStream inputStream, OutputStream outStream) throws SOAPException, IOException, RemoteException { SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); EndpointRegistry epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry(); Endpoint endpoint = getEndpointForDestination(epRegistry, fromName); if (endpoint == null) throw new IllegalStateException("Cannot find endpoint for: " + fromName); EndpointAssociation.setEndpoint(endpoint); try { log.debug("dipatchMessage: " + endpoint.getName()); // [JBWS-1324]: workaround to prevent message processing before endpoint is started EndpointState state = endpoint.getState(); ObjectName name = endpoint.getName(); long startTime = System.currentTimeMillis(); log.debug(name + " is in state: " + state); while (state != EndpointState.STARTED && (System.currentTimeMillis() - startTime < 60000)) { try { Thread.sleep(1000); state = endpoint.getState(); log.debug(name + " is now in state: " + state); } catch (InterruptedException e) { throw new EJBException(e); } } RequestHandler reqHandler = endpoint.getRequestHandler(); try { InvocationContext invContext = new InvocationContext(); invContext.setTargetBean(this); reqHandler.handleRequest(endpoint, inputStream, outStream, invContext); } catch (Exception ex) { throw new RemoteException("Cannot process SOAP request", ex); } } finally { EndpointAssociation.removeEndpoint(); } } // The destination jndiName is encoded in the service object name under key 'jms' private Endpoint getEndpointForDestination(EndpointRegistry epRegistry, String fromName) { Endpoint endpoint = null; for (ObjectName oname : epRegistry.getEndpoints()) { Endpoint aux = epRegistry.getEndpoint(oname); String jmsProp = aux.getName().getKeyProperty("jms"); if (jmsProp != null && jmsProp.equals(fromName)) { endpoint = aux; break; } } return endpoint; } private String getMessageStr(BytesMessage message) throws Exception { byte[] buffer = new byte[8 * 1024]; ByteArrayOutputStream out = new ByteArrayOutputStream(buffer.length); int read = message.readBytes(buffer); while (read != -1) { out.write(buffer, 0, read); read = message.readBytes(buffer); } byte[] msgBytes = out.toByteArray(); return new String(msgBytes); } /** * Get the reply queue. */ protected Queue getReplyQueue(Message message) throws JMSException { Queue replyQueue = (Queue)message.getJMSReplyTo(); return replyQueue; } /** * Respond to the call by sending a message to the reply queue */ protected void sendResponse(Queue replyQueue, String msgStr) throws SOAPException, IOException, JMSException { QueueConnection qc = getQueueFactory().createQueueConnection(); QueueSession session = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); QueueSender sender = null; try { sender = session.createSender(replyQueue); TextMessage responseMessage = session.createTextMessage(msgStr); sender.send(responseMessage); log.info("Sent response"); } finally { try { sender.close(); } catch (JMSException ignored) { } try { session.close(); } catch (JMSException ignored) { } try { qc.close(); } catch (JMSException ignored) { } } } private QueueConnectionFactory getQueueFactory() { if (conFactory == null) { try { InitialContext ctx = new InitialContext(); conFactory = (QueueConnectionFactory)ctx.lookup("java:/ConnectionFactory"); } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new NestedRuntimeException(e); } } return conFactory; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/transport/jms/JMSTransportSupportEJB21.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/transport/jms/JMSTransp0000644000175000017500000000302310741136614031521 0ustar godgod/* * 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.core.transport.jms; // $Id:JMSTransportSupport.java 915 2006-09-08 08:40:45Z thomas.diesler@jboss.com $ import javax.ejb.EJBException; import javax.ejb.MessageDrivenBean; import javax.ejb.MessageDrivenContext; public abstract class JMSTransportSupportEJB21 extends AbstractJMSTransportSupport implements MessageDrivenBean { public void ejbCreate() { } public void ejbRemove() throws EJBException { } public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException { } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/transport/jms/JMSTransportSupportEJB3.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/transport/jms/JMSTransp0000644000175000017500000000231310741136614031522 0ustar godgod/* * 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.core.transport.jms; // $Id:JMSTransportSupport.java 915 2006-09-08 08:40:45Z thomas.diesler@jboss.com $ public abstract class JMSTransportSupportEJB3 extends AbstractJMSTransportSupport { } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonSOAP11Binding.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonSOAP11Binding.jav0000644000175000017500000000650410661361314031207 0ustar godgod/* * 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.core; // $Id: CommonSOAP11Binding.java 4428 2007-08-17 18:02:52Z thomas.diesler@jboss.com $ import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeaderElement; import org.jboss.ws.Constants; import org.jboss.ws.core.soap.MessageFactoryImpl; import org.jboss.ws.core.soap.SOAPFaultImpl; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.Use; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * The SOAP11Binding * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public abstract class CommonSOAP11Binding extends CommonSOAPBinding { private MessageFactoryImpl msgFactory; public CommonSOAP11Binding() { msgFactory = new MessageFactoryImpl(); msgFactory.setEnvNamespace(Constants.NS_SOAP11_ENV); } /** Create the SOAP-1.1 message */ protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException { SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgFactory.createMessage(); Use encStyle = opMetaData.getEndpointMetaData().getEncodingStyle(); if (Use.ENCODED.equals(encStyle)) { SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); soapEnvelope.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC); } return soapMessage; } public abstract Set getRoles(); @Override protected void verifyUnderstoodHeader(SOAPHeaderElement element) throws Exception { QName name = new QName(element.getNamespaceURI(), element.getLocalName()); String actor = element.getActor(); Set roles = getRoles(); boolean isActor = actor == null || actor.length() == 0 || Constants.URI_SOAP11_NEXT_ACTOR.equals(actor) || roles.contains(actor); if (isActor && !headerSource.getHeaders().contains(name)) { QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND; String faultString = "Unprocessed 'mustUnderstand' header element: " + element.getElementName(); SOAPFaultImpl fault = new SOAPFaultImpl(); fault.setFaultCode(faultCode); fault.setFaultString(faultString); throwFaultException(fault); } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/SOAPMessageAbstraction.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/SOAPMessageAbstraction.0000644000175000017500000000227310604700017031370 0ustar godgod/* * 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.core; /** * A generic SOAP message * * @author Thomas.Diesler@jboss.com * @since 02-Apr-2007 */ public interface SOAPMessageAbstraction extends MessageAbstraction { } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonMessageContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonMessageContext.ja0000644000175000017500000002650310704666467031573 0ustar godgod/* * 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.core; // $Id: CommonMessageContext.java 4767 2007-10-15 13:37:59Z heiko.braun@jboss.com $ import org.jboss.logging.Logger; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.xb.binding.NamespaceRegistry; import javax.xml.soap.AttachmentPart; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.ws.handler.MessageContext.Scope; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; /** * The common JAXRPC/JAXWS MessageContext * * @author Thomas.Diesler@jboss.org * @since 1-Sep-2006 */ public abstract class CommonMessageContext implements Map { private static Logger log = Logger.getLogger(CommonMessageContext.class); // expandToDOM in the SOAPContentElement should not happen during normal operation // This property should be set the message context when it is ok to do so. public static String ALLOW_EXPAND_TO_DOM = "org.jboss.ws.allow.expand.dom"; public static String REMOTING_METADATA = "org.jboss.ws.remoting.metadata"; // The serialization context for this message ctx private SerializationContext serContext; // The operation for this message ctx private EndpointMetaData epMetaData; // The operation for this message ctx private OperationMetaData opMetaData; // The Message in this message context private MessageAbstraction message; // The map of scoped properties protected Map scopedProps = new HashMap(); // The current property scope protected Scope currentScope = Scope.APPLICATION; private boolean isModified; public CommonMessageContext() { } // Copy constructor public CommonMessageContext(CommonMessageContext msgContext) { this.epMetaData = msgContext.epMetaData; this.opMetaData = msgContext.opMetaData; this.message = msgContext.message; this.serContext = msgContext.serContext; this.scopedProps = new HashMap(msgContext.scopedProps); this.currentScope = msgContext.currentScope; } public Scope getCurrentScope() { return currentScope; } public void setCurrentScope(Scope currentScope) { this.currentScope = currentScope; } public EndpointMetaData getEndpointMetaData() { if (epMetaData == null && opMetaData != null) epMetaData = opMetaData.getEndpointMetaData(); return epMetaData; } public void setEndpointMetaData(EndpointMetaData epMetaData) { this.epMetaData = epMetaData; } public OperationMetaData getOperationMetaData() { return opMetaData; } public void setOperationMetaData(OperationMetaData opMetaData) { this.opMetaData = opMetaData; } public SOAPMessage getSOAPMessage() { if(message!=null && ((message instanceof SOAPMessage) == false)) throw new UnsupportedOperationException("No SOAPMessage avilable. Current message context carries " + message.getClass()); return (SOAPMessage)message; } public void setSOAPMessage(SOAPMessage soapMessage) { this.message = (MessageAbstraction)soapMessage; this.setModified(true); } public MessageAbstraction getMessageAbstraction() { return message; } public void setMessageAbstraction(MessageAbstraction message) { this.message = message; } public SerializationContext getSerializationContext() { if (serContext == null) { serContext = createSerializationContext(); } return serContext; } public abstract SerializationContext createSerializationContext(); public void setSerializationContext(SerializationContext serContext) { this.serContext = serContext; } /** Gets the namespace registry for this message context */ public NamespaceRegistry getNamespaceRegistry() { return getSerializationContext().getNamespaceRegistry(); } // Map interface public int size() { return scopedProps.size(); } public boolean isEmpty() { return scopedProps.isEmpty(); } public boolean containsKey(Object key) { ScopedProperty prop = scopedProps.get(key); return isValidInScope(prop); } public boolean containsValue(Object value) { boolean valueFound = false; for (ScopedProperty prop : scopedProps.values()) { if (prop.getValue().equals(value) && isValidInScope(prop)) { valueFound = true; break; } } return valueFound; } public Object get(Object key) { Object value = null; ScopedProperty scopedProp = scopedProps.get(key); if (log.isTraceEnabled()) log.trace("get(" + key + "): " + scopedProp); if (isValidInScope(scopedProp)) value = scopedProp.getValue(); return value; } public Object put(String key, Object value) { ScopedProperty prevProp = scopedProps.get(key); if (prevProp != null && !isValidInScope(prevProp)) throw new IllegalArgumentException("Cannot set value for HANDLER scoped property: " + key); ScopedProperty newProp = new ScopedProperty(key, value, currentScope); if (log.isTraceEnabled()) log.trace("put: " + newProp); scopedProps.put(key, newProp); return prevProp != null ? prevProp.getValue() : null; } public Object remove(Object key) { ScopedProperty prevProp = scopedProps.get(key); if (prevProp != null && !isValidInScope(prevProp)) throw new IllegalArgumentException("Cannot set remove for HANDLER scoped property: " + key); return scopedProps.remove(key); } public void putAll(Map srcMap) { for (String key : srcMap.keySet()) { try { Object value = srcMap.get(key); put(key, value); } catch (IllegalArgumentException ex) { log.debug("Ignore: " + ex.getMessage()); } } } public void clear() { scopedProps.clear(); } public boolean isModified() { // skip changes from XOP handler interactions if (XOPContext.isXOPEncodedRequest() && !XOPContext.isXOPMessage()) { log.debug("Disregard changes from XOP/Handler interactions"); return false; } return isModified; } /** * Mark a message as 'modified' when the SAAJ model becomes stale. * This may be the case when: *

        *
      • the complete message is replaced at MessageContext level *
      • the payload is set on a LogicalMessage *
      • The SAAJ model is changed though the DOM or SAAJ API (handler) *
      * * In any of these cases another 'unbind' invocation is required. */ public void setModified(boolean modified) { isModified = modified; } public Set keySet() { Set keys = new HashSet(scopedProps.size()); for (ScopedProperty prop : scopedProps.values()) { if (isValidInScope(prop)) keys.add(prop.getName()); } return keys; } public Collection values() { Collection values = new HashSet(scopedProps.size()); for (ScopedProperty prop : scopedProps.values()) { if (isValidInScope(prop)) values.add(prop.getValue()); } return values; } public Set> entrySet() { Set> entries = new HashSet>(); for (ScopedProperty prop : scopedProps.values()) { if (isValidInScope(prop)) { String name = prop.getName(); Object value = prop.getValue(); Entry entry = new ImmutableEntry(name, value); entries.add(entry); } } return entries; } private boolean isValidInScope(ScopedProperty prop) { // A property of scope APPLICATION is always visible boolean valid = (prop != null && (prop.getScope() == Scope.APPLICATION || currentScope == Scope.HANDLER)); return valid; } public static void cleanupAttachments(CommonMessageContext messageContext) { // cleanup attachments MessageAbstraction msg = messageContext.getMessageAbstraction(); if(msg!=null && (msg instanceof SOAPMessage)) // in case of http binding { Iterator it = ((SOAPMessage)msg).getAttachments(); while(it.hasNext()) { AttachmentPart attachment = (AttachmentPart)it.next(); try { if(attachment.getDataHandler().getDataSource() instanceof SwapableMemoryDataSource) { SwapableMemoryDataSource swapFile = (SwapableMemoryDataSource)attachment.getDataHandler().getDataSource(); swapFile.cleanup(); } } catch (SOAPException e) { log.warn("Failed to cleanup attachment part", e); } } } } private static class ImmutableEntry implements Map.Entry { final K k; final V v; ImmutableEntry(K key, V value) { k = key; v = value; } public K getKey() { return k; } public V getValue() { return v; } public V setValue(V value) { throw new UnsupportedOperationException(); } } public static class ScopedProperty { private Scope scope; private String name; private Object value; public ScopedProperty(String name, Object value, Scope scope) { this.scope = scope; this.name = name; this.value = value; } public String getName() { return name; } public Scope getScope() { return scope; } public Object getValue() { return value; } public String toString() { return scope + ":" + name + "=" + value; } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/MessageTrace.java0000644000175000017500000000616210723513236030344 0ustar godgod/* * 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.core; // $Id: MessageTrace.java 5144 2007-11-29 10:38:22Z richard.opalka@jboss.com $ import java.io.ByteArrayInputStream; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.transform.stream.StreamSource; import org.jboss.logging.Logger; import org.jboss.ws.core.soap.SOAPElementImpl; import org.jboss.ws.core.soap.SOAPElementWriter; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * Trace incomming/outgoing messages * * @author Thomas.Diesler@jboss.org * @since 04-Apr-2007 */ public final class MessageTrace { private static final Logger msgLog = Logger.getLogger(MessageTrace.class); private MessageTrace() { // forbidden constructor } public static void traceMessage(String messagePrefix, Object message) { if (!msgLog.isTraceEnabled()) return; if (message instanceof SOAPMessage) { try { SOAPEnvelope soapEnv = ((SOAPMessage)message).getSOAPPart().getEnvelope(); if (soapEnv != null) { String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true); msgLog.trace(messagePrefix + "\n" + envStr); } } catch (SOAPException ex) { msgLog.error("Cannot trace SOAPMessage", ex); } } else if (message instanceof HTTPMessageImpl) { HTTPMessageImpl httpMessage = (HTTPMessageImpl)message; Element root = httpMessage.getXmlFragment().toElement(); String xmlString = DOMWriter.printNode(root, true); msgLog.trace(messagePrefix + "\n" + xmlString); } else if (message instanceof byte[]) { Element root = new XMLFragment(new StreamSource(new ByteArrayInputStream((byte[])message))).toElement(); String xmlString = DOMWriter.printNode(root, true); msgLog.trace(messagePrefix + "\n" + xmlString); } else { msgLog.warn("Unsupported message type: " + message); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/HTTPMessageImpl.java0000644000175000017500000000630210606734477030717 0ustar godgod/* * 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.core; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MimeHeaders; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import org.jboss.util.NotImplementedException; import org.jboss.ws.core.soap.XMLFragment; import org.jboss.ws.core.soap.attachment.MimeConstants; /** * A generic HTTP message * * @author Thomas.Diesler@jboss.com * @since 02-Apr-2007 */ public class HTTPMessageImpl implements HTTPMessageAbstraction { private MimeHeaders mimeHeaders; private XMLFragment xmlFragment; public HTTPMessageImpl(MimeHeaders mimeHeaders, InputStream inputStream) { this.mimeHeaders = mimeHeaders; this.xmlFragment = new XMLFragment(new StreamSource(inputStream)); } public HTTPMessageImpl(Source source) { this.mimeHeaders = new MimeHeaders(); this.xmlFragment = new XMLFragment(source); initDefaultMimeHeaders(); } public HTTPMessageImpl(Result result) { this.mimeHeaders = new MimeHeaders(); this.xmlFragment = new XMLFragment(result); initDefaultMimeHeaders(); } // TCL requirement public boolean doValidate() { this.xmlFragment.toElement(); return true; } private void initDefaultMimeHeaders() { mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_XML_UTF8); } public XMLFragment getXmlFragment() { return xmlFragment; } public void setXmlFragment(XMLFragment xmlFragment) { this.xmlFragment = xmlFragment; } public MimeHeaders getMimeHeaders() { if (mimeHeaders == null) mimeHeaders = new MimeHeaders(); return mimeHeaders; } public void setMimeHeaders(MimeHeaders mimeHeaders) { this.mimeHeaders = mimeHeaders; } public void writeTo(OutputStream outputStream) throws IOException { xmlFragment.writeTo(outputStream); } public boolean isFaultMessage() { return false; } public void addAttachmentPart(AttachmentPart part) { throw new NotImplementedException(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonSOAPBinding.java0000644000175000017500000011577610730542057031224 0ustar godgod/* * 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.core; // $Id: CommonSOAPBinding.java 5322 2007-12-14 17:58:07Z richard.opalka@jboss.com $ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MessageFactory; import javax.xml.soap.Name; import javax.xml.soap.Node; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFactory; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPHeaderElement; import javax.xml.soap.SOAPMessage; import javax.xml.ws.handler.MessageContext; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSTypeDefinition; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.jaxrpc.ParameterWrapping; import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.MessageFactoryImpl; import org.jboss.ws.core.soap.NameImpl; import org.jboss.ws.core.soap.SOAPBodyElementDoc; import org.jboss.ws.core.soap.SOAPBodyElementRpc; import org.jboss.ws.core.soap.SOAPBodyImpl; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.soap.SOAPElementImpl; import org.jboss.ws.core.soap.SOAPFactoryImpl; import org.jboss.ws.core.soap.SOAPFaultImpl; import org.jboss.ws.core.soap.SOAPHeaderElementImpl; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.soap.UnboundHeader; import org.jboss.ws.core.soap.Use; import org.jboss.ws.core.soap.attachment.AttachmentPartImpl; import org.jboss.ws.core.soap.attachment.CIDGenerator; import org.jboss.ws.core.utils.MimeUtils; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.common.RMHelper; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.TypesMetaData; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.JavaUtils; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.Element; /** * The SOAPBinding interface is an abstraction for the SOAP binding. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public abstract class CommonSOAPBinding implements CommonBinding { // provide logging protected Logger log = Logger.getLogger(getClass()); private boolean mtomEnabled; protected HeaderSource headerSource; /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */ public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http"; /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */ public static final String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/"; /** A constant representing the identity of the SOAP 1.1 over HTTP binding with MTOM enabled by default. */ public static final String SOAP11HTTP_MTOM_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true"; /** A constant representing the identity of the SOAP 1.2 over HTTP binding with MTOM enabled by default. */ public static final String SOAP12HTTP_MTOM_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true"; /** The SOAP encoded Array name */ private static final Name SOAP_ARRAY_NAME = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC); public CommonSOAPBinding() { } public MessageFactory getMessageFactory() { return new MessageFactoryImpl(); } public SOAPFactory getSOAPFactory() { return new SOAPFactoryImpl(); } public boolean isMTOMEnabled() { return this.mtomEnabled; } public void setMTOMEnabled(boolean flag) { this.mtomEnabled = flag; } /** Create the message */ protected abstract MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException; /** On the client side, generate the payload from IN parameters. */ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map unboundHeaders) throws BindingException { if (log.isDebugEnabled()) log.debug("bindRequestMessage: " + opMetaData.getQName()); try { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); // Disable MTOM for rpc/encoded if (opMetaData.isRPCEncoded()) XOPContext.setMTOMEnabled(false); else XOPContext.setMTOMEnabled(isMTOMEnabled()); // Associate current message with message context SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData); msgContext.setSOAPMessage(reqMessage); SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope(); SOAPBody soapBody = soapEnvelope.getBody(); SOAPHeader soapHeader = soapEnvelope.getHeader(); // Get the namespace registry NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry(); Style style = opMetaData.getStyle(); SOAPElement soapBodyElement = soapBody; if (style == Style.RPC) { boolean serialize = true; if (opMetaData.getEndpointMetaData().getConfig().getRMMetaData() != null) { // RM hack to JAX-RPC serialization if (RMHelper.isRMOperation(opMetaData.getQName())) { serialize = false; } } if (serialize) { QName opQName = opMetaData.getQName(); Name opName = new NameImpl(namespaceRegistry.registerQName(opQName)); if (log.isDebugEnabled()) log.debug("Create RPC body element: " + opName); soapBodyElement = new SOAPBodyElementRpc(opName); soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement); // Add soap encodingStyle if (opMetaData.getUse() == Use.ENCODED) { String envURI = soapEnvelope.getNamespaceURI(); String envPrefix = soapEnvelope.getPrefix(); soapBodyElement.setAttributeNS(envURI, envPrefix + ":encodingStyle", Constants.URI_SOAP11_ENC); } } } for (ParameterMetaData paramMetaData : opMetaData.getInputParameters()) { QName xmlName = paramMetaData.getXmlName(); Object value = epInv.getRequestParamValue(xmlName); if (paramMetaData.isSwA()) { // NOTE: swa:ref is handled by the AttachmentMarshaller callback CIDGenerator cidGenerator = reqMessage.getCidGenerator(); AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator); reqMessage.addAttachmentPart(part); // Add the attachment to the standard property if (value instanceof DataHandler && msgContext instanceof MessageContextJAXWS) { DataHandler dataHandler = (DataHandler)value; Map attachments = (Map)msgContext.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); attachments.put(dataHandler.getContentType(), dataHandler); } } else { SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBodyElement; addParameterToMessage(paramMetaData, value, soapElement); } } // Add unbound headers if (unboundHeaders != null) { Iterator it = unboundHeaders.values().iterator(); while (it.hasNext()) { UnboundHeader unboundHeader = (UnboundHeader)it.next(); if (unboundHeader.getMode() != ParameterMode.OUT) { QName xmlName = unboundHeader.getXmlName(); Object value = unboundHeader.getHeaderValue(); xmlName = namespaceRegistry.registerQName(xmlName); Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI()); log.debug("Add unboundHeader element: " + soapName); SOAPContentElement contentElement = new SOAPHeaderElementImpl(soapName); contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData)); if (soapHeader == null) soapHeader = soapEnvelope.addHeader(); soapHeader.addChildElement(contentElement); contentElement.setObjectValue(value); } } } // Set the SOAPAction setSOAPActionHeader(opMetaData, reqMessage); return reqMessage; } catch (Exception e) { handleException(e); return null; } } /** Override to set the SOAPAction header */ public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage); /** On the server side, extract the IN parameters from the payload and populate an Invocation object */ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction payload) throws BindingException { if (log.isDebugEnabled()) log.debug("unbindRequestMessage: " + opMetaData.getQName()); try { // Read the SOAPEnvelope from the reqMessage SOAPMessageImpl reqMessage = (SOAPMessageImpl)payload; SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope(); SOAPHeader soapHeader = soapEnvelope.getHeader(); SOAPBody soapBody = soapEnvelope.getBody(); // Verify the SOAP version verifySOAPVersion(opMetaData, soapEnvelope); // Construct the endpoint invocation object EndpointInvocation epInv = new EndpointInvocation(opMetaData); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); // Disable MTOM for rpc/encoded if (opMetaData.isRPCEncoded()) msgContext.put(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE); // Get the namespace registry NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry(); if (opMetaData.isMessageEndpoint() == false) { Style style = opMetaData.getStyle(); SOAPElement payloadParent = soapBody; if (style == Style.RPC) { payloadParent = null; Iterator it = soapBody.getChildElements(); while (payloadParent == null && it.hasNext()) { Object childNode = it.next(); if (childNode instanceof SOAPElement) { payloadParent = (SOAPElement)childNode; } } if (RMHelper.isRMOperation(opMetaData.getQName()) == false) // RM hack { if (payloadParent == null) throw new SOAPException("Cannot find RPC element in"); QName elName = payloadParent.getElementQName(); elName = namespaceRegistry.registerQName(elName); } } int numParameters = 0; for (ParameterMetaData paramMetaData : opMetaData.getParameters()) { QName xmlName = paramMetaData.getXmlName(); if (paramMetaData.getMode() == ParameterMode.OUT) { epInv.setRequestParamValue(xmlName, null); } else { if (paramMetaData.isSwA()) { AttachmentPart part = getAttachmentFromMessage(paramMetaData, reqMessage); epInv.setRequestParamValue(xmlName, part); // Add the attachment to the standard property if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS) { DataHandler dataHandler = part.getDataHandler(); Map attachments = (Map)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); attachments.put(part.getContentId(), dataHandler); } } else { boolean isHeader = paramMetaData.isInHeader(); SOAPElement element = isHeader ? soapHeader : payloadParent; if (!isHeader) numParameters++; SOAPContentElement value = getParameterFromMessage(paramMetaData, element, false); epInv.setRequestParamValue(xmlName, value); } } } if (RMHelper.isRMOperation(opMetaData.getQName()) == false) { // Verify the numer of parameters matches the actual message payload int numChildElements = 0; Iterator itElements = payloadParent.getChildElements(); while (itElements.hasNext()) { Node node = (Node)itElements.next(); if (node instanceof SOAPElement) numChildElements++; } if (numChildElements != numParameters) throw new WSException("Invalid number of payload elements: " + numChildElements); } } // Generic message endpoint else { for (ParameterMetaData paramMetaData : opMetaData.getParameters()) { QName xmlName = paramMetaData.getXmlName(); Object value = soapBody.getChildElements().next(); epInv.setRequestParamValue(xmlName, value); } } return epInv; } catch (Exception e) { handleException(e); return null; } } /** On the server side, generate the payload from OUT parameters. */ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException { if (log.isDebugEnabled()) log.debug("bindResponseMessage: " + opMetaData.getQName()); try { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); // Disable MTOM for rpc/encoded if (opMetaData.isRPCEncoded()) XOPContext.setMTOMEnabled(false); else XOPContext.setMTOMEnabled(isMTOMEnabled()); // Associate current message with message context SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData); msgContext.setSOAPMessage(resMessage); // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope. // Specifically, the HTTP response entity-body must be empty. boolean isWsrmMessage = msgContext.get(RMConstant.RESPONSE_CONTEXT) != null; if (opMetaData.isOneWay() && (false == isWsrmMessage)) { resMessage.getSOAPPart().setContent(null); return resMessage; } SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope(); SOAPHeader soapHeader = soapEnvelope.getHeader(); SOAPBody soapBody = soapEnvelope.getBody(); // Get the namespace registry NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry(); Style style = opMetaData.getStyle(); SOAPElement soapBodyElement = soapBody; if (style == Style.RPC) { QName opQName = opMetaData.getResponseName(); if (false == RMHelper.isRMOperation(opQName)) // RM hack { Name opName = new NameImpl(namespaceRegistry.registerQName(opQName)); soapBodyElement = new SOAPBodyElementRpc(opName); soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement); // Add soap encodingStyle if (opMetaData.getUse() == Use.ENCODED) { String envURI = soapEnvelope.getNamespaceURI(); String envPrefix = soapEnvelope.getPrefix(); soapBodyElement.setAttributeNS(envURI, envPrefix + ":encodingStyle", Constants.URI_SOAP11_ENC); } } } // Add the return to the message ParameterMetaData retMetaData = opMetaData.getReturnParameter(); if (retMetaData != null) { Object value = epInv.getReturnValue(); // TODO calls to ParameterWrapping should be elsewhere if (opMetaData.isDocumentWrapped()) value = ParameterWrapping.wrapResponseParameters(retMetaData, value, epInv.getOutParameters()); if (retMetaData.isSwA()) { CIDGenerator cidGenerator = resMessage.getCidGenerator(); AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator); resMessage.addAttachmentPart(part); epInv.setReturnValue(part); // Add the attachment to the standard property if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS) { DataHandler dataHandler = part.getDataHandler(); Map attachments = (Map)msgContext.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); attachments.put(part.getContentId(), dataHandler); } } else { SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBodyElement); epInv.setReturnValue(soapElement); soapElement.setObjectValue(value); } } // Add the out parameters to the message for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters()) { QName xmlName = paramMetaData.getXmlName(); Object value = epInv.getResponseParamValue(xmlName); if (paramMetaData.isSwA()) { CIDGenerator cidGenerator = resMessage.getCidGenerator(); AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator); resMessage.addAttachmentPart(part); // Add the attachment to the standard property if (value instanceof DataHandler && msgContext instanceof MessageContextJAXWS) { DataHandler dataHandler = (DataHandler)value; Map attachments = (Map)msgContext.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); attachments.put(dataHandler.getContentType(), dataHandler); } } else { if (paramMetaData.isInHeader()) { addParameterToMessage(paramMetaData, value, soapHeader); } else { addParameterToMessage(paramMetaData, value, soapBodyElement); } } } return resMessage; } catch (Exception e) { handleException(e); return null; } } /** On the client side, extract the OUT parameters from the payload and return them to the client. */ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction payload, EndpointInvocation epInv, Map unboundHeaders) throws BindingException { if (log.isDebugEnabled()) log.debug("unbindResponseMessage: " + opMetaData.getQName()); try { // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope. // Specifically, the HTTP response entity-body must be empty. if (opMetaData.isOneWay() == true) { return; } // WS-Addressing might redirect the response, which results in an empty envelope SOAPMessageImpl resMessage = (SOAPMessageImpl)payload; SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope(); if (soapEnvelope == null) { return; } // Verify the SOAP version verifySOAPVersion(opMetaData, soapEnvelope); // Get the SOAP message context that is associated with the current thread CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); // Disable MTOM for rpc/encoded if (opMetaData.isRPCEncoded()) msgContext.put(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE); SOAPHeader soapHeader = soapEnvelope.getHeader(); SOAPBodyImpl soapBody = (SOAPBodyImpl)soapEnvelope.getBody(); SOAPBodyElement soapBodyElement = soapBody.getBodyElement(); // Translate the SOAPFault to an exception and throw it if (soapBodyElement instanceof SOAPFaultImpl) throwFaultException((SOAPFaultImpl)soapBodyElement); // Extract unbound OUT headers if (unboundHeaders != null && soapHeader != null) { Map outHeaders = new HashMap(); Iterator itHeaderElements = soapHeader.getChildElements(); while (itHeaderElements.hasNext()) { SOAPContentElement soapHeaderElement = (SOAPHeaderElementImpl)itHeaderElements.next(); Name elName = soapHeaderElement.getElementName(); QName xmlName = new QName(elName.getURI(), elName.getLocalName()); UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName); if (unboundHeader != null) { soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData)); // Do the unmarshalling Object value = soapHeaderElement.getObjectValue(); unboundHeader.setHeaderValue(value); outHeaders.put(xmlName, unboundHeader); } } unboundHeaders.clear(); unboundHeaders.putAll(outHeaders); } Style style = opMetaData.getStyle(); SOAPElement soapElement = soapBody; if (style == Style.RPC) { if (soapBodyElement == null) throw new WSException("Cannot unbind response message with empty soap body"); soapElement = soapBodyElement; } ParameterMetaData retMetaData = opMetaData.getReturnParameter(); if (retMetaData != null) { if (retMetaData.isSwA()) { AttachmentPart part = getAttachmentFromMessage(retMetaData, resMessage); epInv.setReturnValue(part); // Add the attachment to the standard property if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS) { DataHandler dataHandler = part.getDataHandler(); Map attachments = (Map)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); attachments.put(part.getContentId(), dataHandler); } } else { SOAPContentElement value = getParameterFromMessage(retMetaData, soapElement, false); epInv.setReturnValue(value); } } for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters()) { QName xmlName = paramMetaData.getXmlName(); if (paramMetaData.isSwA()) { AttachmentPart part = getAttachmentFromMessage(paramMetaData, resMessage); epInv.setResponseParamValue(xmlName, part); // Add the attachment to the standard property if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS) { DataHandler dataHandler = part.getDataHandler(); Map attachments = (Map)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS); attachments.put(part.getContentId(), dataHandler); } } else { SOAPElement element = paramMetaData.isInHeader() ? soapHeader : soapElement; SOAPContentElement value = getParameterFromMessage(paramMetaData, element, false); epInv.setResponseParamValue(xmlName, value); } } } catch (Exception e) { handleException(e); } } public MessageAbstraction bindFaultMessage(Exception ex) { SOAPMessageImpl faultMessage = (SOAPMessageImpl)createFaultMessageFromException(ex); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null) { msgContext.setSOAPMessage(faultMessage); } else { log.warn("Cannot set fault message in message context"); } return faultMessage; } protected abstract SOAPMessage createFaultMessageFromException(Exception ex); private void verifySOAPVersion(OperationMetaData opMetaData, SOAPEnvelope soapEnvelope) { String envNS = soapEnvelope.getNamespaceURI(); String bindingId = opMetaData.getEndpointMetaData().getBindingId(); if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) && Constants.NS_SOAP11_ENV.equals(envNS) == false) log.warn("Expected SOAP-1.1 envelope, but got: " + envNS); if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) && Constants.NS_SOAP12_ENV.equals(envNS) == false) log.warn("Expected SOAP-1.2 envelope, but got: " + envNS); } private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object value, CIDGenerator cidGenerator) throws SOAPException, BindingException { String partName = paramMetaData.getXmlName().getLocalPart(); Set mimeTypes = paramMetaData.getMimeTypes(); AttachmentPart part = new AttachmentPartImpl(); if (value instanceof DataHandler) { DataHandler handler = (DataHandler)value; String mimeType = MimeUtils.getBaseMimeType(handler.getContentType()); // JAX-WS 2.0, 2.6.3.1 MIME Content // Conformance (MIME type mismatch): On receipt of a message where the MIME type of a part does not // match that described in the WSDL an implementation SHOULD throw a WebServiceException. if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes)) log.warn("Mime type " + mimeType + " not allowed for parameter " + partName + " allowed types are " + mimeTypes); part.setDataHandler((DataHandler)value); } else { String mimeType = null; if (mimeTypes != null && mimeTypes.size() > 0) { mimeType = (String)mimeTypes.iterator().next(); } else { mimeType = MimeUtils.resolveMimeType(value); } if (mimeType == null) throw new BindingException("Could not determine mime type for attachment parameter: " + partName); part.setContent(value, mimeType); } if (paramMetaData.isSwA()) { String swaCID = '<' + partName + "=" + cidGenerator.generateFromCount() + '>'; part.setContentId(swaCID); } if (paramMetaData.isXOP()) { String xopCID = '<' + cidGenerator.generateFromName(partName) + '>'; part.setContentId(xopCID); } return part; } private AttachmentPart getAttachmentFromMessage(ParameterMetaData paramMetaData, SOAPMessage message) throws SOAPException, BindingException { QName xmlName = paramMetaData.getXmlName(); AttachmentPart part = ((SOAPMessageImpl)message).getAttachmentByPartName(xmlName.getLocalPart()); if (part == null) throw new BindingException("Could not locate attachment for parameter: " + paramMetaData.getXmlName()); return part; } /** Marshall the given parameter and add it to the SOAPMessage */ private SOAPContentElement addParameterToMessage(ParameterMetaData paramMetaData, Object value, SOAPElement soapElement) throws SOAPException, BindingException { QName xmlName = paramMetaData.getXmlName(); Class javaType = paramMetaData.getJavaType(); if (value != null && paramMetaData.isXOP() == false) { Class valueType = value.getClass(); if (JavaUtils.isAssignableFrom(javaType, valueType) == false) throw new BindingException("javaType " + javaType.getName() + " is not assignable from: " + valueType.getName()); } // Make sure we have a prefix on qualified names if (xmlName.getNamespaceURI().length() > 0) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry(); xmlName = namespaceRegistry.registerQName(xmlName); } Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI()); SOAPContentElement contentElement; if (soapElement instanceof SOAPHeader) { contentElement = new SOAPHeaderElementImpl(soapName); soapElement.addChildElement(contentElement); } else { Style style = paramMetaData.getOperationMetaData().getStyle(); if (style == Style.DOCUMENT) { contentElement = new SOAPBodyElementDoc(soapName); soapElement.addChildElement(contentElement); } else { contentElement = new SOAPContentElement(soapName); soapElement.addChildElement(contentElement); } } contentElement.setParamMetaData(paramMetaData); if (paramMetaData.isSOAPArrayParam()) { log.trace("Add parameter as SOAP encoded Array"); contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC); } // When a potential xop parameter is detected and MTOM is enabled // we flag the SOAP message as a XOP package if (paramMetaData.isXOP() && XOPContext.isMTOMEnabled()) { log.trace("Add parameter as XOP"); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); soapMessage.setXOPMessage(true); } else if (paramMetaData.isSwaRef()) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); soapMessage.setSWARefMessage(true); } contentElement.setObjectValue(value); return contentElement; } /** Unmarshall a message element and add it to the parameter list */ private SOAPContentElement getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement soapElement, boolean optional) throws BindingException { Name xmlName = new NameImpl(paramMetaData.getXmlName()); SOAPContentElement soapContentElement = null; Iterator childElements = soapElement.getChildElements(); while (childElements.hasNext()) { Object childNode = childElements.next(); if (childNode instanceof SOAPElement) { SOAPElementImpl childElement = (SOAPElementImpl)childNode; // If this message was manipulated by a handler the child may not be a content element if (!(childElement instanceof SOAPContentElement)) childElement = (SOAPContentElement)soapElement.replaceChild(new SOAPContentElement(childElement), childElement); // The parameters are expected to be lazy SOAPContentElement aux = (SOAPContentElement)childElement; Name elName = aux.getElementName(); if (xmlName.equals(elName)) { soapContentElement = aux; soapContentElement.setParamMetaData(paramMetaData); break; } if (SOAP_ARRAY_NAME.equals(elName)) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE); try { QName compXMLName = paramMetaData.getXmlName(); Element compElement = DOMUtils.getFirstChildElement(aux); // NPE when the soap encoded array size is 0 on the return path // http://jira.jboss.org/jira/browse/JBWS-1285 if (compElement == null || compElement.getNodeName().equals(compXMLName.getLocalPart())) { soapContentElement = aux; soapContentElement.setParamMetaData(paramMetaData); break; } } finally { msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM); } } } } // If matching by name fails, try to match by xmlType // This maybe necessary when wsa:Action dispatches to the operation if (soapContentElement == null) { childElements = soapElement.getChildElements(); OperationMetaData opMetaData = paramMetaData.getOperationMetaData(); TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData(); if (childElements.hasNext() && opMetaData.getStyle() == Style.DOCUMENT) { SOAPElementImpl childElement = (SOAPElementImpl)childElements.next(); // The parameters are expected to be lazy SOAPContentElement aux = (SOAPContentElement)childElement; Name elName = aux.getElementName(); QName elType = null; XSElementDeclaration xsdElement = typesMetaData.getSchemaModel().getElementDeclaration(elName.getLocalName(), elName.getURI()); if (xsdElement != null && xsdElement.getTypeDefinition() != null) { XSTypeDefinition xsdType = xsdElement.getTypeDefinition(); elType = new QName(xsdType.getNamespace(), xsdType.getName()); } if (paramMetaData.getXmlType().equals(elType)) { soapContentElement = aux; soapContentElement.setParamMetaData(paramMetaData); } } } if (soapContentElement == null && optional == false) throw new WSException("Cannot find child element: " + xmlName); // When a potential XOP parameter is detected and // the incomming request is actuall XOP encoded we flag // the SOAP message a XOP packaged. if (paramMetaData.isXOP() && XOPContext.isXOPEncodedRequest()) { SOAPMessageImpl soapMessage = (SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getSOAPMessage(); soapMessage.setXOPMessage(true); } else if (paramMetaData.isSwaRef()) { SOAPMessageImpl soapMessage = (SOAPMessageImpl)MessageContextAssociation.peekMessageContext().getSOAPMessage(); soapMessage.setSWARefMessage(true); } return soapContentElement; } abstract protected void throwFaultException(SOAPFaultImpl fault) throws Exception; abstract protected void verifyUnderstoodHeader(SOAPHeaderElement element) throws Exception; public void checkMustUnderstand(OperationMetaData opMetaData) throws Exception { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage(); SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); if (soapEnvelope == null || soapEnvelope.getHeader() == null) return; Iterator it = soapEnvelope.getHeader().examineAllHeaderElements(); while (it.hasNext()) { SOAPHeaderElement soapHeaderElement = (SOAPHeaderElement)it.next(); Name name = soapHeaderElement.getElementName(); QName xmlName = new QName(name.getURI(), name.getLocalName()); ParameterMetaData paramMetaData = (opMetaData != null ? opMetaData.getParameter(xmlName) : null); boolean isBoundHeader = (paramMetaData != null && paramMetaData.isInHeader()); if (!isBoundHeader && soapHeaderElement.getMustUnderstand()) verifyUnderstoodHeader(soapHeaderElement); } } public void setHeaderSource(HeaderSource source) { headerSource = source; } private void handleException(Exception ex) throws BindingException { if (ex instanceof RuntimeException) throw (RuntimeException)ex; if (ex instanceof BindingException) throw (BindingException)ex; throw new BindingException(ex); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonSOAP12Binding.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonSOAP12Binding.jav0000644000175000017500000000556510661361314031216 0ustar godgod/* * 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.core; // $Id: CommonSOAP12Binding.java 4428 2007-08-17 18:02:52Z thomas.diesler@jboss.com $ import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeaderElement; import org.jboss.ws.Constants; import org.jboss.ws.core.soap.MessageFactoryImpl; import org.jboss.ws.core.soap.SOAPFaultImpl; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * The SOAP11Binding * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public abstract class CommonSOAP12Binding extends CommonSOAPBinding { private MessageFactoryImpl msgFactory; public CommonSOAP12Binding() { msgFactory = new MessageFactoryImpl(); msgFactory.setEnvNamespace(Constants.NS_SOAP12_ENV); } /** Create the SOAP-1.1 message */ protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws SOAPException { return (MessageAbstraction)msgFactory.createMessage(); } protected abstract Set getRoles(); @Override protected void verifyUnderstoodHeader(SOAPHeaderElement element) throws Exception { QName name = new QName(element.getNamespaceURI(), element.getLocalName()); String actor = element.getActor(); Set roles = getRoles(); boolean isActor = actor == null || actor.length() == 0 || Constants.URI_SOAP11_NEXT_ACTOR.equals(actor) || roles.contains(actor); if (isActor && !headerSource.getHeaders().contains(name)) { // How do we pass NotUnderstood blocks? They are not in the fault element QName faultCode = SOAPConstants.SOAP_MUSTUNDERSTAND_FAULT; SOAPFaultImpl fault = new SOAPFaultImpl(); fault.setFaultCode(faultCode); fault.setFaultString("SOAP header blocks not understood"); throwFaultException(fault); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/HeaderSource.java0000644000175000017500000000262410576531706030361 0ustar godgod/* * 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.core; import java.util.Set; import javax.xml.namespace.QName; /** * HeaderSource provides header information to the binding layer. * * @author Jason T. Greene * @version $Revision: 2630 $ */ public interface HeaderSource { /** * Get the set of known headers for this source. * * @return set of known herars */ Set getHeaders(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/0000755000175000017500000000000010755000266026270 5ustar godgod././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/HashCodeUtil.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/HashCodeUtil.java0000644000175000017500000001021110644464306031450 0ustar godgod/* * 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.core.utils; import java.lang.reflect.Array; /** * Collected methods which allow easy implementation of hashCode. * * Example use case: *
       *  public int hashCode(){
       *    int result = HashCodeUtil.SEED;
       *    //collect the contributions of various fields
       *    result = HashCodeUtil.hash(result, fPrimitive);
       *    result = HashCodeUtil.hash(result, fObject);
       *    result = HashCodeUtil.hash(result, fArray);
       *    return result;
       *  }
       * 
      */ public final class HashCodeUtil { /** * An initial value for a hashCode, to which is added contributions * from fields. Using a non-zero value decreases collisons of hashCode * values. */ public static final int SEED = 23; /** * booleans. */ public static int hash(int aSeed, boolean aBoolean) { return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (aBoolean ? 1 : 0); } /** * chars. */ public static int hash(int aSeed, char aChar) { return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (int)aChar; } /** * ints. */ public static int hash(int aSeed, int aInt) { /* * Implementation Note * Note that byte and short are handled by this method, through * implicit conversion. */ return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + aInt; } /** * longs. */ public static int hash(int aSeed, long aLong) { return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (int)(aLong ^ (aLong >>> 32)); } /** * floats. */ public static int hash(int aSeed, float aFloat) { return org.jboss.ws.core.utils.HashCodeUtil.hash(aSeed, Float.floatToIntBits(aFloat)); } /** * doubles. */ public static int hash(int aSeed, double aDouble) { return org.jboss.ws.core.utils.HashCodeUtil.hash(aSeed, Double.doubleToLongBits(aDouble)); } /** * aObject is a possibly-null object field, and possibly an array. * * If aObject is an array, then each element may be a primitive * or a possibly-null object. */ public static int hash(int aSeed, Object aObject) { int result = aSeed; if (aObject == null) { result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, 0); } else if (!org.jboss.ws.core.utils.HashCodeUtil.isArray(aObject)) { result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, aObject.hashCode()); } else { int length = Array.getLength(aObject); for (int idx = 0; idx < length; ++idx) { Object item = Array.get(aObject, idx); //recursive call! result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, item); } } return result; } /// PRIVATE /// private static final int fODD_PRIME_NUMBER = 37; private static int firstTerm(int aSeed) { return org.jboss.ws.core.utils.HashCodeUtil.fODD_PRIME_NUMBER * aSeed; } private static boolean isArray(Object aObject) { return aObject.getClass().isArray(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/ResourceURL.java0000644000175000017500000000442310542776150031316 0ustar godgod/* * 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.core.utils; // $Id: ResourceURL.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.net.URL; /** * A wrapper around an URL that can handle input streams for resources in nested jars. * * The jdk-1.5.0_10 cannot handle this type of URL * * jar:file://somepath/jaxws-eardeployment.ear!/jaxws-eardeployment.war!/WEB-INF/wsdl/TestEndpoint.wsdl * * @author Thomas.Diesler@jboss.org * @since 12-Dec-2006 (Dosi's birthday) */ public class ResourceURL { private URL targetURL; public ResourceURL(URL targetURL) { this.targetURL = targetURL; } public URL getTargetURL() { return targetURL; } public InputStream openStream() throws IOException { boolean isJarUrl = "jar".equals(targetURL.getProtocol()); return isJarUrl ? new JarUrlConnection(targetURL).getInputStream() : targetURL.openStream(); } public int hashCode() { return toString().hashCode(); } public boolean equals(Object obj) { if (!(obj instanceof ResourceURL)) return false; ResourceURL other = (ResourceURL)obj; return toString().equals(other.toString()); } public String toString() { return targetURL.toString(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/SAAJUtils.java0000644000175000017500000000717510575501571030711 0ustar godgod/* * 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.core.utils; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; /** * SAAJ utilities. * @author Alejandro Guizar * @version $Revision: 2605 $ */ public class SAAJUtils { /** Set the qname value to the given element. * @param value a namespace qualified name; its namespace name MUST NOT be empty */ public static void setQualifiedElementValue(SOAPElement element, QName value) throws SOAPException { String prefix = ensureNamespaceDeclared(element, value.getPrefix(), value.getNamespaceURI()); element.setValue(prefix + ':' + value.getLocalPart()); } /** Set the qname value to the specified attribute of the given element. * @param value a namespace qualified name; its namespace name MUST NOT be empty */ public static void setQualifiedAttributeValue(SOAPElement element, String attributeName, QName value) throws SOAPException { String prefix = ensureNamespaceDeclared(element, value.getPrefix(), value.getNamespaceURI()); element.setAttribute(attributeName, prefix + ':' + value.getLocalPart()); } /** Ensures the given namespace is declared in the scope of the given element. */ private static String ensureNamespaceDeclared(SOAPElement element, String prefix, String nsURI) throws SOAPException { if (prefix.length() == 0) { // no given prefix, find prefix currently associated to given URI prefix = getNamespacePrefix(element, nsURI); if (prefix == null) { // no prefix currently associated to given URI, declare namespace locally prefix = "valueNS"; element.addNamespaceDeclaration(prefix, nsURI); } } // verify given prefix is associated to given URI else if (!nsURI.equals(element.getNamespaceURI(prefix))) { // prefix is associated with other/no URI, declare namespace locally element.addNamespaceDeclaration(prefix, nsURI); } return prefix; } /** * Returns the prefix of the namespace that has the given URI. * @param nsURI the URI of the namespace to search for * @return the prefix of the namespace or null if not found */ public static String getNamespacePrefix(SOAPElement element, String nsURI) { Iterator it = element.getVisibleNamespacePrefixes(); while (it.hasNext()) { String prefix = (String)it.next(); if (nsURI.equals(element.getNamespaceURI(prefix))) return prefix; } return null; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/DocumentBuilderFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/DocumentBuilderFa0000644000175000017500000000605110631534562031555 0ustar godgod/* * 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.core.utils; // $Id: DocumentBuilderFactoryImpl.java 3471 2007-06-06 13:41:06Z heiko.braun@jboss.com $ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.jboss.logging.Logger; /** * A DocumentBuilderFactory that delegates to Xerces and is namespace aware by default. * * @author Thomas.Diesler@jboss.org * @since 11-Apr-2007 */ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { private static Logger log = Logger.getLogger(DocumentBuilderFactoryImpl.class); public static final String XERCES_DOCUMENT_BUILDER_FACTORY = "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"; private DocumentBuilderFactory delegate; public DocumentBuilderFactoryImpl() { try { ClassLoader classLoader = getClass().getClassLoader(); Class clazz = classLoader.loadClass(XERCES_DOCUMENT_BUILDER_FACTORY); delegate = (DocumentBuilderFactory)clazz.newInstance(); // namespace aware by default delegate.setNamespaceAware(true); } catch (Exception ex) { throw new IllegalStateException("Cannot create delegate document builder factory: " + XERCES_DOCUMENT_BUILDER_FACTORY, ex); } } public Object getAttribute(String name) throws IllegalArgumentException { return delegate.getAttribute(name); } public boolean getFeature(String name) throws ParserConfigurationException { return delegate.getFeature(name); } public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { DocumentBuilder builder = delegate.newDocumentBuilder(); builder.setEntityResolver( new JBossWSEntityResolver() ); return builder; } public void setAttribute(String name, Object value) throws IllegalArgumentException { delegate.setAttribute(name, value); } public void setFeature(String name, boolean value) throws ParserConfigurationException { delegate.setFeature(name, value); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/JarUrlConnection.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/JarUrlConnection.0000644000175000017500000002051210542776150031516 0ustar godgodpackage org.jboss.ws.core.utils; /* $Id: JarUrlConnection.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ Copyright 2002 (C) The Werken Company. All Rights Reserved. Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain copyright statements and notices. Redistributions must also contain a copy of this document. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "classworlds" must not be used to endorse or promote products derived from this Software without prior written permission of The Werken Company. For written permission, please contact bob@werken.com. 4. Products derived from this Software may not be called "classworlds" nor may "classworlds" appear in their names without prior written permission of The Werken Company. "classworlds" is a registered trademark of The Werken Company. 5. Due credit should be given to The Werken Company. (http://classworlds.werken.com/). THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.IOException; import java.io.InputStream; import java.net.JarURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarInputStream; /** URLConnection capable of handling multiply-nested jars. * * * @author bob mcwhirter * * @version $Id: JarUrlConnection.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ */ public class JarUrlConnection extends JarURLConnection { // ---------------------------------------------------------------------- // Instance members // ---------------------------------------------------------------------- /** Base resource. */ private URL baseResource; /** Additional nested segments. */ private String[] segments; /** Terminal input-stream. */ private InputStream in; // ---------------------------------------------------------------------- // Constructors // ---------------------------------------------------------------------- /** Construct. * * @param url Target URL of the connections. * * @throws java.io.IOException If an error occurs while attempting to initialize * the connection. */ public JarUrlConnection(URL url) throws IOException { super(url = normaliseURL(url)); String baseText = url.getPath(); int bangLoc = baseText.indexOf("!"); String baseResourceText = baseText.substring(0, bangLoc); String extraText = ""; if (bangLoc <= (baseText.length() - 2) && baseText.charAt(bangLoc + 1) == '/') { if (bangLoc + 2 == baseText.length()) { extraText = ""; } else { extraText = baseText.substring(bangLoc + 1); } } else { throw new MalformedURLException("No !/ in url: " + url.toExternalForm()); } List segments = new ArrayList(); StringTokenizer tokens = new StringTokenizer(extraText, "!"); while (tokens.hasMoreTokens()) { segments.add(tokens.nextToken()); } this.segments = (String[])segments.toArray(new String[segments.size()]); this.baseResource = new URL(baseResourceText); } protected static URL normaliseURL(URL url) throws MalformedURLException { String text = normalizeUrlPath(url.toString()); if (!text.startsWith("jar:")) { text = "jar:" + text; } if (text.indexOf('!') < 0) { text = text + "!/"; } return new URL(text); } // ---------------------------------------------------------------------- // Instance methods // ---------------------------------------------------------------------- /** Retrieve the nesting path segments. * * @return The segments. */ protected String[] getSegments() { return this.segments; } /** Retrieve the base resource URL. * * @return The base resource url. */ protected URL getBaseResource() { return this.baseResource; } /** @see java.net.URLConnection */ public void connect() throws IOException { if (this.segments.length == 0) { setupBaseResourceInputStream(); } else { setupPathedInputStream(); } } /** Setup the InputStream purely from the base resource. * * @throws java.io.IOException If an I/O error occurs. */ protected void setupBaseResourceInputStream() throws IOException { this.in = getBaseResource().openStream(); } /** Setup the InputStream for URL with nested segments. * * @throws java.io.IOException If an I/O error occurs. */ protected void setupPathedInputStream() throws IOException { InputStream curIn = getBaseResource().openStream(); for (int i = 0; i < this.segments.length; ++i) { curIn = getSegmentInputStream(curIn, segments[i]); } this.in = curIn; } /** Retrieve the InputStream for the nesting * segment relative to a base InputStream. * * @param baseIn The base input-stream. * @param segment The nesting segment path. * * @return The input-stream to the segment. * * @throws java.io.IOException If an I/O error occurs. */ protected InputStream getSegmentInputStream(InputStream baseIn, String segment) throws IOException { JarInputStream jarIn = new JarInputStream(baseIn); JarEntry entry = null; while (jarIn.available() != 0) { entry = jarIn.getNextJarEntry(); if (entry == null) { break; } if (("/" + entry.getName()).equals(segment)) { return jarIn; } } throw new IOException("unable to locate segment: " + segment); } /** @see java.net.URLConnection */ public InputStream getInputStream() throws IOException { if (this.in == null) { connect(); } return this.in; } /** * @return JarFile * @throws java.io.IOException * @see java.net.JarURLConnection#getJarFile() */ public JarFile getJarFile() throws IOException { String url = baseResource.toExternalForm(); if (url.startsWith("file:/")) { url = url.substring(6); } return new JarFile(URLDecoder.decode(url, "UTF-8")); } private static String normalizeUrlPath(String name) { if (name.startsWith("/")) { name = name.substring(1); System.out.println("1 name = " + name); } // Looking for org/codehaus/werkflow/personality/basic/../common/core-idioms.xml // | i | // +-------+ remove // int i = name.indexOf("/.."); // Can't be at the beginning because we have no root to refer to so // we start at 1. if (i > 0) { int j = name.lastIndexOf("/", i - 1); name = name.substring(0, j) + name.substring(i + 3); System.out.println("2 name = " + name); } return name; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/MimeUtils.java0000644000175000017500000002500510650145103031037 0ustar godgod/* * 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.core.utils; // $Id: MimeUtils.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; import java.util.Set; import javax.mail.internet.ContentType; import javax.mail.internet.MimeMultipart; import javax.mail.internet.ParseException; import javax.xml.namespace.QName; import javax.xml.transform.stream.StreamSource; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.wsf.common.IOUtils; import org.jboss.wsf.common.JavaUtils; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageDecoder; import com.sun.image.codec.jpeg.JPEGImageEncoder; /** * Generic mime utility class. * * @author Jason T. Greene */ public class MimeUtils { private static Map mime2class = new HashMap(); private static Map class2mime = new HashMap(); static { mime2class.put("text/plain", java.lang.String.class); mime2class.put("image/jpeg", java.awt.Image.class); mime2class.put("text/xml", javax.xml.transform.Source.class); mime2class.put("application/xml", javax.xml.transform.Source.class); mime2class.put("application/octet-stream", javax.activation.DataHandler.class); class2mime.put(java.awt.Image.class, "image/jpeg"); class2mime.put(javax.xml.transform.Source.class, "text/xml"); class2mime.put(java.lang.String.class, "text/plain"); } /** * Converts a MIME type into a proprietary JBossWS attachment xml type. * * @param mimeType the MIME type string to convert * @return the xml type that this mime type corresponds to */ public static QName convertMimeTypeToXmlType(String mimeType) { StringBuilder mimeName = new StringBuilder(mimeType); int pos = mimeName.indexOf("/"); if (pos == -1) return null; mimeName.setCharAt(pos, '_'); return new QName(Constants.NS_ATTACHMENT_MIME_TYPE, mimeName.toString()); } /** * Gets the base portion of a MIME type string. This basically just strips * off any type parameter elements. * * @param mimeType any MIME type string * @return a reduced MIME string containing no type parameters */ public static String getBaseMimeType(String mimeType) { ContentType contentType; if (mimeType == null) return null; try { contentType = new ContentType(mimeType); } catch (ParseException e) { return null; } return contentType.getBaseType(); } /** * Checks if there is a matching mime pattern for mimeType in mimeTypes. This * will return true if there is an exact match (for example text/plain = * text/plain), or if there is a wildcard subtype match (text/plain = * text/*). * * @param mimeType the mime type to search for * @param mimeTypes the set of mime types to search * @return true if there is a match, false if not */ public static boolean isMemberOf(String mimeType, Set mimeTypes) { if (mimeTypes.contains(mimeType)) return true; try { if (mimeTypes.contains(new ContentType(mimeType).getPrimaryType() + "/*")) return true; } catch (ParseException e) { // eat } return false; } /** * Resolve the class for a mype type. * Defaults to DataHandler if no mapping could be found. */ public static Class resolveClass(String mimeType) { Class cl = mime2class.get(mimeType); if(null==cl) cl = javax.activation.DataHandler.class; return cl; } /** * Resolve the mime type for an object. * Default to application/octet-stream * if no mapping could be found. */ public static String resolveMimeType(Object obj) { String mimeType = (obj instanceof MimeMultipart) ? ((MimeMultipart)obj).getContentType() : resolveMimeType(obj.getClass()); return mimeType; } public static String resolveMimeType(Class clazz) { String mimeType = "application/octet-stream"; for(Class cl : class2mime.keySet()) { if(JavaUtils.isAssignableFrom(cl, clazz)) mimeType = class2mime.get(cl); } return mimeType; } public static ByteArrayConverter getConverterForJavaType(Class targetClazz) { ByteArrayConverter converter = null; if(JavaUtils.isAssignableFrom(java.awt.Image.class, targetClazz)) converter = new ImageConverter(); else if (JavaUtils.isAssignableFrom(javax.xml.transform.Source.class, targetClazz)) converter = new SourceConverter(); else if (JavaUtils.isAssignableFrom(java.lang.String.class, targetClazz)) converter = new StringConverter(); else if (JavaUtils.isAssignableFrom(java.io.InputStream.class, targetClazz)) converter = new StreamConverter(); if(null == converter) throw new WSException("No ByteArrayConverter for class: " + targetClazz.getName()); return converter; } public static ByteArrayConverter getConverterForContentType(String contentType) { ByteArrayConverter converter = null; if(contentType != null) { if("image/jpeg".equals(contentType) || "image/jpg".equals(contentType)) converter = new ImageConverter(); else if("text/xml".equals(contentType) || "application/xml".equals(contentType)) converter = new SourceConverter(); else if("text/plain".equals(contentType)) converter = new StringConverter(); else if("application/octet-stream".equals(contentType)) converter = new StreamConverter(); } if(null == converter) throw new WSException("No ByteArrayConverter for content type: " + contentType); return converter; } public static class ImageConverter implements ByteArrayConverter { public Object readFrom(InputStream in) { Object converted = null; try { JPEGImageDecoder dec = JPEGCodec.createJPEGDecoder(in); BufferedImage bim = dec.decodeAsBufferedImage(); converted = bim; } catch (Exception e) { // ignore } return converted; } public void writeTo(Object obj, OutputStream out) { if(obj instanceof BufferedImage) { JPEGImageEncoder enc = JPEGCodec.createJPEGEncoder(out); try { enc.encode((BufferedImage)obj); } catch (IOException e) { throw new WSException("Failed to convert " + obj.getClass()); } } else { throw new WSException("Unable to convert " + obj.getClass()); } } } public static class SourceConverter implements ByteArrayConverter { public Object readFrom(InputStream in) { return new StreamSource(in); } public void writeTo(Object obj, OutputStream out) { if(obj instanceof StreamSource) { StreamSource s = (StreamSource)obj; try { IOUtils.copyStream(out, s.getInputStream()); } catch (IOException e) { throw new WSException("Failed to convert " + obj.getClass()); } } else { throw new WSException("Unable to convert " + obj.getClass()); } } } public static class StringConverter implements ByteArrayConverter { public Object readFrom(InputStream in) { Object converted = null; try { BufferedReader br = new BufferedReader(new InputStreamReader(in)); StringBuilder sb = new StringBuilder(); String line = null; while ((line = br.readLine()) != null) { sb.append(line + "\n"); } br.close(); converted = sb.toString(); } catch (IOException e) { throw new WSException("Failed to convert java.lang.String"); } return converted; } public void writeTo(Object obj, OutputStream out) { if(obj instanceof String) { String s = (String)obj; try { out.write(s.getBytes("UTF-8")); } catch (IOException e) { throw new WSException("Failed to convert " + obj.getClass()); } } else { throw new WSException("Unable to convert " + obj.getClass()); } } } public static class StreamConverter implements ByteArrayConverter { public Object readFrom(InputStream in) { return in; } public void writeTo(Object obj, OutputStream out) { if(obj instanceof InputStream) { try { IOUtils.copyStream(out, (InputStream)obj); } catch (IOException e) { throw new WSException("Failed to convert " + obj.getClass()); } } } } public interface ByteArrayConverter { Object readFrom(InputStream in); void writeTo(Object obj, OutputStream out); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/ThreadLocalAssociation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/ThreadLocalAssoci0000644000175000017500000000422510714611540031540 0ustar godgod/* * 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.core.utils; // $Id: ThreadLocalAssociation.java 5015 2007-11-08 13:47:12Z heiko.braun@jboss.com $ import java.util.Stack; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.extensions.security.SecurityStore; /** * Maintain thread locals at a single point. * * @author Heiko Braun, * @author Thomas.Diesler@jboss.com * @since 10-Apr-2006 */ public class ThreadLocalAssociation { /** * SOAP message context * @see org.jboss.ws.core.soap.MessageContextAssociation */ private static ThreadLocal> msgContextAssoc = new ThreadLocal>(); /** * @see org.jboss.ws.extensions.security.STRTransform */ private static ThreadLocal strTransformAssoc = new ThreadLocal(); public static ThreadLocal> localMsgContextAssoc() { return msgContextAssoc; } public static ThreadLocal localStrTransformAssoc() { return strTransformAssoc; } public static void clear() { msgContextAssoc.remove(); strTransformAssoc.remove(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/JavassistUtils.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/JavassistUtils.ja0000755000175000017500000001175010542776150031611 0ustar godgod/* * 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.core.utils; import javassist.CtClass; import javassist.CtField; import javassist.CtMethod; import javassist.bytecode.AnnotationsAttribute; import javassist.bytecode.ClassFile; import javassist.bytecode.ConstPool; import javassist.bytecode.FieldInfo; import javassist.bytecode.MethodInfo; import javassist.bytecode.SignatureAttribute; import javassist.bytecode.annotation.ArrayMemberValue; import javassist.bytecode.annotation.EnumMemberValue; import javassist.bytecode.annotation.StringMemberValue; /** * Utility functions that simplify Javassist. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class JavassistUtils { public static void addFieldAnnotation(CtField field, javassist.bytecode.annotation.Annotation annotation) { FieldInfo fieldInfo = field.getFieldInfo(); AnnotationsAttribute attribute = (AnnotationsAttribute) fieldInfo.getAttribute(AnnotationsAttribute.visibleTag); if (attribute == null) attribute = new AnnotationsAttribute(fieldInfo.getConstPool(), AnnotationsAttribute.visibleTag); attribute.addAnnotation(annotation); fieldInfo.addAttribute(attribute); } public static void addClassAnnotation(CtClass clazz, javassist.bytecode.annotation.Annotation annotation) { ClassFile classFile = clazz.getClassFile(); AnnotationsAttribute attribute = (AnnotationsAttribute) classFile.getAttribute(AnnotationsAttribute.visibleTag); if (attribute == null) attribute = new AnnotationsAttribute(classFile.getConstPool(), AnnotationsAttribute.visibleTag); attribute.addAnnotation(annotation); classFile.addAttribute(attribute); } public static Annotation createAnnotation(Class annotation, ConstPool constPool) { return new Annotation(annotation, constPool); } public static void addSignature(CtField field, String signature) { FieldInfo fieldInfo = field.getFieldInfo(); ConstPool constPool = fieldInfo.getConstPool(); SignatureAttribute signatureAttribute = new SignatureAttribute(constPool, signature); fieldInfo.addAttribute(signatureAttribute); } public static void addSignature(CtMethod method, String signature) { MethodInfo methodInfo = method.getMethodInfo(); ConstPool constPool = methodInfo.getConstPool(); SignatureAttribute signatureAttribute = new SignatureAttribute(constPool, signature); methodInfo.addAttribute(signatureAttribute); } public static class Annotation { private javassist.bytecode.annotation.Annotation annotation; private ConstPool constPool; public Annotation(Class annotation, ConstPool constPool) { this.annotation = new javassist.bytecode.annotation.Annotation(annotation.getName(), constPool); this.constPool = constPool; } public void addParameter(String name, String value) { annotation.addMemberValue(name, new StringMemberValue(value, constPool)); } public void addParameter(String name, Enum value) { EnumMemberValue enumValue = new EnumMemberValue(constPool); enumValue.setType(value.getClass().getName()); enumValue.setValue(value.name()); annotation.addMemberValue(name, enumValue); } public void addParameter(String name, String[] values) { ArrayMemberValue member = new ArrayMemberValue(constPool); StringMemberValue[] members = new StringMemberValue[values.length]; for (int i = 0; i < values.length; i++) members[i] = new StringMemberValue(values[i], constPool); member.setValue(members); annotation.addMemberValue(name, member); } public void markClass(CtClass clazz) { addClassAnnotation(clazz, annotation); } public void markField(CtField field) { addFieldAnnotation(field, annotation); } } }././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/UUIDGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/UUIDGenerator.jav0000644000175000017500000000775410542776150031432 0ustar godgod/* * 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.core.utils; import java.security.SecureRandom; /** * Generates the string form of IETF variant UUIDs. * * See * the latest IETF draft for more information about UUID generation. * * Currently only pseudo random (type 4) UUIDs are supported. * * @author Jason T. Greene */ public class UUIDGenerator { private static SecureRandom rand; private static String bytesToHex(byte[] buffer, int offset, int length) { long value = 0; for (int i = 0, countDown = 8 * length; i < length; i++) { value |= (buffer[offset + i] & 0xffL) << (countDown -= 8); } return Long.toHexString(value); } /** * Generates a pseudo random UUID and returns it in byte array form. * * @return a UUID byte array in network order */ public static byte[] generateRandomUUIDBytes() { if (rand == null) rand = new SecureRandom(); byte[] buffer = new byte[16]; rand.nextBytes(buffer); // Set version to 3 (Random) buffer[6] = (byte) ((buffer[6] & 0x0f) | 0x40); // Set variant to 2 (IETF) buffer[8] = (byte) ((buffer[8] & 0x3f) | 0x80); return buffer; } /** * Generates a pseudo random UUID and returns it the IETF specified * String form. See {@link #convertToString(byte[])} for a description * of the format. * * @return a UUID in IETF string form. */ public static String generateRandomUUIDString() { return convertToString(generateRandomUUIDBytes()); } /** * Converts a UUID in byte array form to the IETF string format. * *

      The BNF follows: *

          *  UUID                   =  "-"  "-"
          *                            "-"
          *                            "-"
          *                           
          *  time_low               = 4*
          *  time_mid               = 2*
          *  time_high_and_version  = 2*
          *  variant_and_sequence   = 2*
          *  node                   = 6*
          *  hexOctet               = 
          *  hexDigit               =
          *        "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
          *        | "a" | "b" | "c" | "d" | "e" | "f"
          *        | "A" | "B" | "C" | "D" | "E" | "F"
          * 
      * * @param uuid a 16 byte * @return the IETF string form of the passed UUID */ public static String convertToString(byte[] uuid) { if (uuid.length != 16) throw new IllegalArgumentException("A UUID must be 16 bytes!"); String string = bytesToHex(uuid, 0, 4) + "-" + bytesToHex(uuid, 4, 2) + "-" + bytesToHex(uuid, 6, 2) + "-" + bytesToHex(uuid, 8, 2) + "-" + bytesToHex(uuid, 10, 6); return string; } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/XMLPredefinedEntityReferenceResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/XMLPredefinedEnti0000644000175000017500000000725310542776150031476 0ustar godgod/* * 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.core.utils; import java.util.HashMap; /** * Utility class for resolving predefined XML entity and character references. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class XMLPredefinedEntityReferenceResolver { private static HashMap entities = new HashMap(); static { entities.put("quot", '"'); entities.put("amp", '&'); entities.put("lt", '<'); entities.put("gt", '>'); entities.put("apos", '\''); } private static int resolveCharRef(String source, int pos, StringBuilder builder) { int radix = 10; if (source.charAt(pos += 2) == 'x') { pos++; radix = 16; } int end = source.indexOf(';', pos); if (end == -1) throw new IllegalArgumentException("Invalid character reference"); int c = Integer.parseInt(source.substring(pos, end), radix); builder.append((char) c); return end + 1; } private static int resolveEntityRef(String source, int pos, StringBuilder builder) { int end = source.indexOf(';', ++pos); if (end == -1) throw new IllegalArgumentException("Invalid entity reference"); String entity = source.substring(pos, end); Character c = entities.get(entity); if (c == null) throw new IllegalArgumentException("Invalid entity: " + entity); builder.append(c.charValue()); return end + 1; } /** * Transforms an XML normalized string by resolving all predefined character and entity references * * @param normalized an XML normalized string * @return a standard java string that is no longer XML normalized */ public static String resolve(String normalized) { StringBuilder builder = new StringBuilder(); int end = normalized.length(); int pos = normalized.indexOf('&'); int last = 0; // No references if (pos == -1) return normalized; while (pos != -1) { String sub = normalized.subSequence(last, pos).toString(); builder.append(sub); int peek = pos + 1; if (peek == end) throw new IllegalArgumentException("Invalid entity reference"); if (normalized.charAt(peek) == '#') pos = resolveCharRef(normalized, pos, builder); else pos = resolveEntityRef(normalized, pos, builder); last = pos; pos = normalized.indexOf('&', pos); } if (last < end) { String sub = normalized.subSequence(last, end).toString(); builder.append(sub); } return builder.toString(); } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/JBossWSEntityResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/JBossWSEntityReso0000644000175000017500000001114610626770234031544 0ustar godgod/* * 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.core.utils; // $Id: JBossWSEntityResolver.java 3272 2007-05-29 09:21:32Z heiko.braun@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import org.jboss.logging.Logger; import org.jboss.util.xml.JBossEntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** * Dynamically register the JBossWS entities. * * @author Thomas.Diesler@jboss.org * @since 02-Aug-2006 */ public class JBossWSEntityResolver extends JBossEntityResolver { // provide logging private static final Logger log = Logger.getLogger(JBossWSEntityResolver.class); public JBossWSEntityResolver() { registerEntity("urn:jboss:jaxrpc-config:2.0", "schema/jaxrpc-config_2_0.xsd"); registerEntity("urn:jboss:jaxws-config:2.0", "schema/jaxws-config_2_0.xsd"); registerEntity("http://java.sun.com/xml/ns/javaee", "schema/javaee_web_services_1_2.xsd"); registerEntity("http://www.w3.org/2005/08/addressing", "schema/ws-addr.xsd"); registerEntity("http://schemas.xmlsoap.org/ws/2004/08/eventing", "eventing.xsd"); registerEntity("http://www.w3.org/2002/06/soap-encoding", "soap-encoding_200206.xsd"); registerEntity("http://schemas.xmlsoap.org/soap/encoding/", "soap-encoding_1_1.xsd"); registerEntity("http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd", "j2ee_web_services_client_1_1.xsd"); registerEntity("http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd", "j2ee_web_services_1_1.xsd"); registerEntity("http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd", "j2ee_jaxrpc_mapping_1_1.xsd"); registerEntity("http://ws-i.org/profiles/basic/1.1/swaref.xsd", "schema/swaref.xsd"); } public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if(log.isDebugEnabled()) log.debug("resolveEntity: [pub=" + publicId + ",sysid=" + systemId + "]"); InputSource inputSource = super.resolveEntity(publicId, systemId); if (inputSource == null) inputSource = resolveSystemIDAsURL(systemId, log.isTraceEnabled()); if (inputSource == null) log.debug("Cannot resolve entity: [pub=" + publicId + ",sysid=" + systemId + "]"); return inputSource; } /** Use a ResourceURL to access the resource. * This method should be protected in the super class. */ protected InputSource resolveSystemIDAsURL(String id, boolean trace) { if (id == null) return null; if (trace) log.trace("resolveIDAsResourceURL, id=" + id); InputSource inputSource = null; // Try to use the systemId as a URL to the schema try { if (trace) log.trace("Trying to resolve id as a URL"); URL url = new URL(id); if (url.getProtocol().equalsIgnoreCase("file") == false) log.warn("Trying to resolve id as a non-file URL: " + id); InputStream ins = new ResourceURL(url).openStream(); if (ins != null) { inputSource = new InputSource(ins); inputSource.setSystemId(id); } else { log.warn("Cannot load id as URL: " + id); } if (trace) log.trace("Resolved id as a URL"); } catch (MalformedURLException ignored) { if (trace) log.trace("id is not a url: " + id, ignored); } catch (IOException e) { if (trace) log.trace("Failed to obtain URL.InputStream from id: " + id, e); } return inputSource; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/utils/HolderUtils.java0000644000175000017500000003051510650145103031367 0ustar godgod/* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package org.jboss.ws.core.utils; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Calendar; import javax.xml.namespace.QName; import javax.xml.rpc.holders.BigDecimalHolder; import javax.xml.rpc.holders.BigIntegerHolder; import javax.xml.rpc.holders.BooleanHolder; import javax.xml.rpc.holders.BooleanWrapperHolder; import javax.xml.rpc.holders.ByteArrayHolder; import javax.xml.rpc.holders.ByteHolder; import javax.xml.rpc.holders.ByteWrapperHolder; import javax.xml.rpc.holders.CalendarHolder; import javax.xml.rpc.holders.DoubleHolder; import javax.xml.rpc.holders.DoubleWrapperHolder; import javax.xml.rpc.holders.FloatHolder; import javax.xml.rpc.holders.FloatWrapperHolder; import javax.xml.rpc.holders.IntHolder; import javax.xml.rpc.holders.IntegerWrapperHolder; import javax.xml.rpc.holders.LongHolder; import javax.xml.rpc.holders.LongWrapperHolder; import javax.xml.rpc.holders.ObjectHolder; import javax.xml.rpc.holders.QNameHolder; import javax.xml.rpc.holders.ShortHolder; import javax.xml.rpc.holders.ShortWrapperHolder; import javax.xml.rpc.holders.StringHolder; import org.jboss.logging.Logger; import org.jboss.wsf.common.JavaUtils; /** * HolderUtils provides static utility functions for both JAX-RPC * and JAX-WS holders. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 22-Dec-2004 */ public class HolderUtils { private static final Logger log = Logger.getLogger(HolderUtils.class); /** True if the given type is a holder. */ public static boolean isHolderType(Class javaType) { return javax.xml.rpc.holders.Holder.class.isAssignableFrom(javaType) || javax.xml.ws.Holder.class.isAssignableFrom(javaType); } /** True if the given type is a holder. */ public static boolean isHolderType(Type javaType) { return isHolderType(JavaUtils.erasure(javaType)); } /** * Gets the JAX-RPC holder for a specific value type. * * @param valueType the value * @return the holder, or null if there is no match */ public static Class getJAXRPCHolderType(Class valueType) { if (valueType == null) throw new IllegalArgumentException("Illegal null parameter"); if (javax.xml.rpc.holders.Holder.class.isAssignableFrom(valueType)) throw new IllegalArgumentException("Is already a holder: " + valueType.getName()); if (valueType == BigDecimal.class) return BigDecimalHolder.class; if (valueType == BigInteger.class) return BigIntegerHolder.class; if (valueType == boolean.class) return BooleanHolder.class; if (valueType == Boolean.class) return BooleanWrapperHolder.class; if (valueType == byte[].class) return ByteArrayHolder.class; if (valueType == byte.class) return ByteHolder.class; if (valueType == Byte.class) return ByteWrapperHolder.class; if (valueType == Calendar.class) return CalendarHolder.class; if (valueType == double.class) return DoubleHolder.class; if (valueType == Double.class) return DoubleWrapperHolder.class; if (valueType == float.class) return FloatHolder.class; if (valueType == Float.class) return FloatWrapperHolder.class; if (valueType == int.class) return IntHolder.class; if (valueType == Integer.class) return IntegerWrapperHolder.class; if (valueType == long.class) return LongHolder.class; if (valueType == Long.class) return LongWrapperHolder.class; if (valueType == QName.class) return QNameHolder.class; if (valueType == short.class) return ShortHolder.class; if (valueType == Short.class) return ShortWrapperHolder.class; if (valueType == String.class) return StringHolder.class; if (valueType == Object.class) return ObjectHolder.class; log.warn("Cannot get holder type for: " + valueType); return null; } /** * Gets the value type of a JAX-WS or JAX-RPC holder. * * @param holderType the generic type for JAX-WS, a standard class for JAX-RPC * @return the value type */ public static Class getValueType(Type holderType) { Class holderClass = JavaUtils.erasure(holderType); boolean jaxrpcHolder = javax.xml.rpc.holders.Holder.class.isAssignableFrom(holderClass); boolean jaxwsHolder = javax.xml.ws.Holder.class.isAssignableFrom(holderClass); if (!jaxrpcHolder && !jaxwsHolder) throw new IllegalArgumentException("Is not a holder: " + holderClass.getName()); if (jaxwsHolder) return JavaUtils.erasure(getGenericValueType(holderType)); // Holder is supposed to have a public value field. Field field; try { field = holderClass.getField("value"); } catch (NoSuchFieldException e) { throw new IllegalArgumentException("Cannot find public value field: " + holderClass); } return field.getType(); } /** * Gets the value type of a JAX-RPC holder. Note this method should not be used * for JAX-WS, as a JAX-WS holder requires generic info. Instead, use the Type * version. * * @param holderType the generic type for JAX-WS, a standard class for JAX-RPC * @return the value type */ public static Class getValueType(Class holderClass) { boolean jaxrpcHolder = javax.xml.rpc.holders.Holder.class.isAssignableFrom(holderClass); boolean jaxwsHolder = javax.xml.ws.Holder.class.isAssignableFrom(holderClass); if (!jaxrpcHolder && !jaxwsHolder) throw new IllegalArgumentException("Is not a holder: " + holderClass.getName()); // No generic info if (jaxwsHolder) return Object.class; // Holder is supposed to have a public value field. Field field; try { field = holderClass.getField("value"); } catch (NoSuchFieldException e) { throw new IllegalArgumentException("Cannot find public value field: " + holderClass); } return field.getType(); } /** * Gets the value object of a JAX-WS or JAX-RPC holder instance. * * @param holder the holder object instance * @return the value object instance */ public static Object getHolderValue(Object holder) { if (holder == null) throw new IllegalArgumentException("Illegal null parameter"); if (!javax.xml.rpc.holders.Holder.class.isInstance(holder) && !javax.xml.ws.Holder.class.isInstance(holder)) throw new IllegalArgumentException("Is not a holder: " + holder); try { Field valueField = holder.getClass().getField("value"); Object obj = valueField.get(holder); return obj; } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new IllegalArgumentException("Cannot access public value field: " + holder); } } /** * Sets the value object of a JAX-WS or JAX-RPC holder instance. This method * will also dynamically convert primitive and wrapper arrays to match the * target array type. * * @param holder the holder instance * @param value the value, can be null */ public static void setHolderValue(Object holder, Object value) { if (holder == null) throw new IllegalArgumentException("Holder instance was null"); if (!javax.xml.rpc.holders.Holder.class.isInstance(holder) && !javax.xml.ws.Holder.class.isInstance(holder)) throw new IllegalArgumentException("Is not a holder: " + holder); Class valueType = getValueType(holder.getClass()); if (value != null && JavaUtils.isAssignableFrom(valueType, value.getClass()) == false) throw new IllegalArgumentException("Holder [" + holder.getClass().getName() + "] value not assignable: " + value); if (valueType.isArray()) value = JavaUtils.syncArray(value, valueType); try { Field valueField = holder.getClass().getField("value"); if (value != null || valueType.isPrimitive() == false) valueField.set(holder, value); } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new IllegalArgumentException("Cannot access public value field: " + holder); } } /** * Gets the generic value type of a JAX-WS Holder. * If there is no generic information, Object.class will be returned * * @param holder JAX-WS holder type * @return generic value type */ public static Type getGenericValueType(Type holder) { // For some reason the JDK 4 bytecode verifier trips up on this function if you use the ternary operator // The only difference between it and the working form here is the use of a goto instruction. JDK bug perhaps? if (holder instanceof ParameterizedType) return ((ParameterizedType)holder).getActualTypeArguments()[0]; return Object.class; } /** * Creates a JAX-WS or JAX-RPC holder instance. * * @param value the value instance * @param holderType the holder type * @return a new holder */ public static Object createHolderInstance(Object value, Class holderType) { if (! isHolderType(holderType)) throw new IllegalArgumentException("Not a holder type:" + holderType.getName()); Object holder; try { holder = holderType.newInstance(); } catch (RuntimeException rte) { throw rte; } catch (Exception e) { throw new IllegalArgumentException("Cannot instanciate holder: " + holderType); } setHolderValue(holder, value); return holder; } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/RoleSource.java0000644000175000017500000000255210576531706030072 0ustar godgod/* * 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.core; import java.util.Set; /** * RoleSource provides role information to the binding layer. * * @author Jason T. Greene * @version $Revision: 2630 $ */ public interface RoleSource { /** * Get the set of roles associate with this source. * * @return the set of roles */ Set getRoles(); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/EndpointInvocation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/EndpointInvocation.java0000644000175000017500000003412410650145103031603 0ustar godgod/* * 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.core; // $Id: EndpointInvocation.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.soap.AttachmentPart; import javax.xml.soap.SOAPException; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.jaxrpc.ParameterWrapping; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.utils.HolderUtils; import org.jboss.ws.core.utils.MimeUtils; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.WrappedParameter; import org.jboss.wsf.common.JavaUtils; import org.w3c.dom.Element; /** A web service invocation. * * @author Thomas.Diesler@jboss.org * @since 16-Oct-2004 */ public class EndpointInvocation { // provide logging private static final Logger log = Logger.getLogger(EndpointInvocation.class); // The operation meta data for this invocation private OperationMetaData opMetaData; // Map the named endpoint parameters private Map reqPayload = new LinkedHashMap(); // Map the named endpoint parameters private Map resPayload = new LinkedHashMap(); // The return value private Object returnValue; // Map of output parameters, key being the parameter index in the method signature private Map outParameters = new HashMap(); public EndpointInvocation(OperationMetaData opMetaData) { this.opMetaData = opMetaData; } public OperationMetaData getOperationMetaData() { return opMetaData; } public Method getJavaMethod() { return opMetaData.getJavaMethod(); } public Map getOutParameters() { return outParameters; } public List getRequestParamNames() { List xmlNames = new ArrayList(); xmlNames.addAll(reqPayload.keySet()); return xmlNames; } public void setRequestParamValue(QName xmlName, Object value) { if (log.isDebugEnabled()) log.debug("setRequestParamValue: [name=" + xmlName + ",value=" + getTypeName(value) + "]"); reqPayload.put(xmlName, value); } public Object getRequestParamValue(QName xmlName) { if (log.isDebugEnabled()) log.debug("getRequestParamValue: " + xmlName); Object paramValue = reqPayload.get(xmlName); ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName); try { paramValue = transformPayloadValue(paramMetaData, paramValue); } catch (SOAPException ex) { throw new WSException(ex); } return paramValue; } /** Returns the payload that can be passed on to the endpoint implementation */ public Object[] getRequestPayload() { log.debug("getRequestPayload"); List xmlNames = getRequestParamNames(); Object[] payload = new Object[opMetaData.getJavaMethod().getParameterTypes().length]; for (int i = 0; i < xmlNames.size(); i++) { QName xmlName = xmlNames.get(i); Object paramValue = getRequestParamValue(xmlName); ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName); syncEndpointInputParam(paramMetaData, paramValue, payload); } return payload; } public List getResponseParamNames() { List xmlNames = new ArrayList(); xmlNames.addAll(resPayload.keySet()); return xmlNames; } public void setResponseParamValue(QName xmlName, Object value) { if (log.isDebugEnabled()) log.debug("setResponseParamValue: [name=" + xmlName + ",value=" + getTypeName(value) + "]"); resPayload.put(xmlName, value); } public Object getResponseParamValue(QName xmlName) throws SOAPException { if (log.isDebugEnabled()) log.debug("getResponseParamValue: " + xmlName); Object paramValue = resPayload.get(xmlName); ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName); paramValue = transformPayloadValue(paramMetaData, paramValue); if (paramValue != null) { Class valueType = paramValue.getClass(); if (HolderUtils.isHolderType(valueType)) { paramValue = HolderUtils.getHolderValue(paramValue); } } return paramValue; } public void setReturnValue(Object value) { ParameterMetaData retMetaData = opMetaData.getReturnParameter(); if (value != null && retMetaData == null) throw new WSException("Operation does not have a return value: " + opMetaData.getQName()); if (log.isDebugEnabled()) log.debug("setReturnValue: " + getTypeName(value)); this.returnValue = value; } public Object getReturnValue() { if (log.isDebugEnabled()) log.debug("getReturnValue"); Object paramValue = returnValue; ParameterMetaData paramMetaData = opMetaData.getReturnParameter(); if (paramMetaData != null) { try { paramValue = transformPayloadValue(paramMetaData, paramValue); } catch (SOAPException ex) { throw new WSException(ex); } } return paramValue; } private Object transformPayloadValue(ParameterMetaData paramMetaData, final Object paramValue) throws SOAPException { QName xmlName = paramMetaData.getXmlName(); QName xmlType = paramMetaData.getXmlType(); Class javaType = paramMetaData.getJavaType(); String javaName = paramMetaData.getJavaTypeName(); if (xmlType == null) throw new IllegalStateException("Cannot obtain xml type for: [xmlName=" + xmlName + ",javaName=" + javaName + "]"); Object retValue = paramValue; // Handle attachment part if (paramValue instanceof AttachmentPart) { AttachmentPart part = (AttachmentPart)paramValue; Set mimeTypes = paramMetaData.getMimeTypes(); if (DataHandler.class.isAssignableFrom(javaType) && !javaType.equals(Object.class)) { DataHandler handler = part.getDataHandler(); String mimeType = MimeUtils.getBaseMimeType(handler.getContentType()); // JAX-WS 2.0, 2.6.3.1 MIME Content // Conformance (MIME type mismatch): On receipt of a message where the MIME type of a part does not // match that described in the WSDL an implementation SHOULD throw a WebServiceException. if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes)) log.warn("Mime type " + mimeType + " not allowed for parameter " + xmlName + " allowed types are " + mimeTypes); retValue = part.getDataHandler(); } else { retValue = part.getContent(); String mimeType = MimeUtils.getBaseMimeType(part.getContentType()); if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes)) throw new SOAPException("Mime type " + mimeType + " not allowed for parameter " + xmlName + " allowed types are " + mimeTypes); if (retValue != null) { Class valueType = retValue.getClass(); if (JavaUtils.isAssignableFrom(javaType, valueType) == false) throw new SOAPException("javaType [" + javaType.getName() + "] is not assignable from attachment content: " + valueType.getName()); } } } else if (paramValue instanceof SOAPContentElement) { // If this is bound to a SOAPElement, or Element, then we can return // the content element as is. // Note, that it is possible for a Java type to be bound to an any // type, so checking the xml type is not sufficient. if (!Element.class.isAssignableFrom(javaType)) { SOAPContentElement soapElement = (SOAPContentElement)paramValue; retValue = soapElement.getObjectValue(); } } if (log.isDebugEnabled()) log.debug("transformPayloadValue: " + getTypeName(paramValue) + " -> " + getTypeName(retValue)); return retValue; } /** Synchronize the operation IN, INOUT paramters with the call input parameters. * Essetially it unwrapps holders and converts primitives to wrapper types. */ public void initInputParams(Object[] inputParams) { for (ParameterMetaData paramMetaData : opMetaData.getParameters()) { int index = paramMetaData.getIndex(); // doc/lit wrapped return headers are OUT, so skip if (index < 0) continue; QName xmlName = paramMetaData.getXmlName(); Class javaType = paramMetaData.getJavaType(); Object value; if (opMetaData.isDocumentWrapped() && !paramMetaData.isInHeader() && !paramMetaData.isSwA()) { value = ParameterWrapping.wrapRequestParameters(paramMetaData, inputParams); } else { value = inputParams[index]; if (value != null) { Class inputType = value.getClass(); if (HolderUtils.isHolderType(inputType)) { // At runtime we lose the generic info for JAX-WS types, // So we use the actual instance type value = HolderUtils.getHolderValue(value); inputType = (value == null) ? null : value.getClass(); } // Verify that the java type matches a registered xmlType // Attachments are skipped because they don't use type mapping if (value != null && !paramMetaData.isSwA() && !paramMetaData.isXOP()) { if (JavaUtils.isAssignableFrom(javaType, inputType) == false) throw new WSException("Parameter '" + javaType + "' not assignable from: " + inputType); } } } setRequestParamValue(xmlName, value); } } /** * Synchronize the operation paramters with the endpoint method parameters */ private void syncEndpointInputParam(ParameterMetaData paramMetaData, final Object paramValue, Object[] payload) { Object retValue = paramValue; Method method = opMetaData.getJavaMethod(); Class[] targetParameterTypes = method.getParameterTypes(); if (opMetaData.isDocumentWrapped() && !paramMetaData.isInHeader() && !paramMetaData.isSwA() && !paramMetaData.isMessageType()) { outParameters = ParameterWrapping.unwrapRequestParameters(paramMetaData, paramValue, payload); syncOutWrappedParameters(targetParameterTypes, payload); } else { // Replace INOUT and OUT parameters by their respective holder values int index = paramMetaData.getIndex(); Class targetParameterType = targetParameterTypes[index]; if (paramMetaData.getMode() == ParameterMode.INOUT || paramMetaData.getMode() == ParameterMode.OUT) { retValue = HolderUtils.createHolderInstance(paramValue, targetParameterType); QName xmlName = paramMetaData.getXmlName(); setResponseParamValue(xmlName, retValue); } if (retValue != null) { Class valueType = retValue.getClass(); if (JavaUtils.isAssignableFrom(targetParameterType, valueType) == false) throw new WSException("Parameter " + targetParameterType.getName() + " is not assignable from: " + getTypeName(retValue)); if (valueType.isArray()) retValue = JavaUtils.syncArray(retValue, targetParameterType); } if (log.isDebugEnabled()) log.debug("syncEndpointInputParam: " + getTypeName(paramValue) + " -> " + getTypeName(retValue) + "(" + index + ")"); payload[index] = retValue; } } private void syncOutWrappedParameters(Class[] targetParameterTypes, Object[] payload) { ParameterMetaData returnMetaData = opMetaData.getReturnParameter(); if (returnMetaData != null) { for (WrappedParameter param : returnMetaData.getWrappedParameters()) { try { // only OUT parameters need to be initialized if (param.getIndex() >= 0 && !outParameters.containsKey(param.getIndex())) { Object holder = targetParameterTypes[param.getIndex()].newInstance(); payload[param.getIndex()] = holder; outParameters.put(param.getIndex(), holder); } } catch (Exception e) { throw new WSException("Could not add output param: " + param.getName(), e); } } } } private String getTypeName(Object value) { String valueType = (value != null ? value.getClass().getName() : null); return valueType; } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/HTTPMessageAbstraction.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/HTTPMessageAbstraction.0000644000175000017500000000227310604700017031405 0ustar godgod/* * 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.core; /** * A generic HTTP message * * @author Thomas.Diesler@jboss.com * @since 02-Apr-2007 */ public interface HTTPMessageAbstraction extends MessageAbstraction { } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/MessageAbstraction.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/MessageAbstraction.java0000644000175000017500000000277310605204260031554 0ustar godgod/* * 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.core; import java.io.IOException; import java.io.OutputStream; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MimeHeaders; /** * A generic message independent of the underlying protocol * * @author Thomas.Diesler@jboss.com * @since 02-Apr-2007 */ public interface MessageAbstraction { MimeHeaders getMimeHeaders(); void writeTo(OutputStream outputStream) throws IOException; boolean isFaultMessage(); void addAttachmentPart(AttachmentPart part); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/WSTimeoutException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/WSTimeoutException.java0000644000175000017500000000265210551451440031555 0ustar godgod/* * 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.core; /** * A RuntimeException that that indicates client timeout * * @author Thomas.Diesler@jboss.org * @since 06-Jan-2006 */ public class WSTimeoutException extends RuntimeException { private long timeout; public WSTimeoutException(String message, long timeout) { super(message); this.timeout = timeout; } public long getTimeout() { return timeout; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/DirectionHolder.java0000644000175000017500000000311110576111502031042 0ustar godgod/* * 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.core; // $Id:CommonClient.java 660 2006-08-01 16:29:43Z thomas.diesler@jboss.com $ /** * A holder for the message direction * * @author Thomas.Diesler@jboss.org * @since 14-Mar-2007 */ public class DirectionHolder { public enum Direction { InBound, OutBound } private Direction direction; public DirectionHolder(Direction direction) { this.direction = direction; } public Direction getDirection() { return direction; } public void setDirection(Direction direction) { this.direction = direction; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/0000755000175000017500000000000010755000267026073 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/0000755000175000017500000000000010755000266030222 5ustar godgod././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/MimeConstants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/MimeCon0000644000175000017500000000521210610374762031501 0ustar godgod/* * 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.core.soap.attachment; // $Id: MimeConstants.java 2860 2007-04-15 10:09:54Z thomas.diesler@jboss.com $ /** * Generic mime related constants. * * @author Jason T. Greene */ public class MimeConstants { // Header constants public static final String CONTENT_ID = "Content-Id"; public static final String CONTENT_TYPE = "Content-Type"; public static final String CONTENT_LOCATION = "Content-Location"; public static final String CONTENT_DESCRIPTION = "Content-Description"; public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding"; // Types public static final String TYPE_APPLICATION_OCTET_STREAM = "application/octet-stream"; public static final String TYPE_APPLICATION_XOP_XML = "application/xop+xml"; public static final String TYPE_MULTIPART_RELATED = "multipart/related"; public static final String TYPE_TEXT_XML = "text/xml"; public static final String TYPE_XML_UTF8 = TYPE_TEXT_XML + "; charset=UTF-8"; public static final String TYPE_SOAP11 = TYPE_TEXT_XML; public static final String TYPE_SOAP12 = "application/soap+xml"; // Encoding public static final String TEXT_8BIT_ENCODING = "8bit"; public static final String TEXT_7BIT_ENCODING = "7bit"; public static final String BINARY_ENCODING = "binary"; public static final String QUOTED_PRINTABLE_ENCODING = "quoted-printable"; public static final String BASE64_ENCODING = "base64"; // Misc public static final String CID_DOMAIN = "ws.jboss.org"; public static final String ROOTPART_CID = ""; public static final String START_INFO_XOP = "text/xml"; } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/BoundaryDelimitedInputStream.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/Boundar0000644000175000017500000002276010542776150031554 0ustar godgod/* * 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.core.soap.attachment; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; /** * BoundaryDelimitedInputStream encapsulates a stream that is * sepearated into different sections by a common boundary, such as a MIME * multipart message. The full stream is referred to as the outer stream. Each * boundary separated section in the outer stream is referred to as an inner * stream. * * All read() methods will start from the first inner stream, returning -1 when * a boundary is reached. Subsequent calls will then advance to the next stream, * skipping the boundary. * * @author Jason T. Greene */ public class BoundaryDelimitedInputStream extends FilterInputStream { private static final int BOUNDARY_NOT_FOUND = SimpleBoyerMoore.PATTERN_NOT_FOUND; private byte[] boundary; private SimpleBoyerMoore boyerMoore; private byte[] leftOvers; private int leftOverPosition; private InputStream source; private boolean simulateEof; private boolean realEof; private boolean bufferingCompleted; /** * Constructs a BoundaryDelimitedInputStream using the passed * InputStream as the source for the outer stream. * * @param in the source input stream * @param boundary the byte boundary separating sections of this stream */ public BoundaryDelimitedInputStream(InputStream in, byte[] boundary) { super(in); source = in; this.boundary = (byte[]) boundary.clone(); boyerMoore = new SimpleBoyerMoore(this.boundary); } /* * Buffers read-ahead data for future read calls. */ private void createLeftOvers(byte[] buffer, int start, int end) { int length = end - start; if (length <= 0) return; // If we are no longer buffering, we no longer have to expand the buffer, so we // can reuse it (if its still there, which may not be the case if a boundary was found // after the left over buffer was consumed) by just moving the position back. if (bufferingCompleted && leftOvers != null) { leftOverPosition -= length; return; } int leftOverLength = (leftOvers == null) ? 0 : leftOvers.length - leftOverPosition; byte[] newLeftOvers = new byte[length + leftOverLength]; System.arraycopy(buffer, start, newLeftOvers, 0, length); if (leftOvers != null) System.arraycopy(leftOvers, leftOverPosition, newLeftOvers, length, leftOverLength); leftOvers = newLeftOvers; leftOverPosition = 0; } /* * Reads from previous buffered read-ahead data */ private int consumeLeftOvers(byte[] buffer, int offset, int length) { if (leftOvers == null) return 0; int i = 0; while (i < length && leftOverPosition < leftOvers.length) { buffer[offset + i++] = leftOvers[leftOverPosition++]; } if (leftOverPosition >= leftOvers.length) { leftOvers = null; leftOverPosition = 0; } return i; } /* * Repeatably reaads from the source stream until the desired number of bytes * are returned. */ private int fullRead(byte[] buffer, int offset, int length) throws IOException { int count = 0; int read = 0; do { read = source.read(buffer, offset + count, length - count); if (read > 0) count += read; } while (read > 0 && count < length); if (read < 0) realEof = true; return count; } private int findBoundary(byte[] buffer, int length) { return boyerMoore.patternSearch(buffer, 0, length); } private int read(byte[] b, int off, int len, boolean skip) throws IOException { if (len == 0) return 0; if (simulateEof) { simulateEof = false; return -1; } if (realEof) { if (leftOvers == null) return -1; if (bufferingCompleted == false) { bufferingCompleted = true; } } // Our buffer must always contain room for 2 boundary string occurences, // and one of those boundary string size chunks must extend past the length // of the requested read size to insure the returned byte chunk contains // no potion of the boundary. int bufferLength = Math.max(boundary.length * 2, len + boundary.length); byte[] buffer = new byte[bufferLength]; int position = consumeLeftOvers(buffer, 0, bufferLength); if (position < bufferLength) position += fullRead(buffer, position, bufferLength - position); // This should only occur when the source stream is already closed at start if (realEof && position == 0) return -1; int returnLength; int boundaryPosition = findBoundary(buffer, position); if (boundaryPosition == BOUNDARY_NOT_FOUND || boundaryPosition >= len) { returnLength = Math.min(len, position); createLeftOvers(buffer, returnLength, position); } else { returnLength = boundaryPosition; createLeftOvers(buffer, returnLength + boundary.length, position); // If there is no data to return, send the eof immediately if (returnLength == 0) return -1; // Notify the client that this inner stream has ended by returning -1 on the // next read request. simulateEof = true; } if (! skip) System.arraycopy(buffer, 0, b, off, returnLength); return returnLength; } /** * This method will always return 0 because this input stream must * always read ahead to determine the location of the boundary. */ public int available() throws IOException { return 0; } /** * Close this input stream, and its source input stream. Once this * is called, no further data can be read. */ public void close() throws IOException { source.close(); leftOvers = null; leftOverPosition = 0; realEof = true; } /** * Returns false. Mark is not support by this input stream. */ public boolean markSupported() { return false; } /** * Reads a single byte from the inner input stream. See the general contract * of the read method of InputStream. * * @return a signle byte value from the stream in the range of 0-255 or -1 * on eof of the inner stream. */ public int read() throws IOException { byte[] b = new byte[1]; if (read(b) == -1) return -1; return b[0] & 0xff; } /** * Reads from the inner input stream, attempting to fill the passed byte array. * See the general contract of the read method of InputStream. * * @param b the byte array to populate * @return number of bytes returned in b, -1 on EOF */ public int read(byte[] b) throws IOException { return read(b, 0, b.length); } /** * Skips the specified number of bytes from the inner input stream. See the * general contract of the read method of InputStream. * * @param n the number of bytes to skip * @return the number of bytes actually skipped, -1 on EOF */ public long skip(long n) throws IOException { return read(null, 0, (int) n, true); } /** * Reads the specified number of bytes starting from the specified offset * into the specified buffer from the inner input stream. See the * general contract of the read method of InputStream. * * @param b the byte array to populate * @param off the offset in the array to start at * @param len the number of bytes to read, -1 on EOF */ public int read(byte[] b, int off, int len) throws IOException { return read(b, off, len, false); } /** * Returns whether the outer stream is closed. * * @return boolean indicating whether the outer stream is closed */ public boolean isOuterStreamClosed() { return realEof && leftOvers == null; } public void printLeftOvers() { if (leftOvers != null) System.out.println("LEFT = " + new String(leftOvers, leftOverPosition, leftOvers.length - leftOverPosition)); } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/Attachm0000644000175000017500000003510410704666467031550 0ustar godgod/* * 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.core.soap.attachment; import org.jboss.util.Base64; import org.jboss.wsf.common.IOUtils; import org.jboss.ws.WSException; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.mail.internet.MimeMultipart; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPException; import java.io.*; import java.util.Iterator; /** * Implementation of the AttachmentPart interface. * @see javax.xml.soap.AttachmentPart * * @author Jason T. Greene * @author Thomas.Diesler@jboss.org */ public class AttachmentPartImpl extends AttachmentPart { private MimeHeaders mimeHeaders = new MimeHeaders(); private DataHandler dataHandler; private String cachedContentId; private String cachedContentType; private String cachedContentLocation; static { // Load JAF content handlers ContentHandlerRegistry.register(); } public AttachmentPartImpl() { } public AttachmentPartImpl(DataHandler handler) { this.dataHandler = handler; } private void clearHeaderCache() { cachedContentId = null; cachedContentType = null; cachedContentLocation = null; } public void addMimeHeader(String name, String value) { clearHeaderCache(); mimeHeaders.addHeader(name, value); } public void clearContent() { dataHandler = null; } public Iterator getAllMimeHeaders() { clearHeaderCache(); return mimeHeaders.getAllHeaders(); } public Object getContent() throws SOAPException { if (dataHandler == null) throw new SOAPException("No content available"); try { return dataHandler.getContent(); } catch (IOException e) { throw new SOAPException(e); } } public DataHandler getDataHandler() throws SOAPException { if (dataHandler == null) throw new SOAPException("No data handler on attachment"); return dataHandler; } public Iterator getMatchingMimeHeaders(String[] names) { clearHeaderCache(); return mimeHeaders.getMatchingHeaders(names); } public String[] getMimeHeader(String name) { return mimeHeaders.getHeader(name); } /** * Returns the first occurence of a MIME header. * * @param header the mime header * @return the value of the first occurence of a MIME header */ public String getFirstMimeHeader(String header) { String[] values = mimeHeaders.getHeader(header.toLowerCase()); if ((values != null) && (values.length > 0)) { return values[0]; } return null; } public Iterator getNonMatchingMimeHeaders(String[] names) { clearHeaderCache(); return mimeHeaders.getNonMatchingHeaders(names); } public int getSize() throws SOAPException { if (dataHandler == null) return 0; try { // We may need to buffer the stream, otherwise an additional read may fail if((this.dataHandler.getDataSource() instanceof ByteArrayDataSource) == false) this.dataHandler = new DataHandler(new ByteArrayDataSource(dataHandler.getInputStream(), dataHandler.getContentType())); ByteArrayDataSource ds = (ByteArrayDataSource)this.dataHandler.getDataSource(); return ds.getSize(); } catch (IOException e) { throw new SOAPException(e); } } public void removeAllMimeHeaders() { clearHeaderCache(); mimeHeaders.removeAllHeaders(); } public void removeMimeHeader(String name) { clearHeaderCache(); mimeHeaders.removeHeader(name); } /** * Sets the content of this attachment part to that of the given Object and sets the value of the Content-Type header * to the given type. The type of the Object should correspond to the value given for the Content-Type. * This depends on the particular set of DataContentHandler objects in use. * * @param object the Java object that makes up the content for this attachment part * @param contentType the MIME string that specifies the type of the content * @throws IllegalArgumentException if the contentType does not match the type of the content object, * or if there was no DataContentHandler object for this content object */ public void setContent(Object object, String contentType) { // Override the content type if its a mime multipart object because we need to preserve // the all of the content type parameters if (object instanceof MimeMultipart) contentType = ((MimeMultipart)object).getContentType(); dataHandler = new DataHandler(object, contentType); setContentType(contentType); } public void setDataHandler(DataHandler dataHandler) { if (dataHandler == null) throw new IllegalArgumentException("Null data handler"); this.dataHandler = dataHandler; setContentType(dataHandler.getContentType()); } public void setMimeHeader(String name, String value) { clearHeaderCache(); mimeHeaders.setHeader(name, value); } public String getContentId() { if (cachedContentId == null) { cachedContentId = getFirstMimeHeader(MimeConstants.CONTENT_ID); } return cachedContentId; } public String getContentLocation() { if (cachedContentLocation == null) { cachedContentLocation = getFirstMimeHeader(MimeConstants.CONTENT_LOCATION); } return cachedContentLocation; } public String getContentType() { if (cachedContentType == null) { cachedContentType = getFirstMimeHeader(MimeConstants.CONTENT_TYPE); } return cachedContentType; } public void setContentId(String contentId) { setMimeHeader(MimeConstants.CONTENT_ID, contentId); cachedContentId = contentId; } public void setContentLocation(String contentLocation) { setMimeHeader(MimeConstants.CONTENT_LOCATION, contentLocation); cachedContentLocation = contentLocation; } public void setContentType(String contentType) { setMimeHeader(MimeConstants.CONTENT_TYPE, contentType); cachedContentType = contentType; } /** * Returns an InputStream which can be used to obtain the content of AttachmentPart as Base64 encoded character data, * this method would base64 encode the raw bytes of the attachment and return. * * @return an InputStream from which the Base64 encoded AttachmentPart can be read. * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error. * @since SAAJ 1.3 */ @Override public InputStream getBase64Content() throws SOAPException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { // TODO: we might skip the buffer and encode lazily IOUtils.copyStream(bout, getDataHandler().getInputStream()); String base64 = Base64.encodeBytes(bout.toByteArray()); return new ByteArrayInputStream(base64.getBytes()); } catch (IOException e) { throw new SOAPException(e); } } /** * Gets the content of this AttachmentPart object as an InputStream * as if a call had been made to getContent and no DataContentHandler * had been registered for the content-type of this AttachmentPart. * * Note that reading from the returned InputStream would result in consuming the data in the stream. * It is the responsibility of the caller to reset the InputStream appropriately before calling a Subsequent API. * If a copy of the raw attachment content is required then the getRawContentBytes() API should be used instead. * * @return an InputStream from which the raw data contained by the AttachmentPart can be accessed. * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error. * @since SAAJ 1.3 */ @Override public InputStream getRawContent() throws SOAPException { try { return getDataHandler().getInputStream(); } catch (IOException e) { throw new SOAPException(e); } } /** * Gets the content of this AttachmentPart object as a byte[] array as if a call had been * made to getContent and no DataContentHandler had been registered for the content-type of this AttachmentPart. * * @return a byte[] array containing the raw data of the AttachmentPart. * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error. * @since SAAJ 1.3 */ @Override public byte[] getRawContentBytes() throws SOAPException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { IOUtils.copyStream(bout, getDataHandler().getInputStream()); return bout.toByteArray(); } catch (IOException e) { throw new SOAPException(e); } } /** * Sets the content of this attachment part from the Base64 source InputStream * and sets the value of the Content-Type header to the value contained in contentType, * This method would first decode the base64 input and write the resulting raw bytes to the attachment. * * A subsequent call to getSize() may not be an exact measure of the content size. * * @param content the base64 encoded data to add to the attachment part * @param contentType the value to set into the Content-Type header * @throws SOAPException if an there is an error in setting the content * @throws NullPointerException if content is null * @since SAAJ 1.3 */ @Override public void setBase64Content(InputStream content, String contentType) throws SOAPException { if(null == content) throw new SOAPException("Content is null"); try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); IOUtils.copyStream(bout, content); content.close(); byte[] bytes = bout.toByteArray(); byte[] raw; try { // CTS passes contents that are not base64 encoded raw = Base64.decode(bytes, 0, bytes.length); } catch (Throwable e) { throw new SOAPException(e); } dataHandler = new DataHandler(new ByteArrayDataSource(raw, contentType)); setContentType(contentType); } catch (IOException e) { throw new SOAPException(e); } } /** * Sets the content of this attachment part to that contained by the InputStream content and sets the value of the Content-Type header to the value contained in contentType. * * A subsequent call to getSize() may not be an exact measure of the content size. * * @param content the raw data to add to the attachment part * @param contentType the value to set into the Content-Type header * @throws SOAPException if an there is an error in setting the content * @throws NullPointerException if content is null * @since SAAJ 1.3 */ @Override public void setRawContent(InputStream content, String contentType) throws SOAPException { if(null == content) throw new SOAPException("Content is null"); dataHandler = new DataHandler(new ByteArrayDataSource(content, contentType)); setContentType(contentType); } /** * Sets the content of this attachment part to that contained * by the byte[] array content and sets the value of the Content-Type * header to the value contained in contentType. * * @param content the raw data to add to the attachment part * @param contentType the value to set into the Content-Type header * @param offset the offset in the byte array of the content * @param len the number of bytes that form the content * @throws SOAPException if an there is an error in setting the content or content is null * @since SAAJ 1.3 */ @Override public void setRawContentBytes(byte[] content, int offset, int len, String contentType) throws SOAPException { setRawContent(new ByteArrayInputStream(content, offset, len), contentType); } class ByteArrayDataSource implements DataSource { private byte[] data; private String type; ByteArrayDataSource(InputStream is, String type) { this.type = type; try { ByteArrayOutputStream os = new ByteArrayOutputStream(); IOUtils.copyStream(os, is); data = os.toByteArray(); } catch (IOException ioex) { throw new WSException(ioex); } } ByteArrayDataSource(byte[] data, String type) { this.data = data; this.type = type; } ByteArrayDataSource(String data, String type) { try { this.data = data.getBytes("iso-8859-1"); } catch (UnsupportedEncodingException uex) { throw new WSException(uex); } this.type = type; } public InputStream getInputStream() throws IOException { if (data == null) throw new IOException("no data"); return new ByteArrayInputStream(data); } public OutputStream getOutputStream() throws IOException { throw new IOException("cannot do this"); } public String getContentType() { return type; } public String getName() { return "ByteArrayDataSource"; } public int getSize() { return this.data.length; } } }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/ContentHandlerRegistry.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/Content0000644000175000017500000000627510542776150031577 0ustar godgod/* * 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.core.soap.attachment; import java.awt.datatransfer.DataFlavor; import java.util.HashSet; import java.util.Iterator; import javax.activation.CommandMap; import javax.activation.DataContentHandler; import javax.activation.MailcapCommandMap; import com.sun.mail.handlers.multipart_mixed; import com.sun.mail.handlers.text_html; import com.sun.mail.handlers.text_plain; /** * ContentHandlerRegistry is responsible for registering * JBossWS data content handlers in JAF. * * @author Jason T. Greene */ public class ContentHandlerRegistry { private static final String JAF_CONTENT_HANDLER = "x-java-content-handler"; private static HashSet handlerRegistry = new HashSet(); static { addRegistryEntry(XmlDataContentHandler.class); addRegistryEntry(ImageDataContentHandler.class); addRegistryEntry(ByteArrayContentHandler.class); addRegistryEntry(text_plain.class); addRegistryEntry(text_html.class); addRegistryEntry(multipart_mixed.class); } private static void addRegistryEntry(Class contentHandler) { handlerRegistry.add(contentHandler); } private static void registerContentHandler(Class contentHandler) { DataContentHandler handler; MailcapCommandMap mailcap; try { mailcap = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); handler = (DataContentHandler) contentHandler.newInstance(); } catch (Exception e) { throw new RuntimeException("Can not register content handler:" + e.getMessage()); } DataFlavor[] flavors = handler.getTransferDataFlavors(); if (flavors == null) return; for (int i = 0; i < flavors.length; i++) { DataFlavor flavor = flavors[i]; String entry = flavor.getMimeType() + ";;" + JAF_CONTENT_HANDLER + "=" + contentHandler.getName(); mailcap.addMailcap(entry); } } /** * Loads all JBossWS content handlers. */ public static void register() { Iterator i = handlerRegistry.iterator(); while (i.hasNext()) registerContentHandler((Class) i.next()); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/MultipartRelatedEncoder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/Multipa0000644000175000017500000001106210542776150031566 0ustar godgod/* * 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.core.soap.attachment; //$Id: MultipartRelatedEncoder.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; import javax.activation.DataHandler; import javax.mail.MessagingException; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMultipart; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MimeHeader; import javax.xml.soap.SOAPException; import org.jboss.ws.core.soap.SOAPMessageImpl; /** * MultipartRelatedEncoder encodes a SOAPMessage * into a multipart/related stream. * * @author Thomas.Diesler@jboss.org * @since 17-Jan-2006 */ public abstract class MultipartRelatedEncoder { protected SOAPMessageImpl soapMessage; protected MimeMultipart multipart; public MultipartRelatedEncoder(SOAPMessageImpl soapMessage) throws SOAPException { this.soapMessage = soapMessage; } /** Build the multipart message */ public abstract void encodeMultipartRelatedMessage() throws SOAPException, MessagingException; protected void addAttachmentParts(MimeMultipart multipart) throws SOAPException, MessagingException { Iterator attachmentParts = soapMessage.getAttachments(); while (attachmentParts.hasNext()) { AttachmentPart attachmentPart = (AttachmentPart)attachmentParts.next(); DataHandler handler = attachmentPart.getDataHandler(); MimeBodyPart mimePart = new MimeBodyPart(); mimePart.setDataHandler(handler); Iterator mimeHeaders = attachmentPart.getAllMimeHeaders(); while (mimeHeaders.hasNext()) { MimeHeader soapHeader = (MimeHeader)mimeHeaders.next(); mimePart.addHeader(soapHeader.getName(), soapHeader.getValue()); } if (mimePart.getHeader(MimeConstants.CONTENT_TYPE) == null) { String type = handler.getContentType(); mimePart.setHeader(MimeConstants.CONTENT_TYPE, (type != null) ? type : MimeConstants.TYPE_APPLICATION_OCTET_STREAM); } if (mimePart.getHeader(MimeConstants.CONTENT_ID) == null) { CIDGenerator cidGenerator = soapMessage.getCidGenerator(); mimePart.setHeader(MimeConstants.CONTENT_ID, cidGenerator.generateFromCount()); } // TODO - Binary encoding is the most efficient, however, some transports (old mail servers) // require 7 bit ascii. Can we ask the remoting layer about the transport's binary safety? mimePart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING, MimeConstants.BINARY_ENCODING); multipart.addBodyPart(mimePart); } } /** * Returns the new content type of this encoder. This value must be specified * in the mime Content-type header in what ever way that the transport * requires it. * * @return the content type */ public String getContentType() { String contentType = multipart.getContentType(); return contentType; } /** * Writes this message to the specified output stream. * * @param os the stream to write this message */ public void writeTo(OutputStream os) throws IOException { if (multipart == null) throw new IOException("No data to write because encoding failed on construction"); try { // Ensure that the first boundary is always proceeded by CRLF os.write(13); os.write(10); multipart.writeTo(os); } catch (MessagingException e) { throw new IOException(e.getMessage()); } } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/SwapableMemoryDataSource.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/Swapabl0000644000175000017500000001341610704666467031562 0ustar godgod/* * 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.core.soap.attachment; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.DataSource; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.wsf.common.IOUtils; /** * A datasource which offloads large attachments to disk. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene */ public class SwapableMemoryDataSource implements DataSource { private static Logger log = Logger.getLogger(SwapableMemoryDataSource.class); private static final int BLOCK_SIZE = 32 * 1024; private static final int DEFAULT_MAX_MEMORY_SIZE = 64 * 1024; private static final String SWAP_PREFIX = "JBossWSattachment"; private static final String SWAP_SUFFIX = ".dat"; private File swapFile; private String contentType = MimeConstants.TYPE_APPLICATION_OCTET_STREAM; private byte[] content; private int contentLength; private int maxMemorySize = 64 * 1024; /** * Constructs a SwapableMemoryDataSource from inputStream, and contentType. * The instance then reads from the input stream, and stores it in memory unless the size * of the content is larger that 64KB, at whichpoint the stream is stored in a temporary * file on disk. * * @param inputStream the stream to read from * @param contentType the content type of this stream */ public SwapableMemoryDataSource(InputStream inputStream, String contentType) throws IOException { this(inputStream, contentType, DEFAULT_MAX_MEMORY_SIZE); } /** * Constructs a SwapableMemoryDataSource from inputStream, and * contentType. The instance then reads from the input stream, and stores it * in memory unless the size of the content is larger than maxMemorySize, at * whichpoint the stream is stored in a temporary file on disk. * * @param inputStream the stream to read from * @param contentType the content type of this stream * @param maxMemorySize the maximum size in bytes that this data source is * allowed to allocate for stream storage */ public SwapableMemoryDataSource(InputStream inputStream, String contentType, int maxMemorySize) throws IOException { if (contentType != null) this.contentType = contentType; this.maxMemorySize = maxMemorySize; load(inputStream); } private void load(InputStream inputStream) throws IOException { RawByteArrayOutputStream rbaos = new RawByteArrayOutputStream(); OutputStream os = rbaos; byte[] buffer = new byte[BLOCK_SIZE]; int count = inputStream.read(buffer); while (count > 0) { os.write(buffer, 0, count); if (rbaos != null && rbaos.size() > maxMemorySize) { File tmpdir = IOUtils.createTempDirectory(); swapFile = File.createTempFile(SWAP_PREFIX, SWAP_SUFFIX, tmpdir); swapFile.deleteOnExit(); os = new FileOutputStream(swapFile); rbaos.writeTo(os); rbaos = null; } count = inputStream.read(buffer); } os.flush(); os.close(); if (rbaos == null) { if(log.isDebugEnabled()) log.debug("Using swap file, location = " + swapFile.toURL() + " size = " + swapFile.length()); } else { contentLength = rbaos.size(); if(log.isDebugEnabled()) log.debug("Using memory buffer, size = " + contentLength); content = rbaos.getBytes(); } } protected void finalize() throws Throwable { super.finalize(); cleanup(); } public void cleanup() { if (swapFile != null) swapFile.delete(); } /** * Returns the content type of this data source. * * @return the content type */ public String getContentType() { return contentType; } /** * Returns a new input stream on this data source. Multiple calls * are allowed because the data is stored. * * @return a new input stream at the start of the data */ public InputStream getInputStream() throws IOException { if (content != null) return new ByteArrayInputStream(content, 0, contentLength); if (swapFile != null) return new FileInputStream(swapFile); throw new WSException("No content available"); } /** * This method always returns null. * * @return null */ public String getName() { return null; } /** * This method always returns null. * * @return null */ public OutputStream getOutputStream() throws IOException { return null; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/XmlDataContentHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/XmlData0000644000175000017500000000766610650145103031510 0ustar godgod/* * 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.core.soap.attachment; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.ActivationDataFlavor; import javax.activation.DataContentHandler; import javax.activation.DataSource; import javax.xml.transform.stream.StreamSource; import org.jboss.wsf.common.IOUtils; /** * XmlDataContentHandler is a JAF content handler that provides * marchalling/unmarshalling between a StreamSource and a generic * stream. * * @author Jason T. Greene */ public class XmlDataContentHandler implements DataContentHandler { private DataFlavor[] flavors = new ActivationDataFlavor[] { new ActivationDataFlavor(StreamSource.class, "text/xml", "XML"), new ActivationDataFlavor(StreamSource.class, "application/xml", "XML") }; /** * Returns a {@link StreamSource} from the specified * data source. * * @param ds the activation datasource * @return an XML stream source */ public Object getContent(DataSource ds) throws IOException { return new StreamSource(ds.getInputStream()); } /** * Returns a {@link StreamSource} from the specified * data source. The flavor must be one of the ones returned by {@link #getTransferDataFlavors()}. * * @param df the flavor specifiying the mime type of ds * @param ds the activation data source * @return an XML stream source */ public Object getTransferData(DataFlavor df, DataSource ds) throws UnsupportedFlavorException, IOException { return getContent(ds); } /** * Returns the acceptable data flavors that this content handler supports. * * @return array of ActivationDataHandlers */ public DataFlavor[] getTransferDataFlavors() { return flavors; } /** * Writes the passed in {@link StreamSource} object using the specified * mime type to the specified output stream. The mime type must be text/xml. * * @param obj an XML stream source * @param mimeType the string "text/xml" * @param os the output stream to write this xml stream to */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (! mimeType.startsWith(MimeConstants.TYPE_TEXT_XML) && ! mimeType.startsWith("application/xml")) throw new IOException("Expected text/xml or application/xml, got " + mimeType); if (! (obj instanceof StreamSource)) throw new IOException("XML Content handler only supports a StreamSource content object"); // TODO - add support for reader source InputStream stream = ((StreamSource) obj).getInputStream(); if (stream != null) { IOUtils.copyStream(os, stream); } else { IOUtils.copyReader(os, ((StreamSource) obj).getReader()); } } }././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/CIDGenerator.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/CIDGene0000644000175000017500000000472210573561007031353 0ustar godgod/* * 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.core.soap.attachment; //$Id: CIDGenerator.java 2546 2007-03-07 16:02:15Z heiko.braun@jboss.com $ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import org.jboss.logging.Logger; import org.jboss.ws.core.utils.UUIDGenerator; /** * A common CID generator * * @author Thomas.Diesler@jboss.org * @since 17-Jan-2006 */ public class CIDGenerator { // provide logging private static Logger log = Logger.getLogger(CIDGenerator.class); private int count = 0; public String generateFromCount() { StringBuilder cid = new StringBuilder(); long time = System.currentTimeMillis(); cid.append(count++).append("-").append(time).append("-") .append(cid.hashCode()).append("@").append(MimeConstants.CID_DOMAIN); if(log.isDebugEnabled()) log.debug("generateFromCount: " + cid); return cid.toString(); } public String generateFromName(String name) { // See http://www.ietf.org/rfc/rfc2392.txt on rules howto create cid's // TODO: URL decode when cid's are received try { name = URLEncoder.encode(name, "UTF-8"); } catch (UnsupportedEncodingException ex) { log.error("Cannot encode name for cid: " + ex); } String cid = name + "-" + UUIDGenerator.generateRandomUUIDString() + "@" + MimeConstants.CID_DOMAIN; if(log.isDebugEnabled()) log.debug("generateFromName: " + cid); return cid; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/ImageDataContentHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/ImageDa0000644000175000017500000001531210542776150031444 0ustar godgod/* * 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.core.soap.attachment; import java.awt.Component; import java.awt.Graphics2D; import java.awt.Image; import java.awt.MediaTracker; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.Iterator; import javax.activation.ActivationDataFlavor; import javax.activation.DataContentHandler; import javax.activation.DataSource; import javax.imageio.ImageIO; import javax.imageio.ImageWriter; import javax.imageio.stream.ImageOutputStream; import org.jboss.logging.Logger; /** * ImageDataContentHandler is a JAF content handler that handles * marshalling/unmarshalling between Image objects and a stream. * * This handler provides support for all mime types handled by the ImageIO * implementation on the virtual machine that this class is ran under. These * are dynamically registered, so any custom ImageIO plugins are discovered and * used. * * It's important to note that some mime types (for example image/gif) may not * have encoding support provided by the ImageIO implementation. If this happens * an exception will be thrown indicating the lack of encoding support. * * @author Jason T. Greene * @author Magesh Kumar B */ public class ImageDataContentHandler extends Component implements DataContentHandler { // provide logging private static Logger log = Logger.getLogger(ImageDataContentHandler.class); private static DataFlavor[] flavors; static { buildFlavors(); // Don't write back to disk since the images are in memory anyways ImageIO.setUseCache(false); } private static void buildFlavors() { String[] mimeTypes = ImageIO.getReaderMIMETypes(); if (mimeTypes == null) return; ArrayList flavs = new ArrayList (); DataFlavor flavor; //flavors = new DataFlavor[mimeTypes.length]; for (int i = 0; i < mimeTypes.length; i++) { try { flavor = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image"); flavs.add(flavor); } catch (IllegalArgumentException iae) { //This mime type is not supported log.warn("Unsupported MIME Type '" + mimeTypes[i] +"'"); } } int size = flavs.size(); flavors = new DataFlavor[size]; for (int i = 0; i < size; i++) { flavors[i] = (ActivationDataFlavor)flavs.get(i); } } private static ImageWriter getImageWriter(String mimeType) { Iterator i = ImageIO.getImageWritersByMIMEType(mimeType); if (! i.hasNext()) return null; return (ImageWriter) i.next(); } private BufferedImage getBufferedImage(Image image) throws IOException { if (image instanceof BufferedImage) return (BufferedImage) image; try { BufferedImage buffered; MediaTracker tracker = new MediaTracker(this); tracker.addImage(image, 0); tracker.waitForAll(); buffered = new BufferedImage(image.getHeight(null), image.getWidth(null), BufferedImage.TYPE_INT_RGB); Graphics2D gfx = buffered.createGraphics(); gfx.drawImage(image, 0, 0, null); return buffered; } catch (InterruptedException e) { throw new IOException("Could not convert image " + e.getMessage()); } } /** * Returns a {@link Image} from the specified * data source. * * @param ds the activation datasource * @return an AWT image object */ public Object getContent(DataSource ds) throws IOException { return ImageIO.read(ds.getInputStream()); } /** * Returns a {@link Image}from the specified data source. This method is * useless for this content handler because the image format is dynamically * discovered. * * @param df the flavor specifiying the mime type of ds * @param ds the activation data source * @return an AWT image object */ public Object getTransferData(DataFlavor df, DataSource ds) throws UnsupportedFlavorException, IOException { return getContent(ds); } /** * Returns the acceptable data flavors that this content handler supports. * * @return array of ActivationDataHandlers */ public DataFlavor[] getTransferDataFlavors() { return flavors; } /** * Writes the passed in {@link Image} object using the specified * mime type to the specified output stream. * * @param obj an AWT image object * @param mimeType the mime type of the image format to use * @param os the output stream to write this image to */ public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { if (obj == null) throw new IOException("Cannot write null source object"); if (!(obj instanceof Image)) throw new IOException("Requires the source object to be a java.awt.Image but is: " + obj.getClass().getName()); ImageWriter writer = getImageWriter(mimeType); if (writer == null) throw new IOException("Image encoding not available for mime type " + mimeType + " on this vm"); BufferedImage buffered = getBufferedImage((Image) obj); ImageOutputStream stream = ImageIO.createImageOutputStream(os); writer.setOutput(stream); writer.write(buffered); // We must close the stream now because if we are wrapping a ServletOutputStream, // a future gc can commit a stream that used in another thread (very very bad) stream.flush(); stream.close(); } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/MultipartRelatedXOPEncoder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/Multipa0000644000175000017500000000665510542776150031602 0ustar godgod/* * 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.core.soap.attachment; import java.io.OutputStream; import javax.mail.MessagingException; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMultipart; import javax.mail.internet.ParameterList; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import org.jboss.ws.core.soap.SOAPElementImpl; import org.jboss.ws.core.soap.SOAPElementWriter; import org.jboss.ws.core.soap.SOAPMessageImpl; /** * MultipartRelatedEncoder encodes a SOAPMessage * into a multipart/related stream. * * @author Thomas.Diesler@jboss.org * @since 17-Jan-2006 */ public class MultipartRelatedXOPEncoder extends MultipartRelatedEncoder { /** * Construct a MultipartRelatedEncoder from the specified SOAPMessage. * There is minimal overhead on construction because all source streams are read * only on a call to {@link #writeTo(OutputStream)}. * * @param soapMessage the SOAP message to be sent as a root part */ public MultipartRelatedXOPEncoder(SOAPMessageImpl soapMessage) throws SOAPException { super(soapMessage); } public void encodeMultipartRelatedMessage() throws SOAPException, MessagingException { ParameterList p = new ParameterList(); p.set("type", MimeConstants.TYPE_APPLICATION_XOP_XML); p.set("start", MimeConstants.ROOTPART_CID); p.set("start-info", MimeConstants.START_INFO_XOP); MimeMultipart multipart = new MimeMultipart("related" + p); MimeBodyPart rootPart = new MimeBodyPart(); /* * TODO - For now we build the root part content from a serialized string of the * DOM tree, in the future, this should utilize a DataHandler, and a DataContentHandler * to marshall the message. In this way the root part can be lazily written to the output * stream. */ SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope(); String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, false); rootPart.setText(envStr, "UTF-8"); rootPart.setContentID(MimeConstants.ROOTPART_CID); rootPart.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_APPLICATION_XOP_XML + "; type=\"text/xml\""); rootPart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING, MimeConstants.TEXT_8BIT_ENCODING); multipart.addBodyPart(rootPart); addAttachmentParts(multipart); this.multipart = multipart; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/MultipartRelatedDecoder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/Multipa0000644000175000017500000001722210642000211031545 0ustar godgod/* * 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.core.soap.attachment; // $Id: MultipartRelatedDecoder.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; import java.io.UnsupportedEncodingException; import java.util.Collection; import java.util.Enumeration; import java.util.LinkedList; import javax.activation.DataHandler; import javax.mail.Header; import javax.mail.MessagingException; import javax.mail.internet.ContentType; import javax.mail.internet.InternetHeaders; import javax.mail.internet.ParseException; import javax.xml.soap.AttachmentPart; import org.jboss.ws.WSException; /** * Abstract MutilPartRelatedDecoder decodes a mime multipart/related stream. * * @author Jason T. Greene * @author Thomas.Diesler@jboss.org * @since 18-Jan-2006 */ public class MultipartRelatedDecoder { private ContentType contentType; private String rootType; private AttachmentPartImpl rootPart; private LinkedList relatedParts = new LinkedList(); /** * Constructs a MultipartRelatedDecoder. This will block until the message * has been decoded. * * @param contentType the mime Content-Type header provided by the transport * @param stream The stream to pull the multipart message from */ public MultipartRelatedDecoder(ContentType contentType) throws IOException, MessagingException { this.contentType = contentType; if (MimeConstants.TYPE_MULTIPART_RELATED.equalsIgnoreCase(contentType.getBaseType()) == false) throw new IllegalArgumentException("Multipart related decoder called with a non-multipart/related type"); rootType = contentType.getParameter("type"); if (rootType == null) throw new IllegalArgumentException("multipart/related type is invalid, it is missing the root type parameter"); } private boolean isValidRootType(String type) throws ParseException { // The type multipart/related parameter can not have parameters itself ContentType contentType = new ContentType(type); type = contentType.getBaseType(); return rootType.equals(type); } public void decodeMultipartRelatedMessage(InputStream stream) throws IOException, MessagingException { String boundaryParameter = contentType.getParameter("boundary"); String start = contentType.getParameter("start"); byte[] boundary; byte[] crlf; if (boundaryParameter == null) throw new IllegalArgumentException("multipart/related content type did not contain a boundary"); try { // [JBWS-1393] - Problem interpreting messages with attachment when confronted with no header if (start == null) boundary = ("--" + boundaryParameter).getBytes("US-ASCII"); else boundary = ("\r\n--" + boundaryParameter).getBytes("US-ASCII"); crlf = ("\r\n").getBytes("US-ASCII"); } catch (UnsupportedEncodingException e) { throw new WSException("US-ASCII not supported, this should never happen"); } // [JBWS-1620] - Incorrect handling of MIME boundaries in MultipartRelatedDecoder PushbackInputStream pushBackStream = new PushbackInputStream(stream,2); pushBackStream.unread(crlf); BoundaryDelimitedInputStream delimitedStream = new BoundaryDelimitedInputStream(pushBackStream, boundary); // Eat first inner stream since its empty byte[] buffer = new byte[256]; while (delimitedStream.read(buffer) != -1) { } while (!delimitedStream.isOuterStreamClosed()) { // If the stream is empty or an end marker is reached, skip to the next // one if (!advanceToHeaders(delimitedStream)) continue; InternetHeaders headers = new InternetHeaders(delimitedStream); String typeHeader[] = headers.getHeader(MimeConstants.CONTENT_TYPE); if (typeHeader == null) throw new IllegalArgumentException("multipart/related stream invalid, component Content-type missing."); SwapableMemoryDataSource source = new SwapableMemoryDataSource(delimitedStream, typeHeader[0]); AttachmentPartImpl part = new AttachmentPartImpl(new DataHandler(source)); Enumeration enumeration = headers.getAllHeaders(); while (enumeration.hasMoreElements()) { Header header = (Header)enumeration.nextElement(); part.addMimeHeader(header.getName(), header.getValue()); } // The root part is either the one pointed to by the start parameter, or // the first occuring part if start is not defined. if (rootPart == null && (start == null || start.equals(part.getContentId()))) { if (isValidRootType(part.getContentType()) == false) throw new IllegalArgumentException("multipart/related type specified a root type other than the one" + " that was found."); rootPart = part; } else { relatedParts.add(part); } } if (rootPart == null) throw new IllegalArgumentException("multipart/related stream invalid, no root part was found"); } private boolean advanceToHeaders(InputStream stream) throws IOException { boolean dash = false, cr = false; while (true) { int b = stream.read(); switch (b) { case -1: return false; case '\r': cr = true; dash = false; break; case '-': if (dash == true) { // Two dashes indicate no further content stream.close(); return false; } dash = true; cr = false; break; case '\n': if (cr == true) return true; dash = false; break; default: dash = false; cr = false; } } } /** * Returns an AttachmentPart representing the root part of this multipart/related message. * * @return the root part of this multipart/related message */ public AttachmentPart getRootPart() { return rootPart; } /** * Returns a collection of AttachmentPart objects that represent the attachments on this message. * If there are no attachments, an empty collection is returned. */ public Collection getRelatedParts() { return relatedParts; } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/MultipartRelatedSwAEncoder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/Multipa0000644000175000017500000000646010542776150031574 0ustar godgod/* * 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.core.soap.attachment; import java.io.OutputStream; import javax.mail.MessagingException; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMultipart; import javax.mail.internet.ParameterList; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import org.jboss.ws.core.soap.SOAPElementImpl; import org.jboss.ws.core.soap.SOAPElementWriter; import org.jboss.ws.core.soap.SOAPMessageImpl; /** * MultipartRelatedEncoder encodes a SOAPMessage * into a multipart/related stream. * * @author Jason T. Greene */ public class MultipartRelatedSwAEncoder extends MultipartRelatedEncoder { /** * Construct a MultipartRelatedEncoder from the specified SOAPMessage. * There is minimal overhead on construction because all source streams are read * only on a call to {@link #writeTo(OutputStream)}. * * @param soapMessage the SOAP message to be sent as a root part */ public MultipartRelatedSwAEncoder(SOAPMessageImpl soapMessage) throws SOAPException { super(soapMessage); } public void encodeMultipartRelatedMessage() throws SOAPException, MessagingException { ParameterList p = new ParameterList(); p.set("type", MimeConstants.TYPE_TEXT_XML); p.set("start", MimeConstants.ROOTPART_CID); MimeMultipart multipart = new MimeMultipart("related" + p); MimeBodyPart rootPart = new MimeBodyPart(); /* * TODO - For now we build the root part content from a serialized string of the * DOM tree, in the future, this should utilize a DataHandler, and a DataContentHandler * to marshall the message. In this way the root part can be lazily written to the output * stream. */ SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope(); String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, false); rootPart.setText(envStr, "UTF-8"); rootPart.setContentID(MimeConstants.ROOTPART_CID); rootPart.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_XML_UTF8); rootPart.setHeader(MimeConstants.CONTENT_TRANSFER_ENCODING, MimeConstants.TEXT_8BIT_ENCODING); multipart.addBodyPart(rootPart); addAttachmentParts(multipart); this.multipart = multipart; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/RawByteArrayOutputStream.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/RawByte0000644000175000017500000000253010542776150031530 0ustar godgod/* * 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.core.soap.attachment; import java.io.ByteArrayOutputStream; /** * Extension of ByteArrayOutputStream that provides access to buf, saving a copy. * * @author Jason T. Greene */ public class RawByteArrayOutputStream extends ByteArrayOutputStream { public byte[] getBytes() { return buf; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/ByteArrayContentHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/ByteArr0000644000175000017500000000535010650145103031512 0ustar godgod/* * 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.core.soap.attachment; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.OutputStream; import javax.activation.ActivationDataFlavor; import javax.activation.DataContentHandler; import javax.activation.DataHandler; import javax.activation.DataSource; import org.jboss.ws.core.utils.MimeUtils; import org.jboss.wsf.common.IOUtils; /** * @author Heiko Braun * @version $Id: ByteArrayContentHandler.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ * @since Jul 31, 2006 */ public class ByteArrayContentHandler implements DataContentHandler { private DataFlavor[] flavors = new ActivationDataFlavor[] { new ActivationDataFlavor(ByteArrayInputStream.class, "application/octet-stream", "OCTETS"), }; public Object getContent(DataSource dataSource) throws IOException { return dataSource.getInputStream(); } public Object getTransferData(DataFlavor dataFlavor, DataSource dataSource) throws UnsupportedFlavorException, IOException { return getContent(dataSource); } public DataFlavor[] getTransferDataFlavors() { return flavors; } public void writeTo(Object object, String string, OutputStream outputStream) throws IOException { if(object instanceof byte[]) { outputStream.write((byte[])object); } else if(object instanceof DataHandler) { IOUtils.copyStream(outputStream, ((DataHandler)object).getInputStream()); } else { MimeUtils.ByteArrayConverter converter = MimeUtils.getConverterForJavaType(object.getClass()); converter.writeTo(object, outputStream); } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/SimpleBoyerMoore.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/attachment/SimpleB0000644000175000017500000000642510542776150031515 0ustar godgod/* * 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.core.soap.attachment; /** * SimpleBoyerMoore is an implementation of the simplified * version of the Boyer-Moore pattern search algorithm. This just means that the * "good match" portion of the algorithm is removed, which improves the * performance of non repeating patterns with the obvious side-effect of * reducing repeating pattern performance (e.g. gaggaggaaaggaggaagagaggaga). * * This version of the algorithm performs incredibly well if the pattern is * rare, for example a MIME boundary. * * This algorithm is binary safe. * * @author Jason T. Greene */ public class SimpleBoyerMoore { private int[] badMatch = new int[256]; private byte[] pattern; public static final int PATTERN_NOT_FOUND = -1; /** * Constructs a SimpleBoyerMoore instance. This internally * stores the pattern so that the same instance can be used across several * searches. * * @param pattern the pattern to search for */ public SimpleBoyerMoore(byte[] pattern) { this.pattern = pattern; precomputeBadMatchTable(); } private void precomputeBadMatchTable() { java.util.Arrays.fill(badMatch, pattern.length); for (int i = 0; i < pattern.length - 1; i++) { badMatch[pattern[i] & 0xff] = pattern.length - i - 1; } } /** * Find an occurence of the search pattern within text. * * @param text a byte array of data to seach * @param offset the index in text to start searching from * @param length the maximum number of bytes to search * * @return if a match is found, the index of text where the patter occurs, * otherwise {@link #PATTERN_NOT_FOUND} */ public int patternSearch(byte[] text, int offset, int length) { if (pattern.length > length) { return PATTERN_NOT_FOUND; } int i = 0, j = 0, k = 0; int end = offset + length; for (i = offset + pattern.length - 1; i < end; i += badMatch[text[i] & 0xff]) { for (j = pattern.length - 1, k = i; (j >= 0) && (text[k] == pattern[j]); j--) { k--; } if (j == -1) { return k + 1; } } return PATTERN_NOT_FOUND; } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPPartImpl.java0000644000175000017500000003625210654321205031155 0ustar godgod/* * 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.core.soap; // $Id: SOAPPartImpl.java 4081 2007-08-02 09:23:17Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamSource; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.wsf.spi.util.ServiceLoader; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import org.w3c.dom.UserDataHandler; /** An implementation of SOAPPart. * * * @author Thomas.Diesler@jboss.org */ public class SOAPPartImpl extends SOAPPart { // provide logging private static Logger log = Logger.getLogger(SOAPPartImpl.class); private SOAPMessage soapMessage; private SOAPEnvelope soapEnvelope; private SOAPDocument doc = new SOAPDocument(); SOAPPartImpl(SOAPMessage message) { this.soapMessage = message; } public SOAPMessage getSOAPMessage() { return soapMessage; } public SOAPEnvelope getEnvelope() throws SOAPException { return soapEnvelope; } public void setEnvelope(SOAPEnvelope soapEnvelope) { this.soapEnvelope = soapEnvelope; } public void removeMimeHeader(String s) { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); mimeHeaders.removeHeader(s); } public void removeAllMimeHeaders() { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); mimeHeaders.removeAllHeaders(); } public String[] getMimeHeader(String name) { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); return mimeHeaders.getHeader(name); } public void setMimeHeader(String name, String value) { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); mimeHeaders.setHeader(name, value); } public void addMimeHeader(String name, String value) { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); mimeHeaders.addHeader(name, value); } public Iterator getAllMimeHeaders() { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); return mimeHeaders.getAllHeaders(); } public Iterator getMatchingMimeHeaders(String names[]) { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); return mimeHeaders.getMatchingHeaders(names); } public Iterator getNonMatchingMimeHeaders(String names[]) { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); return mimeHeaders.getNonMatchingHeaders(names); } public void setContent(Source source) throws SOAPException { // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope. // Specifically, the HTTP response entity-body must be empty. if (source == null) { if(log.isDebugEnabled()) log.debug("Setting content source to null removes the SOAPEnvelope"); soapEnvelope = null; return; } // Start with a fresh soapMessage /*MessageFactory mf = MessageFactory.newInstance(); soapMessage = mf.createMessage(); soapMessage.getSOAPHeader().detachNode();*/ if (source instanceof DOMSource) { Element domElement; DOMSource domSource = (DOMSource)source; Node node = domSource.getNode(); if (node instanceof Document) domElement = ((Document)node).getDocumentElement(); else if (node instanceof Element) domElement = (Element)node; else throw new SOAPException("Unsupported DOMSource node: " + node); EnvelopeBuilder envBuilder = (EnvelopeBuilder) ServiceLoader.loadService(EnvelopeBuilder.class.getName(), EnvelopeBuilderDOM.class.getName()); envBuilder.setStyle(Style.DOCUMENT); envBuilder.build(soapMessage, domElement); } else if (source instanceof StreamSource) { try { StreamSource streamSource = (StreamSource)source; EnvelopeBuilder envBuilder = (EnvelopeBuilder)ServiceLoader.loadService(EnvelopeBuilder.class.getName(), EnvelopeBuilderDOM.class.getName()); envBuilder.setStyle(Style.DOCUMENT); InputStream stream = streamSource.getInputStream(); Reader reader = streamSource.getReader(); if (stream != null) envBuilder.build(soapMessage, stream, false); else if (reader != null) envBuilder.build(soapMessage, reader, false); } catch (IOException e) { throw new SOAPException("Cannot parse stream source", e); } } else { throw new SOAPException("Unsupported source parameter: " + source); } } public Source getContent() throws SOAPException { return new DOMSource(soapEnvelope); } // Document ********************************************************************************************************* public DOMImplementation getImplementation() { return doc.getImplementation(); } public DocumentFragment createDocumentFragment() { return doc.createDocumentFragment(); } public DocumentType getDoctype() { return doc.getDoctype(); } public Element getDocumentElement() { return soapEnvelope; } public Attr createAttribute(String name) throws DOMException { return doc.createAttribute(name); } public CDATASection createCDATASection(String data) throws DOMException { return doc.createCDATASection(data); } public Comment createComment(String data) { return doc.createComment(data); } public Element createElement(String tagName) throws DOMException { return doc.createElement(tagName); } public Element getElementById(String elementId) { return doc.getElementById(elementId); } public EntityReference createEntityReference(String name) throws DOMException { return doc.createEntityReference(name); } public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep) throws DOMException { return doc.importNode(importedNode, deep); } public NodeList getElementsByTagName(String tagname) { return doc.getElementsByTagName(tagname); } public Text createTextNode(String data) { return doc.createTextNode(data); } public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { return doc.createAttributeNS(namespaceURI, qualifiedName); } public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { return doc.createElementNS(namespaceURI, qualifiedName); } public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { return doc.getElementsByTagNameNS(namespaceURI, localName); } public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException { return doc.createProcessingInstruction(target, data); } // Node ********************************************************************************************************* public org.w3c.dom.Node appendChild(org.w3c.dom.Node node) throws DOMException { throw new NotImplementedException(); } public org.w3c.dom.Node cloneNode(boolean b) { throw new NotImplementedException(); } public NamedNodeMap getAttributes() { throw new NotImplementedException(); } public NodeList getChildNodes() { List list = new ArrayList(); if (soapEnvelope != null) { list.add((NodeImpl)soapEnvelope); } return new NodeListImpl(list); } public org.w3c.dom.Node getFirstChild() { return soapEnvelope; } public org.w3c.dom.Node getLastChild() { return soapEnvelope; } public String getLocalName() { throw new NotImplementedException(); } public String getNamespaceURI() { throw new NotImplementedException(); } public org.w3c.dom.Node getNextSibling() { throw new NotImplementedException(); } public String getNodeName() { return doc.getNodeName(); } public short getNodeType() { return doc.getNodeType(); } public String getNodeValue() throws DOMException { throw new NotImplementedException(); } public Document getOwnerDocument() { return doc; } public org.w3c.dom.Node getParentNode() { throw new NotImplementedException(); } public String getPrefix() { throw new NotImplementedException(); } public org.w3c.dom.Node getPreviousSibling() { throw new NotImplementedException(); } public boolean hasAttributes() { throw new NotImplementedException(); } public boolean hasChildNodes() { throw new NotImplementedException(); } public org.w3c.dom.Node insertBefore(org.w3c.dom.Node node, org.w3c.dom.Node node1) throws DOMException { throw new NotImplementedException(); } public boolean isSupported(String s, String s1) { throw new NotImplementedException(); } public void normalize() { throw new NotImplementedException(); } public org.w3c.dom.Node removeChild(org.w3c.dom.Node node) throws DOMException { throw new NotImplementedException(); } public org.w3c.dom.Node replaceChild(org.w3c.dom.Node node, org.w3c.dom.Node node1) throws DOMException { throw new NotImplementedException(); } public void setNodeValue(String s) throws DOMException { throw new NotImplementedException(); } public void setPrefix(String s) throws DOMException { throw new NotImplementedException(); } public Node adoptNode(Node source) throws DOMException { throw new NotImplementedException("adoptNode"); } public String getDocumentURI() { throw new NotImplementedException("getDocumentURI"); } public DOMConfiguration getDomConfig() { throw new NotImplementedException("getDomConfig"); } public String getInputEncoding() { throw new NotImplementedException("getInputEncoding"); } public boolean getStrictErrorChecking() { throw new NotImplementedException("getStrictErrorChecking"); } public String getXmlEncoding() { throw new NotImplementedException("getXmlEncoding"); } public boolean getXmlStandalone() { throw new NotImplementedException("getXmlStandalone"); } public String getXmlVersion() { throw new NotImplementedException("getXmlVersion"); } public void normalizeDocument() { throw new NotImplementedException("normalizeDocument"); } public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException { throw new NotImplementedException("renameNode"); } public void setDocumentURI(String documentURI) { throw new NotImplementedException("setDocumentURI"); } public void setStrictErrorChecking(boolean strictErrorChecking) { throw new NotImplementedException("setStrictErrorChecking"); } public void setXmlStandalone(boolean xmlStandalone) throws DOMException { throw new NotImplementedException("setXmlStandalone"); } public void setXmlVersion(String xmlVersion) throws DOMException { throw new NotImplementedException("setXmlVersion"); } public short compareDocumentPosition(Node other) throws DOMException { throw new NotImplementedException("compareDocumentPosition"); } public String getBaseURI() { throw new NotImplementedException("getBaseURI"); } public Object getFeature(String feature, String version) { throw new NotImplementedException("getFeature"); } public String getTextContent() throws DOMException { throw new NotImplementedException("getTextContent"); } public Object getUserData(String key) { throw new NotImplementedException("getUserData"); } public boolean isDefaultNamespace(String namespaceURI) { throw new NotImplementedException("isDefaultNamespace"); } public boolean isEqualNode(Node arg) { throw new NotImplementedException("isEqualNode"); } public boolean isSameNode(Node other) { throw new NotImplementedException("isSameNode"); } public String lookupNamespaceURI(String prefix) { throw new NotImplementedException("lookupNamespaceURI"); } public String lookupPrefix(String namespaceURI) { throw new NotImplementedException("lookupPrefix"); } public void setTextContent(String textContent) throws DOMException { throw new NotImplementedException("setTextContent"); } public Object setUserData(String key, Object data, UserDataHandler handler) { throw new NotImplementedException("setUserData"); } public void detachNode() { //TODO: SAAJ 1.3 throw new NotImplementedException(); } public SOAPElement getParentElement() { //TODO: SAAJ 1.3 throw new NotImplementedException(); } public String getValue() { //TODO: SAAJ 1.3 throw new NotImplementedException(); } public void recycleNode() { //TODO: SAAJ 1.3 throw new NotImplementedException(); } public void setParentElement(SOAPElement parent) throws SOAPException { //TODO: SAAJ 1.3 throw new NotImplementedException(); } public void setValue(String value) { //TODO: SAAJ 1.3 throw new NotImplementedException(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/Style.java0000644000175000017500000000346010630511747030043 0ustar godgod/* * 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.core.soap; // $Id: Style.java 3400 2007-06-03 10:11:51Z thomas.diesler@jboss.com $ /** A type-safe enumeration for encoding style. * * @author Thomas.Diesler@jboss.org * @since 14-Oct-2004 */ public class Style { private String style; public static final Style RPC = new Style("rpc"); public static final Style DOCUMENT = new Style("document"); private Style(String style) { this.style = style; } public static Style getDefaultStyle() { return DOCUMENT; } public static Style valueOf(String style) { if (RPC.style.equals(style)) return RPC; if (DOCUMENT.style.equals(style)) return DOCUMENT; throw new IllegalArgumentException("Unsupported style: " + style); } public String toString() { return style; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SAAJMetaFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SAAJMetaFactoryImp0000644000175000017500000000327710542776150031357 0ustar godgod/* * 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.core.soap; // $Id: SAAJMetaFactoryImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.soap.MessageFactory; import javax.xml.soap.SAAJMetaFactory; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFactory; /** * MessageFactory implementation * * @author Thomas.Diesler@jboss.org */ public class SAAJMetaFactoryImpl extends SAAJMetaFactory { @Override protected MessageFactory newMessageFactory(String protocol) throws SOAPException { return new MessageFactoryImpl(protocol); } @Override protected SOAPFactory newSOAPFactory(String protocol) throws SOAPException { return new SOAPFactoryImpl(protocol); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/ObjectContent.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/ObjectContent.java0000644000175000017500000001436310650145103031477 0ustar godgod/* * 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.core.soap; import java.lang.reflect.Method; import javax.xml.namespace.QName; import javax.xml.transform.Result; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.AbstractSerializerFactory; import org.jboss.ws.core.binding.SerializerSupport; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxrpc.binding.NullValueSerializer; import org.jboss.wsf.common.JavaUtils; /** * Represents the OBJECT_VALID state of an {@link SOAPContentElement}.
      * * @author Heiko.Braun@jboss.org * @version $Id$ * @since 05.02.2007 */ public class ObjectContent extends SOAPContent { private static Logger log = Logger.getLogger(ObjectContent.class); // The java object content of this element. private Object objectValue; protected ObjectContent(SOAPContentElement container) { super(container); } State getState() { return State.OBJECT_VALID; } SOAPContent transitionTo(State nextState) { SOAPContent next = null; if (nextState == State.XML_VALID) { XMLFragment fragment = marshallObjectContents(); XMLContent xmlValid = new XMLContent(container); xmlValid.setXMLFragment(fragment); next = xmlValid; } else if (nextState == State.OBJECT_VALID) { next = this; } else if (nextState == State.DOM_VALID) { // first transition to XML valid XMLFragment fragment = marshallObjectContents(); XMLContent tmp = new XMLContent(container); tmp.setXMLFragment(fragment); // finally from XML valid to DOM valid next = tmp.transitionTo(State.DOM_VALID); } else { throw new IllegalArgumentException("Illegal state requested: " + nextState); } return next; } public Source getPayload() { throw new IllegalStateException("Payload not available"); } public void setPayload(Source source) { throw new IllegalStateException("Payload cannot be set on object content"); } public XMLFragment getXMLFragment() { throw new IllegalStateException("XMLFragment not available"); } public void setXMLFragment(XMLFragment xmlFragment) { throw new IllegalStateException("XMLFragment not available"); } public Object getObjectValue() { return objectValue; } public void setObjectValue(Object objValue) { this.objectValue = objValue; } private XMLFragment marshallObjectContents() { QName xmlType = container.getXmlType(); Class javaType = container.getJavaType(); log.debug("getXMLFragment from Object [xmlType=" + xmlType + ",javaType=" + javaType + "]"); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); SerializationContext serContext = msgContext.getSerializationContext(); serContext.setJavaType(javaType); TypeMappingImpl typeMapping = serContext.getTypeMapping(); XMLFragment xmlFragment = null; try { SerializerSupport ser; if (objectValue != null) { AbstractSerializerFactory serializerFactory = getSerializerFactory(typeMapping, javaType, xmlType); ser = (SerializerSupport)serializerFactory.getSerializer(); } else { ser = new NullValueSerializer(); } Result result = ser.serialize(container, serContext); xmlFragment = new XMLFragment(result); log.debug("xmlFragment: " + xmlFragment); } catch (BindingException e) { throw new WSException(e); } return xmlFragment; } /** * Get the serializer factory for a given javaType and xmlType */ private AbstractSerializerFactory getSerializerFactory(TypeMappingImpl typeMapping, Class javaType, QName xmlType) { AbstractSerializerFactory serializerFactory = (AbstractSerializerFactory)typeMapping.getSerializer(javaType, xmlType); // The type mapping might contain a mapping for the array wrapper bean if (serializerFactory == null && javaType.isArray()) { Class arrayWrapperType = typeMapping.getJavaType(xmlType); if (arrayWrapperType != null) { try { Method toArrayMethod = arrayWrapperType.getMethod("toArray", new Class[] {}); Class returnType = toArrayMethod.getReturnType(); if (JavaUtils.isAssignableFrom(javaType, returnType)) { serializerFactory = (AbstractSerializerFactory)typeMapping.getSerializer(arrayWrapperType, xmlType); } } catch (NoSuchMethodException e) { // ignore } } } if (serializerFactory == null) throw new WSException("Cannot obtain serializer factory for: [xmlType=" + xmlType + ",javaType=" + javaType + "]"); return serializerFactory; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPDocument.java0000644000175000017500000002633010650145103031174 0ustar godgod/* * 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.core.soap; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; import org.w3c.dom.EntityReference; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import org.w3c.dom.UserDataHandler; /** * SOAPDocument ensures that the propper SAAJ elements are * returned when Document calls are made from a DOM client. This implementation * enscapsulates a single ThreadLocal Document object. * * @author Jason T. Greene * @version $Revision: 3959 $ */ public class SOAPDocument implements Document { // TODO Revisit methods that are restricted or not implemented. private Document doc = DOMUtils.getOwnerDocument(); // Document methods public DocumentType getDoctype() { return doc.getDoctype(); } public DOMImplementation getImplementation() { // Should this be allowed? return doc.getImplementation(); } public Element getDocumentElement() { // The base SOAPDocument does not have an element, only SOAPPart will return null; } public Element createElement(String tagName) throws DOMException { return new SOAPElementImpl(tagName); } public DocumentFragment createDocumentFragment() { return doc.createDocumentFragment(); } public Text createTextNode(String data) { return doc.createTextNode(data); } public Comment createComment(String data) { return doc.createComment(data); } public CDATASection createCDATASection(String data) throws DOMException { return doc.createCDATASection(data); } public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException { return doc.createProcessingInstruction(target, data); } public Attr createAttribute(String name) throws DOMException { return doc.createAttribute(name); } public EntityReference createEntityReference(String name) throws DOMException { // Not allowed return null; } public NodeList getElementsByTagName(String tagname) { // The base SOAPDocument does not have an element, only SOAPPart will return null; } public Node importNode(Node importedNode, boolean deep) throws DOMException { // This should never be needed return doc.importNode(importedNode, deep); } public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { int loc = qualifiedName.indexOf(":"); if (loc == -1) return new SOAPElementImpl(qualifiedName, null, namespaceURI); if (loc == qualifiedName.length() - 1) throw new IllegalArgumentException("Invalid qualified name"); return new SOAPElementImpl(qualifiedName.substring(loc + 1), qualifiedName.substring(0, loc), namespaceURI); } public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { return doc.createAttributeNS(namespaceURI, qualifiedName); } public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { // The base SOAPDocument does not have an element, only SOAPPart will return null; } public Element getElementById(String elementId) { // The base SOAPDocument does not have an element, only SOAPPart will return null; } // Node methods public String getNodeName() { return doc.getNodeName(); } public String getNodeValue() throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public void setNodeValue(String nodeValue) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public short getNodeType() { return doc.getNodeType(); } public Node getParentNode() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public NodeList getChildNodes() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node getFirstChild() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node getLastChild() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node getPreviousSibling() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node getNextSibling() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public NamedNodeMap getAttributes() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Document getOwnerDocument() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node insertBefore(Node newChild, Node refChild) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node removeChild(Node oldChild) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node appendChild(Node newChild) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public boolean hasChildNodes() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public Node cloneNode(boolean deep) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public void normalize() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public boolean isSupported(String feature, String version) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public String getNamespaceURI() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public String getPrefix() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public void setPrefix(String prefix) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public String getLocalName() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } public boolean hasAttributes() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Node operations not allowed on SOAPDocument"); } // DOM3 methods public String getInputEncoding() { // FIXME getInputEncoding return null; } public String getXmlEncoding() { // FIXME getXmlEncoding return null; } public boolean getXmlStandalone() { // FIXME getXmlStandalone return false; } public void setXmlStandalone(boolean arg0) throws DOMException { // FIXME setXmlStandalone } public String getXmlVersion() { // FIXME getXmlVersion return null; } public void setXmlVersion(String arg0) throws DOMException { // FIXME setXmlVersion } public boolean getStrictErrorChecking() { // FIXME getStrictErrorChecking return false; } public void setStrictErrorChecking(boolean arg0) { // FIXME setStrictErrorChecking } public String getDocumentURI() { // FIXME getDocumentURI return null; } public void setDocumentURI(String arg0) { // FIXME setDocumentURI } public Node adoptNode(Node arg0) throws DOMException { // FIXME adoptNode return null; } public DOMConfiguration getDomConfig() { // FIXME getDomConfig return null; } public void normalizeDocument() { // FIXME normalizeDocument } public Node renameNode(Node arg0, String arg1, String arg2) throws DOMException { // FIXME renameNode return null; } public String getBaseURI() { // FIXME getBaseURI return null; } public short compareDocumentPosition(Node arg0) throws DOMException { // FIXME compareDocumentPosition return 0; } public String getTextContent() throws DOMException { // FIXME getTextContent return null; } public void setTextContent(String arg0) throws DOMException { // FIXME setTextContent } public boolean isSameNode(Node arg0) { // FIXME isSameNode return false; } public String lookupPrefix(String arg0) { // FIXME lookupPrefix return null; } public boolean isDefaultNamespace(String arg0) { // FIXME isDefaultNamespace return false; } public String lookupNamespaceURI(String arg0) { // FIXME lookupNamespaceURI return null; } public boolean isEqualNode(Node arg0) { // FIXME isEqualNode return false; } public Object getFeature(String arg0, String arg1) { // FIXME hasFeature return null; } public Object setUserData(String arg0, Object arg1, UserDataHandler arg2) { // FIXME setUserData return null; } public Object getUserData(String arg0) { // FIXME getUserData return null; } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/NodeListImpl.java0000644000175000017500000000403210542776150031305 0ustar godgod/* * 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.core.soap; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining * how this collection is implemented. NodeList objects in the DOM are live. * * The items in the NodeList are accessible via an integral index, starting from 0. * * @author Thomas.Diesler@jboss.org */ class NodeListImpl implements NodeList { private List nodeList = new ArrayList(); NodeListImpl(List nodes) { nodeList = new ArrayList(nodes); } NodeListImpl(Iterator nodes) { nodeList = new ArrayList(); while (nodes.hasNext()) nodeList.add(nodes.next()); } public Node item(int index) { if (nodeList.size() > index) return nodeList.get(index); else return null; } public int getLength() { return nodeList.size(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/NameImpl.java0000644000175000017500000000642610542776150030455 0ustar godgod/* * 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.core.soap; // $Id: NameImpl.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.soap.Name; /** * An implementation of a Name *

      * At this time of writing, the spec does not say anything about null values. * We assume emty string for any null value. * * @author Thomas.Diesler@jboss.org * @since 01-June-2004 */ public class NameImpl implements Name { private QName qname; public NameImpl(QName qname) { this.qname = qname; } public NameImpl(String local) { qname = new QName(local); } public NameImpl(String local, String prefix, String uri) { if (prefix != null) qname = new QName(uri, local, prefix); else qname = new QName(uri, local); } /** * Gets the local name part of the XML name that this Name object represents. * * @return a string giving the local name */ public String getLocalName() { return qname.getLocalPart(); } /** * Returns the prefix that was specified when this Name object was initialized. * This prefix is associated with the namespace for the XML name that this Name object represents. * * @return the prefix as a string */ public String getPrefix() { return qname.getPrefix(); } /** * Gets the namespace-qualified name of the XML name that this Name object represents. * * @return the namespace-qualified name as a string */ public String getQualifiedName() { String prefix = getPrefix(); if (prefix.length() > 0) return prefix + ":" + qname.getLocalPart(); else return qname.getLocalPart(); } /** * Returns the URI of the namespace for the XML name that this Name object represents. * * @return the URI as a string */ public String getURI() { return qname.getNamespaceURI(); } public int hashCode() { return qname.hashCode(); } public boolean equals(Object obj) { if (!(obj instanceof NameImpl)) return false; if (obj == this) return true; NameImpl other = (NameImpl)obj; return qname.equals(other.qname); } public QName toQName() { return qname; } public String toString() { return qname.toString(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPConnectionFact0000644000175000017500000000636210604700017031376 0ustar godgod/* * The Apache Software License, Version 1.1 * * * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package org.jboss.ws.core.soap; // $Id: SOAPConnectionFactoryImpl.java 2755 2007-04-04 10:38:07Z thomas.diesler@jboss.com $ import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPConnectionFactory; import javax.xml.soap.SOAPException; /** * SOAP Connection Factory implementation * * @author Thomas.Diesler@jboss.org * @since 02-Feb-2005 */ public class SOAPConnectionFactoryImpl extends SOAPConnectionFactory { /** Create a new SOAPConnection. * * @return the new SOAPConnection object. * @throws javax.xml.soap.SOAPException if there was an exception creating theSOAPConnection object. */ public SOAPConnection createConnection() throws SOAPException { return new SOAPConnectionImpl(); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPConnectionImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPConnectionImpl0000644000175000017500000000750410741424331031425 0ustar godgod/* * 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.core.soap; // $Id: SOAPConnectionImpl.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.logging.Logger; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.client.HTTPRemotingConnection; import org.jboss.ws.core.client.SOAPProtocolConnectionHTTP; /** * SOAPConnection implementation * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * * @since 02-Feb-2005 */ public class SOAPConnectionImpl extends SOAPConnection { // provide logging private static Logger log = Logger.getLogger(SOAPConnectionImpl.class); private HTTPRemotingConnection remotingConnection; public SOAPConnectionImpl() { remotingConnection = new SOAPProtocolConnectionHTTP(); } /** * Sends the given message to the specified endpoint and blocks until it has * returned the response. */ public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException { if (reqMessage == null) throw new IllegalArgumentException("Given SOAPMessage cannot be null"); MessageAbstraction resMessage = callInternal(reqMessage, endpoint, false); return (SOAPMessage)resMessage; } /** * Sends an HTTP GET request to an endpoint and blocks until a SOAP message is received */ public SOAPMessage get(Object endpoint) throws SOAPException { MessageAbstraction resMessage = callInternal(null, endpoint, false); return (SOAPMessage)resMessage; } /** * Sends the given message to the specified endpoint. This method is logically * non blocking. */ public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws SOAPException { if (reqMessage == null) throw new IllegalArgumentException("Given SOAPMessage cannot be null"); MessageAbstraction resMessage = callInternal((SOAPMessageImpl)reqMessage, endpoint, true); return (SOAPMessage)resMessage; } /** Closes this SOAPConnection */ public void close() throws SOAPException { if (remotingConnection.isClosed()) throw new SOAPException("SOAPConnection is already closed"); remotingConnection.setClosed(true); } private MessageAbstraction callInternal(SOAPMessage reqMessage, Object endpoint, boolean oneway) throws SOAPException { try { MessageAbstraction resMessage = remotingConnection.invoke((SOAPMessageImpl)reqMessage, endpoint, oneway); return resMessage; } catch (Exception ex) { Throwable cause = ex.getCause(); if (cause instanceof SOAPException) throw (SOAPException)cause; throw new SOAPException(ex); } } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/DetailEntryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/DetailEntryImpl.ja0000644000175000017500000000332010542776150031460 0ustar godgod/* * 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.core.soap; import javax.xml.namespace.QName; import javax.xml.soap.DetailEntry; import javax.xml.soap.Name; import javax.xml.soap.SOAPElement; /** * The content for a Detail object, giving details for a SOAPFault object. * A DetailEntry object, which carries information about errors related to the SOAPBody object that contains it, * is application-specific. * * @author Thomas.Diesler@jboss.org */ public class DetailEntryImpl extends SOAPElementImpl implements DetailEntry { public DetailEntryImpl(Name name) { super(name); } public DetailEntryImpl(QName qname) { super(qname); } public DetailEntryImpl(SOAPElement soapElement) { super((SOAPElementImpl)soapElement); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/TextImpl.java0000644000175000017500000003435210630374567030524 0ustar godgod/* * 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.core.soap; import java.io.IOException; import java.io.Writer; import org.w3c.dom.DOMException; import org.w3c.dom.Text; /** * A representation of a node whose value is text. A Text * object may represent text that is content or text that is a comment. * * @author Thomas.Diesler@jboss.org */ public class TextImpl extends NodeImpl implements javax.xml.soap.Text { public TextImpl(org.w3c.dom.Node node) { super(node); } /** Retrieves whether this object represents a comment. */ public boolean isComment() { return domNode.getNodeType() == org.w3c.dom.Node.COMMENT_NODE; } public String getValue() { return getNodeValue(); } public void setValue(String value) { setNodeValue(value); } public void writeNode(Writer out) throws IOException { String nodeValue = getNodeValue(); if (isComment() && !nodeValue.startsWith(""); else out.write(nodeValue); } /** * Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings. *

      * After being split, this node will contain all the content up to the offset point. A * new node of the same type, which contains all the content at and after the offset point, is returned. * If the original node had a parent node, the new node is inserted as the next sibling of the original node. * When the offset is equal to the length of this node, the new node has no data. * * @param offset The 16-bit unit offset at which to split, starting from 0. * @return The new node, of the same type as this node. * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified offset is negative or greater * than the number of 16-bit units in data. *
      NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public Text splitText(int offset) throws DOMException { if (offset < 0 || offset > getNodeValue().length()) throw new IllegalArgumentException("Invalid offset [" + offset + "] for '" + getNodeValue() + "'"); String before = getNodeValue().substring(0, offset + 1); setNodeValue(before); String after = getNodeValue().substring(offset + 1); TextImpl txtNode = new TextImpl(domNode.getOwnerDocument().createTextNode(after)); org.w3c.dom.Node parent = getParentNode(); if (parent != null) { org.w3c.dom.Node sibling = getNextSibling(); if (sibling == null) parent.appendChild(txtNode); else parent.insertBefore(txtNode, sibling); } return txtNode; } // org.w3c.dom.CharacterData *************************************************************************************** /** * The number of 16-bit units that are available through data * and the substringData method below. This may have the * value zero, i.e., CharacterData nodes may be empty. */ public int getLength() { return getNodeValue().length(); } /** * Remove a range of 16-bit units from the node. Upon success, * data and length reflect the change. * * @param offset The offset from which to start removing. * @param count The number of 16-bit units to delete. If the sum of * offset and count exceeds * length then all 16-bit units from offset * to the end of the data are deleted. * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified offset is * negative or greater than the number of 16-bit units in * data, or if the specified count is * negative. *
      NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public void deleteData(int offset, int count) throws DOMException { String value = getNodeValue().substring(0, offset + 1); setNodeValue(value); } /** * The character data of the node that implements this interface. The DOM * implementation may not put arbitrary limits on the amount of data * that may be stored in a CharacterData node. However, * implementation limits may mean that the entirety of a node's data may * not fit into a single DOMString. In such cases, the user * may call substringData to retrieve the data in * appropriately sized pieces. * * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @throws org.w3c.dom.DOMException DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a DOMString variable on the implementation * platform. */ public String getData() throws DOMException { return getNodeValue(); } /** * Extracts a range of data from the node. * * @param offset Start offset of substring to extract. * @param count The number of 16-bit units to extract. * @return The specified substring. If the sum of offset and * count exceeds the length, then all 16-bit * units to the end of the data are returned. * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified offset is * negative or greater than the number of 16-bit units in * data, or if the specified count is * negative. *
      DOMSTRING_SIZE_ERR: Raised if the specified range of text does * not fit into a DOMString. */ public String substringData(int offset, int count) throws DOMException { return getNodeValue().substring(offset, offset + count); } /** * Replace the characters starting at the specified 16-bit unit offset * with the specified string. * * @param offset The offset from which to start replacing. * @param count The number of 16-bit units to replace. If the sum of * offset and count exceeds * length, then all 16-bit units to the end of the data * are replaced; (i.e., the effect is the same as a remove * method call with the same range, followed by an append * method invocation). * @param arg The DOMString with which the range must be * replaced. * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified offset is * negative or greater than the number of 16-bit units in * data, or if the specified count is * negative. *
      NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public void replaceData(int offset, int count, String arg) throws DOMException { StringBuilder buffer = new StringBuilder(getNodeValue()); buffer.replace(offset, offset + count, arg); setNodeValue(buffer.toString()); } /** * Insert a string at the specified 16-bit unit offset. * * @param offset The character offset at which to insert. * @param arg The DOMString to insert. * @throws org.w3c.dom.DOMException INDEX_SIZE_ERR: Raised if the specified offset is * negative or greater than the number of 16-bit units in * data. *
      NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public void insertData(int offset, String arg) throws DOMException { StringBuilder buffer = new StringBuilder(getNodeValue()); buffer.insert(offset, arg); setNodeValue(buffer.toString()); } /** * Append the string to the end of the character data of the node. Upon * success, data provides access to the concatenation of * data and the DOMString specified. * * @param arg The DOMString to append. * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */ public void appendData(String arg) throws DOMException { setNodeValue(getNodeValue() + arg); } /** * The character data of the node that implements this interface. The DOM * implementation may not put arbitrary limits on the amount of data * that may be stored in a CharacterData node. However, * implementation limits may mean that the entirety of a node's data may * not fit into a single DOMString. In such cases, the user * may call substringData to retrieve the data in * appropriately sized pieces. * * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. * @throws org.w3c.dom.DOMException DOMSTRING_SIZE_ERR: Raised when it would return more characters than * fit in a DOMString variable on the implementation * platform. */ public void setData(String data) throws DOMException { setNodeValue(data); } // Stubbed out org.w3c.dom.Text methods ************************** /** * TODO - complete the implementation * * Returns whether this text node contains * element content whitespace, often abusively called "ignorable whitespace". The text node is * determined to contain whitespace in element content during the load * of the document or if validation occurs while using * Document.normalizeDocument(). * @since DOM Level 3 */ public boolean isElementContentWhitespace() { return false; } /** * TODO - complete the implementation * * Returns all text of Text nodes logically-adjacent text * nodes to this node, concatenated in document order. *
      For instance, in the example below wholeText on the * Text node that contains "bar" returns "barfoo", while on * the Text node that contains "foo" it returns "barfoo". * @since DOM Level 3 */ public String getWholeText() { return null; } /** * TODO - complete the implementation * * Replaces the text of the current node and all logically-adjacent text * nodes with the specified text. All logically-adjacent text nodes are * removed including the current node unless it was the recipient of the * replacement text. *
      This method returns the node which received the replacement text. * The returned node is: *

        *
      • null, when the replacement text is * the empty string; *
      • *
      • the current node, except when the current node is * read-only; *
      • *
      • a new Text node of the same type ( * Text or CDATASection) as the current node * inserted at the location of the replacement. *
      • *
      *
      For instance, in the above example calling * replaceWholeText on the Text node that * contains "bar" with "yo" in argument results in the following: *
      Where the nodes to be removed are read-only descendants of an * EntityReference, the EntityReference must * be removed instead of the read-only nodes. If any * EntityReference to be removed has descendants that are * not EntityReference, Text, or * CDATASection nodes, the replaceWholeText * method must fail before performing any modification of the document, * raising a DOMException with the code * NO_MODIFICATION_ALLOWED_ERR. *
      For instance, in the example below calling * replaceWholeText on the Text node that * contains "bar" fails, because the EntityReference node * "ent" contains an Element node which cannot be removed. * @param content The content of the replacing Text node. * @return The Text node created with the specified content. * @exception org.w3c.dom.DOMException * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the Text * nodes being replaced is readonly. * @since DOM Level 3 */ public Text replaceWholeText(String content) throws DOMException { return null; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPContentElement.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPContentElement0000644000175000017500000004175510650145103031432 0ustar godgod/* * 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.core.soap; // $Id: SOAPContentElement.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import java.io.Writer; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.transform.Source; import javax.xml.ws.handler.MessageContext.Scope; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS; import org.jboss.ws.core.soap.SOAPContent.State; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; /** * A SOAPElement that gives access to its content as XML fragment or Java object.

      * * The SOAPContentElement has three content representations, which may not exist in parallel. * The getter and setter of the content properties perform the conversions. *

       * +---------+         +-------------+          +-------------+
       * | Object  | <-----> | XMLFragment |  <-----> | DOMTree     |
       * +---------+         +-------------+          +-------------+
       * 
      * The idea is, that handlers can work with both the object and the dom view of this SOAPElement. * Note that transitions may be expensive. * * @see ObjectContent * @see XMLContent * @see DOMContent * * @author Thomas.Diesler@jboss.org * @author Heiko.Braun@jboss.org * @since 13-Dec-2004 */ public class SOAPContentElement extends SOAPElementImpl implements SOAPContentAccess { // provide logging private static Logger log = Logger.getLogger(SOAPContentElement.class); public static final QName GENERIC_PARAM_NAME = new QName("genericParam"); public static final QName GENERIC_RETURN_NAME = new QName("genericReturn"); // The associated parameter private ParameterMetaData paramMetaData; // content soapContent private SOAPContent soapContent; // while transitioning DOM expansion needs to be locked private boolean lockDOMExpansion = false; /** Construct a SOAPContentElement */ public SOAPContentElement(Name name) { super(name); this.soapContent = new DOMContent(this); } public SOAPContentElement(QName qname) { super(qname); this.soapContent = new DOMContent(this); } public SOAPContentElement(SOAPElementImpl element) { super(element); this.soapContent = new DOMContent(this); } public ParameterMetaData getParamMetaData() { if (paramMetaData == null) throw new IllegalStateException("Parameter meta data not available"); return paramMetaData; } public void setParamMetaData(ParameterMetaData paramMetaData) { this.paramMetaData = paramMetaData; } public QName getXmlType() { return getParamMetaData().getXmlType(); } public Class getJavaType() { return getParamMetaData().getJavaType(); } private void transitionTo(State nextState) { if (nextState != soapContent.getState()) { log.debug("-----------------------------------"); log.debug("Transitioning from " + soapContent.getState() + " to " + nextState); lockDOMExpansion = true; soapContent = soapContent.transitionTo(nextState); lockDOMExpansion = false; log.debug("-----------------------------------"); } } /** Get the payload as source. */ public Source getPayload() { if (soapContent.getState() == State.OBJECT_VALID) transitionTo(State.DOM_VALID); return soapContent.getPayload(); } public XMLFragment getXMLFragment() { transitionTo(State.XML_VALID); return soapContent.getXMLFragment(); } public void setXMLFragment(XMLFragment xmlFragment) { soapContent = new XMLContent(this); soapContent.setXMLFragment(xmlFragment); } public Object getObjectValue() { transitionTo(State.OBJECT_VALID); return soapContent.getObjectValue(); } public void setObjectValue(Object objValue) { soapContent = new ObjectContent(this); soapContent.setObjectValue(objValue); } // SOAPElement interface ******************************************************************************************** public SOAPElement addChildElement(SOAPElement child) throws SOAPException { log.trace("addChildElement: " + child); expandToDOM(); return super.addChildElement(child); } public SOAPElement addChildElement(String localName, String prefix) throws SOAPException { log.trace("addChildElement: [localName=" + localName + ",prefix=" + prefix + "]"); expandToDOM(); return super.addChildElement(localName, prefix); } public SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException { log.trace("addChildElement: [localName=" + localName + ",prefix=" + prefix + ",uri=" + uri + "]"); expandToDOM(); return super.addChildElement(localName, prefix, uri); } public SOAPElement addChildElement(Name name) throws SOAPException { log.trace("addChildElement: [name=" + name + "]"); expandToDOM(); return super.addChildElement(name); } public SOAPElement addChildElement(String name) throws SOAPException { log.trace("addChildElement: [name=" + name + "]"); expandToDOM(); return super.addChildElement(name); } public SOAPElement addTextNode(String value) throws SOAPException { log.trace("addTextNode: [value=" + value + "]"); expandToDOM(); return super.addTextNode(value); } public Iterator getChildElements() { log.trace("getChildElements"); expandToDOM(); return super.getChildElements(); } public Iterator getChildElements(Name name) { log.trace("getChildElements: [name=" + name + "]"); expandToDOM(); return super.getChildElements(name); } public void removeContents() { log.trace("removeContents"); expandToDOM(); super.removeContents(); } public Iterator getAllAttributes() { return super.getAllAttributes(); } public String getAttribute(String name) { return super.getAttribute(name); } public Attr getAttributeNode(String name) { return super.getAttributeNode(name); } public Attr getAttributeNodeNS(String namespaceURI, String localName) { return super.getAttributeNodeNS(namespaceURI, localName); } public String getAttributeNS(String namespaceURI, String localName) { return super.getAttributeNS(namespaceURI, localName); } public String getAttributeValue(Name name) { return super.getAttributeValue(name); } public SOAPElement addAttribute(Name name, String value) throws SOAPException { log.trace("addAttribute: [name=" + name + ",value=" + value + "]"); expandToDOM(); return super.addAttribute(name, value); } public SOAPElement addNamespaceDeclaration(String prefix, String nsURI) { log.trace("addNamespaceDeclaration: [prefix=" + prefix + ",nsURI=" + nsURI + "]"); expandToDOM(); return super.addNamespaceDeclaration(prefix, nsURI); } public Name getElementName() { return super.getElementName(); } public NodeList getElementsByTagName(String name) { log.trace("getElementsByTagName: [name=" + name + "]"); expandToDOM(); return super.getElementsByTagName(name); } public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { log.trace("getElementsByTagName: [nsURI=" + namespaceURI + ",localName=" + localName + "]"); expandToDOM(); return super.getElementsByTagNameNS(namespaceURI, localName); } public String getEncodingStyle() { return super.getEncodingStyle(); } public Iterator getNamespacePrefixes() { return super.getNamespacePrefixes(); } public String getNamespaceURI(String prefix) { return super.getNamespaceURI(prefix); } public TypeInfo getSchemaTypeInfo() { return super.getSchemaTypeInfo(); } public String getTagName() { return super.getTagName(); } public Iterator getVisibleNamespacePrefixes() { return super.getVisibleNamespacePrefixes(); } public boolean hasAttribute(String name) { return super.hasAttribute(name); } public boolean hasAttributeNS(String namespaceURI, String localName) { return super.hasAttributeNS(namespaceURI, localName); } public boolean removeAttribute(Name name) { log.trace("removeAttribute: " + name.getQualifiedName()); expandToDOM(); return super.removeAttribute(name); } public void removeAttribute(String name) throws DOMException { log.trace("removeAttribute: " + name); expandToDOM(); super.removeAttribute(name); } public Attr removeAttributeNode(Attr oldAttr) throws DOMException { log.trace("removeAttribute: " + oldAttr.getNodeName()); expandToDOM(); return super.removeAttributeNode(oldAttr); } public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { log.trace("removeAttributeNS: {" + namespaceURI + "}" + localName); expandToDOM(); super.removeAttributeNS(namespaceURI, localName); } public boolean removeNamespaceDeclaration(String prefix) { log.trace("removeNamespaceDeclaration: " + prefix); expandToDOM(); return super.removeNamespaceDeclaration(prefix); } public void setAttribute(String name, String value) throws DOMException { log.trace("setAttribute: [name=" + name + ",value=" + value + "]"); expandToDOM(); super.setAttribute(name, value); } public Attr setAttributeNode(Attr newAttr) throws DOMException { log.trace("setAttributeNode: " + newAttr); expandToDOM(); return super.setAttributeNode(newAttr); } public Attr setAttributeNodeNS(Attr newAttr) throws DOMException { log.trace("setAttributeNodeNS: " + newAttr); expandToDOM(); return super.setAttributeNodeNS(newAttr); } public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { log.trace("setAttribute: [nsURI=" + namespaceURI + ",name=" + qualifiedName + ",value=" + value + "]"); expandToDOM(); super.setAttributeNS(namespaceURI, qualifiedName, value); } public void setIdAttribute(String name, boolean isId) throws DOMException { log.trace("setIdAttribute: [name=" + name + ",value=" + isId + "]"); expandToDOM(); super.setIdAttribute(name, isId); } public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { log.trace("setIdAttributeNode: [idAttr=" + idAttr + ",value=" + isId + "]"); expandToDOM(); super.setIdAttributeNode(idAttr, isId); } public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { log.trace("setIdAttributeNS: [nsURI=" + namespaceURI + ",name=" + localName + ",value=" + isId + "]"); expandToDOM(); super.setIdAttributeNS(namespaceURI, localName, isId); } // Node interface ************************************************************************************************** public Node appendChild(Node newChild) throws DOMException { log.trace("appendChild: " + newChild); expandToDOM(); return super.appendChild(newChild); } public Node cloneNode(boolean deep) { log.trace("cloneNode: deep=" + deep); expandToDOM(); return super.cloneNode(deep); } public NodeList getChildNodes() { log.trace("getChildNodes"); expandToDOM(); return super.getChildNodes(); } public Node getFirstChild() { log.trace("getFirstChild"); expandToDOM(); return super.getFirstChild(); } public Node getLastChild() { log.trace("getLastChild"); expandToDOM(); return super.getLastChild(); } public String getValue() { log.trace("getValue"); expandToDOM(); return super.getValue(); } public boolean hasChildNodes() { log.trace("hasChildNodes"); expandToDOM(); return super.hasChildNodes(); } public Node removeChild(Node oldChild) throws DOMException { log.trace("removeChild: " + oldChild); expandToDOM(); return super.removeChild(oldChild); } public Node replaceChild(Node newChild, Node oldChild) throws DOMException { log.trace("replaceChild: [new=" + newChild + ",old=" + oldChild + "]"); expandToDOM(); return super.replaceChild(newChild, oldChild); } private void expandToDOM() { if (!lockDOMExpansion) transitionTo(State.DOM_VALID); } public void setValue(String value) { log.trace("setValue: " + value); expandToDOM(); super.setValue(value); } public NamedNodeMap getAttributes() { return super.getAttributes(); } public boolean hasAttributes() { return super.hasAttributes(); } // END Node interface *********************************************************************************************** public void writeElement(Writer writer) throws IOException { if (soapContent instanceof DOMContent) { new DOMWriter(writer).print(this); } else { transitionTo(State.XML_VALID); soapContent.getXMLFragment().writeTo(writer); } } /** * When a SOAPContentElement transitions between dom-valid and xml-valid * the XOP elements need to transition from XOP optimized to base64 and reverse.

      * * If MTOM is disabled through a message context property we always enforce the * base64 representation by expanding to DOM, the same happens when a JAXRPC handler * accesses the SOAPContentElement.

      * * If the element is in dom-valid state (because a handlers accessed it), upon marshalling * it's needs to be decided wether or not the xop:Include should be restored. * This as well depends upon the message context property. */ public void handleMTOMTransitions() { // JMS transport hot fix. Can be removed once we got a immutabe object model if (MessageContextAssociation.peekMessageContext() == null) return; // MTOM processing is only required on XOP parameters if (!isXOPParameter()) return; boolean domContentState = (soapContent instanceof DOMContent); if (!XOPContext.isMTOMEnabled()) { // If MTOM is disabled, we force dom expansion on XOP parameters. // This will inline any XOP include element and remove the attachment part. // See SOAPFactoryImpl for details. log.debug("MTOM disabled: Force inline XOP data"); // TODO: This property must be reset, otherwise you negate its purpose CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE); if (msgContext instanceof MessageContextJAXWS) ((MessageContextJAXWS)msgContext).setScope(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Scope.APPLICATION); expandToDOM(); } else if (domContentState && XOPContext.isMTOMEnabled()) { // When the DOM representation is valid, // but MTOM is enabled we need to convert the inlined // element back to an xop:Include element and create the attachment part log.debug("MTOM enabled: Restore XOP data"); XOPContext.restoreXOPDataDOM(this); } } boolean isXOPParameter() { return paramMetaData != null && paramMetaData.isXOP(); } public void accept(SAAJVisitor visitor) { visitor.visitSOAPContentElement(this); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/NodeImpl.java0000644000175000017500000004741410650145103030450 0ustar godgod/* * 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.core.soap; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.UserDataHandler; /** * A representation of a node (element) in an XML document. * This interface extnends the standard DOM Node interface with methods for getting and setting the value of a node, * for getting and setting the parent of a node, and for removing a node. * * When creating a DOM2 tree the objects maintained by the tree are org.w3c.dom.Node objects * and not javax.xml.soap.Node objects. *

      * This implementation schields the client from the the underlying DOM2 tree, returning javax.xml.soap.Node * objects. * * @author Thomas.Diesler@jboss.org */ public class NodeImpl implements javax.xml.soap.Node { // provide logging private static Logger log = Logger.getLogger(NodeImpl.class); // The parent of this Node protected SOAPElementImpl soapParent; // This org.w3c.dom.Node protected org.w3c.dom.Node domNode; // A list of soap children private List soapChildren = new ArrayList(); /** Construct the Node for a given org.w3c.dom.Node * * This constructor is used: * * 1) SOAPElement construction * 2) Text construction */ NodeImpl(org.w3c.dom.Node node) { // Method selection in Java is done at compile time // Late binding does not work in this case if (node instanceof NodeImpl) throw new IllegalArgumentException("Copy constructor should be used"); domNode = node; // SOAP child elements should be constructed externally if (DOMUtils.hasChildElements(node)) throw new IllegalArgumentException("Node cannot have child elements"); } /** The copy constructor used when converting types (i.e. SOAPElement -> SOAPHeaderElement) */ NodeImpl(NodeImpl node) { soapParent = node.soapParent; domNode = node.domNode; Iterator i = node.soapChildren.iterator(); while (i.hasNext()) { NodeImpl childNode = (NodeImpl)i.next(); childNode.soapParent = (SOAPElementImpl)this; soapChildren.add(childNode); } } // javax.xml.soap.Node ********************************************************************************************* /** * Removes this Node object from the tree. */ public void detachNode() { org.w3c.dom.Node domParent = domNode.getParentNode(); if (domParent != null) domParent.removeChild(domNode); if (soapParent != null) ((NodeImpl)soapParent).soapChildren.remove(this); soapParent = null; } /** * Returns the parent node of this Node object. * This method can throw an UnsupportedOperationException if the tree is not kept in memory. * * @return the SOAPElement object that is the parent of this Node object or null if this Node object is root */ public SOAPElement getParentElement() { return soapParent; } /** * Sets the parent of this Node object to the given SOAPElement object. * * @param parent the SOAPElement object to be set as the parent of this Node object * @throws javax.xml.soap.SOAPException if there is a problem in setting the parent to the given node */ public void setParentElement(SOAPElement parent) throws SOAPException { // detach from the old parent if (soapParent != null) detachNode(); soapParent = (SOAPElementImpl)parent; } /** * Returns the value of this node if this is a Text node or the value of the immediate child of this node otherwise. *

      * If there is an immediate child of this Node that it is a Text node then it's value will be returned. * If there is more than one Text node then the value of the first Text Node will be returned. * Otherwise null is returned. * * @return a String with the text of this node if this is a Text node or the text contained by the first immediate * child of this Node object that is a Text object if such a child exists; null otherwise. */ public String getValue() { // The Text node should overwrite getValue if (this instanceof javax.xml.soap.Text) throw new WSException("javax.xml.soap.Text should take care of this"); String nodeValue = null; org.w3c.dom.Node child = (org.w3c.dom.Node)getFirstChild(); if (child instanceof org.w3c.dom.Text) nodeValue = ((org.w3c.dom.Text)child).getNodeValue(); return nodeValue; } /** * If this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) child of this node. *

      * The value of the immediate child of this node can be set only if, there is one child node and * that node is a Text node, or if there are no children in which case a child Text node will be created. * * @param value A value string * @throws IllegalStateException if the node is not a Text node and either has more than one child node or has a child node that is not a Text node. */ public void setValue(String value) { // The Text node should overwrite setValue if (this instanceof javax.xml.soap.Text) throw new WSException("javax.xml.soap.Text should take care of this"); org.w3c.dom.Node child = (org.w3c.dom.Node)getFirstChild(); if (child instanceof org.w3c.dom.Text) ((org.w3c.dom.Text)child).setNodeValue(value); if (child == null) { child = domNode.getOwnerDocument().createTextNode(value); appendChild(new TextImpl(child)); } } /** * Notifies the implementation that this Node object is no longer being used by the application and that the * implementation is free to reuse this object for nodes that may be created later. * Calling the method recycleNode implies that the method detachNode has been called previously. */ public void recycleNode() { } private List convertDocumentFragment(DocumentFragment docFragment) throws DOMException { List list = new ArrayList(); try { SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); for (Node node = docFragment.getFirstChild(); node != null; node = node.getNextSibling()) { switch (node.getNodeType()) { case Node.ELEMENT_NODE: { SOAPElementImpl soapChild = (SOAPElementImpl)soapFactory.createElement((Element)node); list.add(soapChild); break; } case Node.TEXT_NODE: { TextImpl text = new TextImpl(node); list.add(text); break; } case Node.CDATA_SECTION_NODE: { TextImpl text = new TextImpl(node); list.add(text); break; } } } } catch (SOAPException ex) { throw new DOMException(DOMException.INVALID_STATE_ERR, "Could not convert a document fragment to a node"); } return list; } // BEGIN org.w3c.dom.Node ******************************************************************************************* public String getNodeName() { return domNode.getNodeName(); } public String getNodeValue() throws DOMException { return domNode.getNodeValue(); } public void setNodeValue(String nodeValue) throws DOMException { domNode.setNodeValue(nodeValue); } public short getNodeType() { return domNode.getNodeType(); } public org.w3c.dom.Node getParentNode() { assertSOAPParent(); return soapParent; } public NodeList getChildNodes() { return new NodeListImpl(soapChildren); } public org.w3c.dom.Node getFirstChild() { NodeImpl child = null; org.w3c.dom.Node domChild = domNode.getFirstChild(); if (domChild != null) { child = (NodeImpl)soapChildren.get(0); if (domChild != child.domNode) throw new WSException("Inconsistent node, child lists not synchronized"); } return child; } public org.w3c.dom.Node getLastChild() { NodeImpl child = null; org.w3c.dom.Node domChild = domNode.getLastChild(); if (domChild != null) { child = (NodeImpl)soapChildren.get(soapChildren.size() - 1); if (domChild != child.domNode) throw new WSException("Inconsistent node, child lists not synchronized"); } return child; } public org.w3c.dom.Node getPreviousSibling() { assertSOAPParent(); NodeImpl sibling = null; if (soapParent != null) { List children = ((NodeImpl)soapParent).soapChildren; for (int i = 0; i < children.size(); i++) { NodeImpl node = (NodeImpl)children.get(i); if (node == this && i > 0) { sibling = (NodeImpl)children.get(i - 1); break; } } if (sibling != null && sibling.domNode != domNode.getPreviousSibling()) throw new WSException("Inconsistent node, child lists not synchronized"); } return sibling; } public org.w3c.dom.Node getNextSibling() { assertSOAPParent(); NodeImpl sibling = null; if (soapParent != null) { List children = ((NodeImpl)soapParent).soapChildren; for (int i = 0; i < children.size(); i++) { NodeImpl node = (NodeImpl)children.get(i); if (node == this && (i + 1) < children.size()) { sibling = (NodeImpl)children.get(i + 1); break; } } if (sibling != null && sibling.domNode != domNode.getNextSibling()) throw new WSException("Inconsistent node, child lists not synchronized"); } return sibling; } public NamedNodeMap getAttributes() { return domNode.getAttributes(); } public Document getOwnerDocument() { // Climb the tree in hopes of finding the soap envelope. // If it's not there (a detached subtree), then we return a non-associated document if (soapParent == null) return new SOAPDocument(); return soapParent.getOwnerDocument(); } public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws DOMException { // DOM says that if refChild is null, an append is performed if (refChild == null) return appendChild(newChild); newChild = convertDOMNode(newChild); refChild = convertDOMNode(refChild); if (newChild instanceof DocumentFragment) { List list = convertDocumentFragment((DocumentFragment)newChild); for (NodeImpl node : list) { insertBefore(node, refChild); } return newChild; } int index = soapChildren.indexOf(refChild); if (index < 0) throw new IllegalArgumentException("Cannot find refChild in list of javax.xml.soap.Node children"); NodeImpl soapNewNode = (NodeImpl)newChild; soapNewNode.detachNode(); NodeImpl soapRefNode = (NodeImpl)refChild; domNode.insertBefore(soapNewNode.domNode, soapRefNode.domNode); soapChildren.add(index, soapNewNode); soapNewNode.soapParent = (SOAPElementImpl)this; return newChild; } public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws DOMException { newChild = convertDOMNode(newChild); oldChild = convertDOMNode(oldChild); if (newChild instanceof DocumentFragment) { insertBefore(newChild, oldChild); ((NodeImpl)oldChild).detachNode(); return newChild; } int index = soapChildren.indexOf(oldChild); if (index < 0) throw new DOMException(DOMException.NOT_FOUND_ERR, "Cannot find oldChild in list of javax.xml.soap.Node children"); NodeImpl soapNewNode = (NodeImpl)newChild; NodeImpl soapOldNode = (NodeImpl)oldChild; soapNewNode.detachNode(); if (soapNewNode.domNode != soapOldNode.domNode) domNode.replaceChild(soapNewNode.domNode, soapOldNode.domNode); soapChildren.remove(index); soapChildren.add(index, soapNewNode); soapNewNode.soapParent = soapOldNode.soapParent; soapOldNode.soapParent = null; return newChild; } public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws DOMException { oldChild = convertDOMNode(oldChild); int index = soapChildren.indexOf(oldChild); if (index < 0) throw new DOMException(DOMException.NOT_FOUND_ERR, "Cannot find oldChild in list of javax.xml.soap.Node children"); NodeImpl soapOldNode = (NodeImpl)oldChild; domNode.removeChild(soapOldNode.domNode); soapChildren.remove(index); soapOldNode.soapParent = null; return oldChild; } public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws DOMException { newChild = convertDOMNode(newChild); if (newChild instanceof DocumentFragment) { List list = convertDocumentFragment((DocumentFragment)newChild); for (NodeImpl node : list) { appendChild(node); } return newChild; } if ((this instanceof SOAPElementImpl) == false) throw new DOMException(DOMException.INVALID_ACCESS_ERR, "Cannot append child to this node: " + this); NodeImpl soapNode = (NodeImpl)newChild; soapNode.detachNode(); domNode.appendChild(soapNode.domNode); soapNode.soapParent = (SOAPElementImpl)this; soapChildren.add(soapNode); return newChild; } public boolean hasChildNodes() { return domNode.hasChildNodes(); } public org.w3c.dom.Node cloneNode(boolean deep) { return domNode.cloneNode(deep); } public void normalize() { domNode.normalize(); } public boolean isSupported(String feature, String version) { return domNode.isSupported(feature, version); } public String getNamespaceURI() { return domNode.getNamespaceURI(); } public String getPrefix() { return domNode.getPrefix(); } public void setPrefix(String prefix) throws DOMException { domNode.setPrefix(prefix); } public String getLocalName() { return domNode.getLocalName(); } public boolean hasAttributes() { return domNode.hasAttributes(); } public int hashCode() { return domNode.hashCode(); } public String toString() { return super.toString() + "[" + domNode.toString() + "]"; } private Node convertDOMNode(org.w3c.dom.Node node) { Node retNode; if (node instanceof NodeImpl) { retNode = node; } else if (node instanceof DocumentFragment) { retNode = new DocumentFragmentImpl((DocumentFragment)node); } else if (node instanceof org.w3c.dom.Text) { retNode = new TextImpl(node); } else if (node instanceof org.w3c.dom.Comment) { retNode = new TextImpl(node); } else if (node instanceof org.w3c.dom.Element) { try { retNode = new SOAPFactoryImpl().createElement((Element)node); } catch (SOAPException ex) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "CAnnot convert to SOAP element: " + node); } } else { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Operation not supported on this type of node: " + node); } return retNode; } private void assertSOAPParent() { org.w3c.dom.Node domParent = domNode.getParentNode(); if (domParent != null && soapParent == null) throw new WSException("Inconsistent node, has a DOM parent but no SOAP parent [" + this + "] " + DOMWriter.printNode(this, false)); if (domParent != null && soapParent != null && domParent != soapParent.domNode) throw new WSException("Inconsistent node, SOAP parent is not identical with DOM parent [" + this + "] " + DOMWriter.printNode(this, false)); } // END org.w3c.dom.Node ******************************************************************************************* // BEGIN org.w3c.dom.Node DOM Level 3 ***************************************************************************** public short compareDocumentPosition(Node other) throws DOMException { // FIXME compareDocumentPosition throw new NotImplementedException("compareDocumentPosition"); } public String getBaseURI() { // FIXME getBaseURI throw new NotImplementedException("getBaseURI"); } public Object getFeature(String feature, String version) { // FIXME getFeature throw new NotImplementedException("getFeature"); } public String getTextContent() throws DOMException { // FIXME getTextContent throw new NotImplementedException("getTextContent"); } public Object getUserData(String key) { // FIXME getUserData throw new NotImplementedException("getUserData"); } public boolean isDefaultNamespace(String namespaceURI) { // FIXME isDefaultNamespace throw new NotImplementedException("isDefaultNamespace"); } public boolean isEqualNode(Node arg) { return domNode.isEqualNode(arg); } public boolean isSameNode(Node other) { // FIXME isSameNode throw new NotImplementedException("isSameNode"); } public String lookupNamespaceURI(String prefix) { // FIXME lookupNamespaceURI throw new NotImplementedException("lookupNamespaceURI"); } public String lookupPrefix(String namespaceURI) { // FIXME lookupPrefix throw new NotImplementedException("lookupPrefix"); } public void setTextContent(String textContent) throws DOMException { // FIXME setTextContent throw new NotImplementedException("setTextContent"); } public Object setUserData(String key, Object data, UserDataHandler handler) { // FIXME setUserData throw new NotImplementedException("setUserData"); } // END org.w3c.dom.Node DOM Level 3 ***************************************************************************** } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPContentAccess.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPContentAccess.0000644000175000017500000000253510603207475031322 0ustar godgod/* * 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.core.soap; //$Id: $ import javax.xml.transform.Source; /** * @author Heiko.Braun@jboss.org * @since 05.02.2007 */ public interface SOAPContentAccess { Source getPayload(); XMLFragment getXMLFragment(); void setXMLFragment(XMLFragment xmlFragment); Object getObjectValue(); void setObjectValue(Object objValue); } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageUnMarshallerHTTP.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageUnMarsh0000644000175000017500000001106410741424331031362 0ustar godgod/* * 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.core.soap; // $Id: SOAPMessageUnMarshallerHTTP.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.logging.Logger; import org.jboss.remoting.marshal.UnMarshaller; import org.jboss.remoting.transport.http.HTTPMetadataConstants; import org.jboss.ws.WSException; /** * @author Thomas.Diesler@jboss.org * @since 25-Nov-2004 */ public class SOAPMessageUnMarshallerHTTP implements UnMarshaller { // Provide logging private static Logger log = Logger.getLogger(SOAPMessageUnMarshallerHTTP.class); private static List validResponseCodes = new ArrayList(); static { validResponseCodes.add(HttpServletResponse.SC_OK); validResponseCodes.add(HttpServletResponse.SC_ACCEPTED); validResponseCodes.add(HttpServletResponse.SC_NO_CONTENT); validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException { if (log.isTraceEnabled()) log.trace("Read input stream with metadata=" + metadata); try { Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE); if (resCode == null) { log.warn("No HTTP resonse code, assuming: SC_OK"); resCode = HttpServletResponse.SC_OK; } String resMessage = (String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE); if (validResponseCodes.contains(resCode) == false) throw new WSException("Invalid HTTP server response [" + resCode + "] - " + resMessage); // [JBWS-859] SOAPMessageUnMarshaller doesn't support HTTP server response [204] - No Content SOAPMessage soapMsg = null; if (resCode != HttpServletResponse.SC_NO_CONTENT) { MimeHeaders mimeHeaders = getMimeHeaders(metadata); soapMsg = new MessageFactoryImpl().createMessage(mimeHeaders, inputStream, true); } return soapMsg; } catch (SOAPException e) { log.error("Cannot unmarshall SOAPMessage", e); IOException e2 = new IOException(e.toString()); e2.initCause(e); throw e2; } } /** * Set the class loader to use for unmarhsalling. This may * be needed when need to have access to class definitions that * are not part of this unmarshaller's parent classloader (especially * when doing remote classloading). * * @param classloader */ public void setClassLoader(ClassLoader classloader) { //NO OP } public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException { return new SOAPMessageUnMarshallerHTTP(); } private MimeHeaders getMimeHeaders(Map metadata) { log.debug("getMimeHeaders from: " + metadata); MimeHeaders headers = new MimeHeaders(); Iterator i = metadata.keySet().iterator(); while (i.hasNext()) { String key = (String)i.next(); Object value = metadata.get(key); if (key != null && value instanceof List) { for (Object listValue : (List)value) { headers.addHeader(key, listValue.toString()); } } } return headers; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPBodyElementDoc.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPBodyElementDoc0000644000175000017500000000327110542776150031346 0ustar godgod/* * 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.core.soap; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPBodyElement; /** * An abstract implemenation of the SOAPBodyElement *

      * This class should not expose functionality that is not part of * {@link javax.xml.soap.SOAPBodyElement}. Client code should use SOAPBodyElement. * * @author Thomas.Diesler@jboss.org */ public class SOAPBodyElementDoc extends SOAPContentElement implements SOAPBodyElement { public SOAPBodyElementDoc(Name name) { super(name); } public SOAPBodyElementDoc(QName qname) { super(qname); } public SOAPBodyElementDoc(SOAPElementImpl element) { super(element); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPFaultImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPFaultImpl.java0000644000175000017500000006056210650145103031320 0ustar godgod/* * 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.core.soap; import java.io.Writer; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Locale; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.Detail; import javax.xml.soap.Name; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFault; import javax.xml.soap.SOAPFaultElement; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.utils.SAAJUtils; import org.jboss.wsf.common.DOMWriter; import org.jboss.xb.QNameBuilder; import org.w3c.dom.Attr; /** * An element in the SOAPBody object that contains error and/or status information. * This information may relate to errors in the SOAPMessage object or to problems * that are not related to the content in the message itself. Problems not related * to the message itself are generally errors in processing, such as the inability * to communicate with an upstream server. * * The SOAPFault interface provides methods for retrieving the information contained * in a SOAPFault object and for setting the fault code, the fault actor, and a string * describing the fault. A fault code is one of the codes defined in the SOAP 1.1 specification * that describe the fault. An actor is an intermediate recipient to whom a message was routed. * The message path may include one or more actors, or, if no actors are specified, the message * goes only to the default actor, which is the final intended recipient. * * @author Thomas.Diesler@jboss.org */ public class SOAPFaultImpl extends SOAPBodyElementDoc implements SOAPFault { // provide logging private static Logger log = Logger.getLogger(SOAPFaultImpl.class); private SOAPElement faultcode; // also represents Reason private SOAPElement faultstring; // also represents Role private SOAPElement faultactor; private SOAPElement faultnode; private Detail detail; public final static Set soap11FaultCodes = new HashSet(); static { soap11FaultCodes.add(Constants.SOAP11_FAULT_CODE_CLIENT); soap11FaultCodes.add(Constants.SOAP11_FAULT_CODE_SERVER); soap11FaultCodes.add(Constants.SOAP11_FAULT_CODE_VERSION_MISMATCH); soap11FaultCodes.add(Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND); } public final static Set soap12FaultCodes = new HashSet(); static { soap12FaultCodes.add(SOAPConstants.SOAP_VERSIONMISMATCH_FAULT); soap12FaultCodes.add(SOAPConstants.SOAP_MUSTUNDERSTAND_FAULT); soap12FaultCodes.add(SOAPConstants.SOAP_DATAENCODINGUNKNOWN_FAULT); soap12FaultCodes.add(SOAPConstants.SOAP_SENDER_FAULT); soap12FaultCodes.add(SOAPConstants.SOAP_RECEIVER_FAULT); } public SOAPFaultImpl() throws SOAPException { this(Constants.PREFIX_ENV, Constants.NS_SOAP11_ENV); } public SOAPFaultImpl(String prefix, String namespace) throws SOAPException { super(new NameImpl("Fault", prefix, namespace)); } /** Gets the fault code for this SOAPFault object. */ public String getFaultCode() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { if (faultcode == null) findFaultCodeElement(); return faultcode.getValue(); } else { if (faultcode == null) findCodeElement(); return getChildValueElement(faultcode).getValue(); } } /** * Gets the mandatory SOAP 1.1 fault code for this SOAPFault object as a SAAJ Name object. */ public Name getFaultCodeAsName() { return new NameImpl(getFaultCodeAsQName()); } public QName getFaultCodeAsQName() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { if (faultcode == null) findFaultCodeElement(); return QNameBuilder.buildQName(faultcode, faultcode.getValue()); } else { if (faultcode == null) findCodeElement(); SOAPElement valueElement = getChildValueElement(faultcode); return QNameBuilder.buildQName(valueElement, valueElement.getValue()); } } private void findFaultCodeElement() { faultcode = getChildElement(this, Constants.SOAP11_FAULTCODE); log.trace("findFaultCodeElement : " + faultcode); } private void findCodeElement() { faultcode = getChildElement(this, Constants.SOAP12_CODE); log.trace("findCodeElement : " + faultcode); } private static SOAPElement getChildValueElement(SOAPElement codeElement) { return getChildElement(codeElement, Constants.SOAP12_VALUE); } /** Sets this SOAPFault object with the give fault code. */ public void setFaultCode(String faultCode) throws SOAPException { // Must be of the form "prefix:localName" where the prefix has been defined in a namespace declaration. QName qname = QNameBuilder.buildQName(this, faultCode); setFaultCode(qname); } /** Sets this SOAPFault object with the given fault code. */ public void setFaultCode(Name faultCode) throws SOAPException { setFaultCode(((NameImpl)faultCode).toQName()); } public void setFaultCode(QName faultCode) throws SOAPException { boolean isSOAP11 = Constants.NS_SOAP11_ENV.equals(getNamespaceURI()); String faultCodeNS = faultCode.getNamespaceURI(); if (faultCodeNS.length() == 0) throw new SOAPException("Fault code '" + faultCode + "' must be namespace qualified"); /* JUDDI uses unqualified fault codes // Fix the namespace for SOAP1.1, if it is not a standard fault code if (isSOAP11 && faultCodeNS.length() == 0) { String localPart = faultCode.getLocalPart(); for (QName soap11Fault : soap11FaultCodes) { if (soap11Fault.equals(localPart)) throw new SOAPException("Fault code '" + faultCode + "' must be namespace qualified"); } QName newFaultCode = new QName("http://unknown-namespace-uri", localPart); log.warn("Fault code '" + faultCode + "' must be namespace qualified, assuming: " + newFaultCode); faultCode = newFaultCode; } */ if (isSOAP11) { if (faultcode == null) { findFaultCodeElement(); if (faultcode == null) faultcode = addUnqualifiedFaultElement("faultcode"); } setCode(faultcode, faultCode); } else { if (soap12FaultCodes.contains(faultCode) == false) throw new SOAPException(faultCode + " is not a standard SOAP 1.2 Code value"); if (faultcode == null) { findCodeElement(); if (faultcode == null) { faultcode = addQualifiedFaultElement("Code"); addChildValueElement(faultcode); } } setCode(getChildValueElement(faultcode), faultCode); } } private static void setCode(SOAPElement codeElement, QName code) throws SOAPException { SAAJUtils.setQualifiedElementValue(codeElement, code); } private static SOAPElement addChildValueElement(SOAPElement codeElement) throws SOAPException { return codeElement.addChildElement("Value", codeElement.getPrefix(), codeElement.getNamespaceURI()); } public Iterator getFaultSubcodes() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Subcode"); ArrayList subcodes = new ArrayList(); SOAPElement baseCodeElement = faultcode; SOAPElement subcodeElement; for (subcodeElement = getChildSubcodeElement(baseCodeElement); subcodeElement != null; subcodeElement = getChildSubcodeElement(baseCodeElement)) { SOAPElement valueElement = getChildValueElement(subcodeElement); QName subcode = QNameBuilder.buildQName(valueElement, valueElement.getValue()); subcodes.add(subcode); baseCodeElement = subcodeElement; } // this iterator should not support the remove method return Collections.unmodifiableList(subcodes).iterator(); } private static SOAPElement getChildSubcodeElement(SOAPElement element) { return getChildElement(element, Constants.SOAP12_SUBCODE); } public void appendFaultSubcode(QName subcode) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Subcode"); String nsURI = subcode.getNamespaceURI(); if (nsURI.length() == 0) throw new SOAPException("subcode must be namespace qualified: " + subcode); if (faultcode == null) findCodeElement(); // find innermost subcode element SOAPElement baseCodeElement = faultcode; for (SOAPElement subcodeElement = getChildSubcodeElement(baseCodeElement); subcodeElement != null; subcodeElement = getChildSubcodeElement(baseCodeElement)) baseCodeElement = subcodeElement; SOAPElement subcodeElement = baseCodeElement.addChildElement("Subcode", baseCodeElement.getPrefix(), baseCodeElement.getNamespaceURI()); SOAPElement valueElement = addChildValueElement(subcodeElement); setCode(valueElement, subcode); } public void removeAllFaultSubcodes() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Subcode"); if (faultcode == null) findFaultCodeElement(); SOAPElement subcodeElement = getChildSubcodeElement(faultcode); if (subcodeElement != null) subcodeElement.detachNode(); } /** Gets the fault string for this SOAPFault object. */ public String getFaultString() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { if (faultstring == null) { findFaultStringElement(); if (faultstring == null) return null; } return faultstring.getValue(); } else { try { return (String)getFaultReasonTexts().next(); } catch (SOAPException e) { return null; } } } /** Gets the locale of the fault string for this SOAPFault object. */ public Locale getFaultStringLocale() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { if (faultstring == null) { findFaultStringElement(); if (faultstring == null) return null; } return getLocale(faultstring); } else { try { return (Locale)getFaultReasonLocales().next(); } catch (SOAPException e) { return null; } } } private void findFaultStringElement() { faultstring = getChildElement(this, Constants.SOAP11_FAULTSTRING); log.trace("findFaultStringElement : " + faultstring); } private static Locale getLocale(SOAPElement element) { Attr xmlLang = element.getAttributeNodeNS(Constants.NS_XML, "lang"); return xmlLang != null ? toLocale(xmlLang.getValue()) : null; } /** Converts a language tag as defined in IETF RFC 3066 to a * {@link Locale}. */ private static Locale toLocale(String languageTag) { String[] subtags = languageTag.split("-"); // ignore subtags beyond the second return subtags.length == 1 ? new Locale(subtags[0]) : new Locale(subtags[0], subtags[1]); } /** Sets the fault string for this SOAPFault object to the given string. */ public void setFaultString(String faultString) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { setFaultStringInternal(faultString); faultstring.removeAttributeNS(Constants.NS_XML, "lang"); } else addFaultReasonText(faultString, Locale.getDefault()); } /** Sets the fault string for this SOAPFault object to the given string and localized to the given locale. */ public void setFaultString(String faultString, Locale locale) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { setFaultStringInternal(faultString); setLocale(faultstring, locale); } else addFaultReasonText(faultString, locale); } private void setFaultStringInternal(String faultString) throws SOAPException { if (faultstring == null) { findFaultStringElement(); if (faultstring == null) faultstring = addUnqualifiedFaultElement("faultstring"); } faultstring.setValue(faultString); } private static void setLocale(SOAPElement element, Locale locale) { element.setAttributeNS(Constants.NS_XML, "xml:lang", toLanguageTag(locale)); } /** Converts a {@link Locale} to a language tag as defined in IETF RFC 3066. */ private static String toLanguageTag(Locale locale) { String languageTag = locale.getLanguage(); String country = locale.getCountry(); if (country.length() != 0) languageTag += "-" + country; return languageTag; } public Iterator getFaultReasonTexts() throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Reason"); if (faultstring == null) { findReasonElement(); if (faultstring == null) return Collections.EMPTY_LIST.iterator(); } ArrayList texts = new ArrayList(); Iterator it = faultstring.getChildElements(Constants.SOAP12_TEXT); while (it.hasNext()) { SOAPElement textElement = (SOAPElement)it.next(); texts.add(textElement.getValue()); } if (texts.isEmpty()) throw new SOAPException("no Text elements found inside Reason"); return texts.iterator(); } public Iterator getFaultReasonLocales() throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Reason"); if (faultstring == null) { findReasonElement(); if (faultstring == null) return Collections.EMPTY_LIST.iterator(); } ArrayList locales = new ArrayList(); Iterator it = faultstring.getChildElements(Constants.SOAP12_TEXT); while (it.hasNext()) { SOAPElement textElement = (SOAPElement)it.next(); Locale locale = getLocale(textElement); if (locale == null) throw new SOAPException("lang attribute not present on Text element"); locales.add(locale); } if (locales.isEmpty()) throw new SOAPException("no Text elements found inside Reason"); return locales.iterator(); } public String getFaultReasonText(Locale locale) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Reason"); if (locale == null) return null; if (faultstring == null) { findReasonElement(); if (faultstring == null) return null; } SOAPElement textElement = getTextElement(locale); return textElement != null ? textElement.getValue() : null; } private void findReasonElement() { faultstring = getChildElement(this, Constants.SOAP12_REASON); log.trace("findReasonElement: " + faultstring); } private SOAPElement getTextElement(Locale locale) { log.trace("getTextElement(" + locale + ")"); SOAPElement textElement = null; Iterator it = faultstring.getChildElements(Constants.SOAP12_TEXT); while (it.hasNext()) { SOAPElement element = (SOAPElement)it.next(); if (locale.equals(getLocale(element))) { textElement = element; break; } } log.trace("getTextElement : " + textElement); return textElement; } public void addFaultReasonText(String text, Locale locale) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Reason"); if (locale == null) throw new SOAPException("locale passed is null"); if (faultstring == null) { findReasonElement(); if (faultstring == null) faultstring = addQualifiedFaultElement("Reason"); } SOAPElement textElement = getTextElement(locale); if (textElement == null) { textElement = faultstring.addChildElement("Text", getPrefix(), getNamespaceURI()); setLocale(textElement, locale); } textElement.setValue(text); } /** Gets the fault actor for this SOAPFault object. */ public String getFaultActor() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { if (faultactor == null) { findFaultActorElement(); if (faultactor == null) return null; } return faultactor.getValue(); } else return getFaultRole(); } private void findFaultActorElement() { faultactor = getChildElement(this, Constants.SOAP11_FAULTACTOR); log.trace("findFaultActorElement : " + faultactor); } /** Sets this SOAPFault object with the given fault actor. */ public void setFaultActor(String faultActor) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { if (faultactor == null) { findFaultActorElement(); if (faultactor == null) faultactor = addUnqualifiedFaultElement("faultactor"); } faultactor.setValue(faultActor); } else setFaultRole(faultActor); } public String getFaultRole() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Role"); if (faultactor == null) { findRoleElement(); if (faultactor == null) return null; } return faultactor.getValue(); } private void findRoleElement() { faultactor = getChildElement(this, Constants.SOAP12_ROLE); log.trace("findRoleElement : " + faultactor); } public void setFaultRole(String uri) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Role"); if (faultactor == null) { findRoleElement(); if (faultactor == null) faultactor = addQualifiedFaultElement("Role"); } faultactor.setValue(uri); } public String getFaultNode() { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Node"); if (faultnode == null) { findNodeElement(); if (faultnode == null) return null; } return faultnode.getValue(); } private void findNodeElement() { faultnode = getChildElement(this, Constants.SOAP12_NODE); log.trace("findNodeElement : " + faultnode); } public void setFaultNode(String uri) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Fault does not support the concept of Node"); if (faultnode == null) { findNodeElement(); if (faultnode == null) faultnode = addQualifiedFaultElement("Node"); } faultnode.setValue(uri); } public boolean hasDetail() { return getDetail() != null; } /** Returns the optional detail element for this SOAPFault object. */ public Detail getDetail() { if (detail == null) { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) findSoap11DetailElement(); else findSoap12DetailElement(); } return detail; } /** Creates an optional Detail object and sets it as the Detail object for this SOAPFault object. */ public Detail addDetail() throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) { if (detail == null) findSoap11DetailElement(); if (detail != null) throw new SOAPException("this fault already contains a detail element"); detail = new DetailImpl(); } else { if (detail == null) findSoap12DetailElement(); if (detail != null) throw new SOAPException("this fault already contains a detail element"); detail = new DetailImpl(getPrefix(), getNamespaceURI()); } detail = (Detail)addChildElement(detail); return detail; } private void findSoap11DetailElement() { detail = (Detail)getChildElement(this, Constants.SOAP11_DETAIL); log.trace("findSoap11DetailElement : " + detail); } private void findSoap12DetailElement() { detail = (Detail)getChildElement(this, Constants.SOAP12_DETAIL); log.trace("findSoap12DetailElement : " + detail); } @Override public SOAPElement addChildElement(SOAPElement child) throws SOAPException { if (!(child instanceof SOAPFaultElement)) child = convertToFaultElement((SOAPElementImpl)child); return super.addChildElement(child); } private SOAPFaultElement convertToFaultElement(SOAPElementImpl element) { element.detachNode(); QName elementName = element.getElementQName(); SOAPFaultElement faultElement; if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI()) ? Constants.SOAP11_DETAIL.equals(elementName) : Constants.SOAP12_DETAIL.equals(elementName)) faultElement = new DetailImpl(element); else faultElement = new SOAPFaultElementImpl(element); log.trace("convertToFaultElement : " + faultElement); return faultElement; } QName getDefaultFaultCode() { return Constants.NS_SOAP11_ENV.equals(getNamespaceURI()) ? Constants.SOAP11_FAULT_CODE_SERVER : SOAPConstants.SOAP_RECEIVER_FAULT; } public void writeElement(Writer writer) { new DOMWriter(writer).print(this); } private static SOAPElement getChildElement(SOAPElement element, QName name) { Iterator it = element.getChildElements(name); return it.hasNext() ? (SOAPElement)it.next() : null; } private SOAPElement addUnqualifiedFaultElement(String localName) throws SOAPException { log.trace("addUnqualifiedFaultElement(" + localName + ")"); return addChildElement(new SOAPFaultElementImpl(localName)); } private SOAPElement addQualifiedFaultElement(String localName) throws SOAPException { log.trace("addQualifiedFaultElement(" + localName + ")"); return addChildElement(new SOAPFaultElementImpl(localName, getPrefix(), getNamespaceURI())); } }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SAAJVisitable.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SAAJVisitable.java0000644000175000017500000000237110542776150031327 0ustar godgod/* * 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.core.soap; /** * @author Heiko Braun * @version $Id: SAAJVisitable.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ * @since Sep 26, 2006 */ public interface SAAJVisitable { public void accept(SAAJVisitor visitor); } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/HRefInlineHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/HRefInlineHandler.0000644000175000017500000001256510650145103031357 0ustar godgod/* * 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.core.soap; //$Id: HRefInlineHandler.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.util.Iterator; import javax.xml.soap.Node; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.Text; import org.jboss.logging.Logger; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * Inline rpc/encoded hrefs * * @author Thomas.Diesler@jboss.com * @since 27-Mar-2007 */ public class HRefInlineHandler { // provide logging private static Logger log = Logger.getLogger(HRefInlineHandler.class); private SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); private SOAPBodyImpl soapBody; public HRefInlineHandler(SOAPBodyImpl soapBody) { this.soapBody = soapBody; } public void processHRefs() throws SOAPException { String bodyStr = DOMWriter.printNode(soapBody, true); log.debug("Begin processHRefs:\n" + bodyStr); SOAPBodyElement soapBodyElement = soapBody.getBodyElement(); processElement(soapBodyElement); // Process elements after SOAPBodyElement Iterator it = soapBody.getChildElements(); while (it.hasNext()) { Object next = it.next(); if (next instanceof SOAPElement) { // Remove id elements SOAPElement soapElement = (SOAPElement)next; if ((soapElement instanceof SOAPBodyElement) == false) soapBody.removeChild(soapElement); } } bodyStr = DOMWriter.printNode(soapBody, true); log.debug("End processHRefs:\n" + bodyStr); } private void processElement(SOAPElement soapElement) throws SOAPException { // Do inner first outer last Iterator it = soapElement.getChildElements(); while (it.hasNext()) { Node childElement = (Node)it.next(); if (childElement instanceof SOAPElement) processElement((SOAPElement)childElement); } String href = soapElement.getAttribute("href"); if (href.length() > 0) { processHRef(soapElement, href); soapElement.removeAttribute("href"); } } private void processHRef(SOAPElement hrefElement, String href) throws SOAPException { SOAPElement idElement = null; Iterator it = soapBody.getChildElements(); while (it.hasNext()) { Object next = it.next(); if (next instanceof SOAPElement) { SOAPElement auxElement = (SOAPElement)next; if (href.equals("#" + auxElement.getAttribute("id"))) { idElement = (SOAPElement)auxElement; break; } } } if (idElement == null) throw new IllegalStateException("Cannot get href element: " + href); // process nested hrefs processElement(idElement); // Copy most attributes, except id copyMostAttributes(hrefElement, idElement); // Append id element children if (DOMUtils.hasChildElements(idElement)) { Iterator itid = idElement.getChildElements(); while (itid.hasNext()) { Node childNode = (Node)itid.next(); if (childNode instanceof SOAPElement) { SOAPElement childClone = soapFactory.createElement((SOAPElement)childNode, true); hrefElement.addChildElement(childClone); } else if (childNode instanceof Text) { String value = childNode.getValue(); hrefElement.setValue(value); } } } // If no children, copy the value else { String value = idElement.getValue(); hrefElement.setValue(value); } } private void copyMostAttributes(Element destElement, Element srcElement) { NamedNodeMap attribs = srcElement.getAttributes(); for (int i = 0; i < attribs.getLength(); i++) { Attr attr = (Attr)attribs.item(i); String uri = attr.getNamespaceURI(); String qname = attr.getName(); String value = attr.getNodeValue(); // Do not copy the id attribute if ("id".equals(qname) == false) destElement.setAttributeNS(uri, qname, value); } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/UnboundHeader.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/UnboundHeader.java0000644000175000017500000000543710542776150031477 0ustar godgod/* * 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.core.soap; // $Id: UnboundHeader.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; /** * Represents an unbound SOAPHeaderElement * * @author Thomas.Diesler@jboss.org * @since 04-Jan-2005 */ public class UnboundHeader { private QName xmlName; private QName xmlType; private Class javaType; private ParameterMode mode; private Object headerValue; public UnboundHeader(QName xmlName, QName xmlType, Class javaType, ParameterMode mode) { this.xmlName = xmlName; this.xmlType = xmlType; this.javaType = javaType; this.mode = mode; } public QName getXmlName() { return xmlName; } public QName getXmlType() { return xmlType; } public Class getJavaType() { return javaType; } public ParameterMode getMode() { return mode; } public Object getHeaderValue() { return headerValue; } public void setHeaderValue(Object headerValue) { this.headerValue = headerValue; } public ParameterMetaData toParameterMetaData(OperationMetaData opMetaData) { ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName, xmlType, javaType.getName()); paramMetaData.setInHeader(true); return paramMetaData; } public String toString() { StringBuilder buffer = new StringBuilder("\nUnboundHeader:"); buffer.append("\n xmlName=" + getXmlName()); buffer.append("\n xmlType=" + getXmlType()); buffer.append("\n javaType=" + getJavaType().getName()); buffer.append("\n mode=" + getMode()); return buffer.toString(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/DetailImpl.java0000644000175000017500000001063710650145103030762 0ustar godgod/* * 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.core.soap; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import javax.xml.soap.Detail; import javax.xml.soap.DetailEntry; import javax.xml.soap.Name; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * A container for DetailEntry objects. DetailEntry objects give detailed error information that is application-specific * and related to the SOAPBody object that contains it. * * A Detail object, which is part of a SOAPFault object, can be retrieved using the method SOAPFault.getDetail. * * The Detail interface provides two methods. One creates a new DetailEntry object and also automatically adds * it to the Detail object. The second method gets a list of the DetailEntry objects contained in a Detail object. * * @author Thomas.Diesler@jboss.org */ public class DetailImpl extends SOAPFaultElementImpl implements Detail { // provide logging private static Logger log = Logger.getLogger(DetailImpl.class); /** Creates a SOAP 1.1 detail element. */ public DetailImpl() { super("detail"); } /** Creates a SOAP 1.2 prefix:Detail element. */ public DetailImpl(String prefix, String namespace) { super("Detail", prefix, namespace); } /** Converts the given element to a Detail. */ DetailImpl(SOAPElementImpl element) { super(element.getElementName()); // altough detail schema does not define attributes, copy them for completeness DOMUtils.copyAttributes(this, element); try { NodeList nodeList = element.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node instanceof SOAPElement) addChildElement((SOAPElement)node); else appendChild(node); } } catch (SOAPException e) { throw new WSException("Unable to create fault detail", e); } } public DetailEntry addDetailEntry(Name name) throws SOAPException { DetailEntryImpl detailEntry = new DetailEntryImpl(name); addChildElement(detailEntry); return detailEntry; } public DetailEntry addDetailEntry(QName qname) throws SOAPException { DetailEntryImpl detailEntry = new DetailEntryImpl(qname); addChildElement(detailEntry); return detailEntry; } public Iterator getDetailEntries() { List list = new ArrayList(); NodeList nodeList = getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { org.w3c.dom.Node node = nodeList.item(i); if (node instanceof DetailEntry) list.add((DetailEntry)node); } return list.iterator(); } @Override public SOAPElement addChildElement(SOAPElement child) throws SOAPException { if (!(child instanceof DetailEntry)) child = convertToDetailEntry((SOAPElementImpl)child); return super.addChildElement(child); } private static DetailEntry convertToDetailEntry(SOAPElementImpl element) { element.detachNode(); DetailEntryImpl detailEntry = new DetailEntryImpl(element); log.trace("convertToDetailEntry : " + detailEntry); return detailEntry; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/DocumentFragmentImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/DocumentFragmentIm0000644000175000017500000001214010542776150031551 0ustar godgod/* * 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.core.soap; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.UserDataHandler; /** * An implementation of a DOM Document fragment. This just delegates to * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class DocumentFragmentImpl implements DocumentFragment { private DocumentFragment delegate; public DocumentFragmentImpl(DocumentFragment fragment) { this.delegate = fragment; } public Node appendChild(Node arg0) throws DOMException { return delegate.appendChild(arg0); } public Node cloneNode(boolean arg0) { return delegate.cloneNode(arg0); } public short compareDocumentPosition(Node arg0) throws DOMException { return delegate.compareDocumentPosition(arg0); } public NamedNodeMap getAttributes() { return delegate.getAttributes(); } public String getBaseURI() { return delegate.getBaseURI(); } public NodeList getChildNodes() { return delegate.getChildNodes(); } public Object getFeature(String arg0, String arg1) { return delegate.getFeature(arg0, arg1); } public Node getFirstChild() { return delegate.getFirstChild(); } public Node getLastChild() { return delegate.getLastChild(); } public String getLocalName() { return delegate.getLocalName(); } public String getNamespaceURI() { return delegate.getNamespaceURI(); } public Node getNextSibling() { return delegate.getNextSibling(); } public String getNodeName() { return delegate.getNodeName(); } public short getNodeType() { return delegate.getNodeType(); } public String getNodeValue() throws DOMException { return delegate.getNodeValue(); } public Document getOwnerDocument() { return delegate.getOwnerDocument(); } public Node getParentNode() { return delegate.getParentNode(); } public String getPrefix() { return delegate.getPrefix(); } public Node getPreviousSibling() { return delegate.getPreviousSibling(); } public String getTextContent() throws DOMException { return delegate.getTextContent(); } public Object getUserData(String arg0) { return delegate.getUserData(arg0); } public boolean hasAttributes() { return delegate.hasAttributes(); } public boolean hasChildNodes() { return delegate.hasChildNodes(); } public Node insertBefore(Node arg0, Node arg1) throws DOMException { return delegate.insertBefore(arg0, arg1); } public boolean isDefaultNamespace(String arg0) { return delegate.isDefaultNamespace(arg0); } public boolean isEqualNode(Node arg0) { return delegate.isEqualNode(arg0); } public boolean isSameNode(Node arg0) { return delegate.isSameNode(arg0); } public boolean isSupported(String arg0, String arg1) { return delegate.isSupported(arg0, arg1); } public String lookupNamespaceURI(String arg0) { return delegate.lookupNamespaceURI(arg0); } public String lookupPrefix(String arg0) { return delegate.lookupPrefix(arg0); } public void normalize() { delegate.normalize(); } public Node removeChild(Node arg0) throws DOMException { return delegate.removeChild(arg0); } public Node replaceChild(Node arg0, Node arg1) throws DOMException { return delegate.replaceChild(arg0, arg1); } public void setNodeValue(String arg0) throws DOMException { delegate.setNodeValue(arg0); } public void setPrefix(String arg0) throws DOMException { delegate.setPrefix(arg0); } public void setTextContent(String arg0) throws DOMException { delegate.setTextContent(arg0); } public Object setUserData(String arg0, Object arg1, UserDataHandler arg2) { return delegate.setUserData(arg0, arg1, arg2); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/EnvelopeBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/EnvelopeBuilder.ja0000644000175000017500000000416010630511747031476 0ustar godgod/* * 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.core.soap; // $Id: EnvelopeBuilder.java 3400 2007-06-03 10:11:51Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.io.Reader; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.w3c.dom.Element; /** * @author Heiko Braun, * @author Thomas.Diesler@jboss.com * @since 19-Apr-2006 */ public interface EnvelopeBuilder { Style getStyle(); void setStyle(Style style); SOAPEnvelope build(SOAPMessage soapMessage, InputStream in, boolean ignoreParseError) throws IOException, SOAPException; SOAPEnvelope build(SOAPMessage soapMessage, Reader reader, boolean ignoreParseError) throws IOException, SOAPException; SOAPEnvelope build(SOAPMessage soapMessage, Element domEnv) throws SOAPException; SOAPBodyElement buildBodyElementDoc(SOAPBodyImpl soapBody, Element domBodyElement) throws SOAPException; SOAPBodyElement buildBodyElementRpc(SOAPBodyImpl soapBody, Element domBodyElement) throws SOAPException; } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPFaultElementImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPFaultElementIm0000644000175000017500000000303510574563661031370 0ustar godgod/* * 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.core.soap; import javax.xml.soap.Name; import javax.xml.soap.SOAPFaultElement; public class SOAPFaultElementImpl extends SOAPElementImpl implements SOAPFaultElement { public SOAPFaultElementImpl(String localPart) { super(localPart); } public SOAPFaultElementImpl(String localPart, String prefix, String namespace) { super(localPart, prefix, namespace); } public SOAPFaultElementImpl(Name name) { super(name); } public SOAPFaultElementImpl(SOAPElementImpl element) { super(element); } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPContent.java0000644000175000017500000000312310600057335031027 0ustar godgod/* * 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.core.soap; // $Id: $ /** * Represent SOAP message payload that can transition from * one representation to the next. * * @see SOAPContentElement * * @author Heiko.Braun@jboss.org * @since 05.02.2007 */ public abstract class SOAPContent implements SOAPContentAccess { public enum State { OBJECT_VALID, XML_VALID, DOM_VALID } abstract SOAPContent transitionTo(State nextState); abstract State getState(); protected SOAPContentElement container; protected SOAPContent(SOAPContentElement container) { this.container = container; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/AttrImpl.java0000644000175000017500000000417510542776150030506 0ustar godgod/* * 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.core.soap; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.TypeInfo; /** * Facade for DOM Attr. Helps ensure that the propper SAAJ entities are returned * after DOM calls are made. * * @author Jason T. Greene * @version $Revision: 1757 $ */ public class AttrImpl extends NodeImpl implements Attr { private SOAPElementImpl element; private Attr attr; public AttrImpl(SOAPElementImpl element, Attr attr) { super(attr); this.attr = attr; this.element = element; } public String getName() { return attr.getName(); } public Element getOwnerElement() { return element; } public Document getOwnerDocument() { return element.getOwnerDocument(); } public boolean getSpecified() { return attr.getSpecified(); } public String getValue() { return attr.getValue(); } public TypeInfo getSchemaTypeInfo() { // TODO Implement DOM3 return null; } public boolean isId() { // TODO Implement DOM3 return false; } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/MessageFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/MessageFactoryImpl0000644000175000017500000002363010661361314031557 0ustar godgod/* * 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.core.soap; // $Id: MessageFactoryImpl.java 4428 2007-08-17 18:02:52Z thomas.diesler@jboss.com $ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Collection; import java.util.Iterator; import javax.mail.internet.ContentType; import javax.mail.internet.ParseException; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MessageFactory; import javax.xml.soap.MimeHeader; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.ws.Service.Mode; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.soap.attachment.MimeConstants; import org.jboss.ws.core.soap.attachment.MultipartRelatedDecoder; import org.jboss.wsf.common.IOUtils; import org.jboss.wsf.spi.util.ServiceLoader; /** * MessageFactory implementation * * @author Thomas.Diesler@jboss.org */ public class MessageFactoryImpl extends MessageFactory { private static Logger log = Logger.getLogger(MessageFactoryImpl.class); // The envelope namespace used by the MessageFactory private String envNamespace; // The JAXWS ServiceMode private Mode serviceMode; // The style used by this MessageFactory private Style style; // Used if the style is dynamic private boolean dynamic; private EnvelopeBuilder envelopeBuilder; public MessageFactoryImpl() { envNamespace = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE; envelopeBuilder = (EnvelopeBuilder)ServiceLoader.loadService(EnvelopeBuilder.class.getName(), EnvelopeBuilderDOM.class.getName()); } public MessageFactoryImpl(String protocol) throws SOAPException { envelopeBuilder = (EnvelopeBuilder)ServiceLoader.loadService(EnvelopeBuilder.class.getName(), EnvelopeBuilderDOM.class.getName()); if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol) || SOAPConstants.DEFAULT_SOAP_PROTOCOL.equals(protocol)) envNamespace = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE; else if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) envNamespace = SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE; else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) dynamic = true; else throw new SOAPException("Unknown protocol: " + protocol); } /** * Get the SOAP envelope URI this factory will use when creating envelopes. */ public String getEnvNamespace() { return envNamespace; } /** * Set the SOAP envelope URI this factory will use when creating envelopes. */ public void setEnvNamespace(String envelopeURI) { this.envNamespace = envelopeURI; } /** * Get the Style this message factory will use */ public Style getStyle() { if (style == null) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null && msgContext.getOperationMetaData() != null) { style = msgContext.getOperationMetaData().getStyle(); } log.trace("Using style: " + style); } return style; } public void setStyle(Style style) { this.style = style; } public Mode getServiceMode() { return serviceMode; } public void setServiceMode(Mode serviceMode) { this.serviceMode = serviceMode; } /** * Creates a new SOAPMessage object with the default SOAPPart, SOAPEnvelope, * SOAPBody, and SOAPHeader objects. Profile-specific message factories can * choose to prepopulate the SOAPMessage object with profile-specific * headers. * * Content can be added to this message's SOAPPart object, and the message * can be sent "as is" when a message containing only a SOAP part is * sufficient. Otherwise, the SOAPMessage object needs to create one or more * AttachmentPart objects and add them to itself. Any content that is not in * XML format must be in an AttachmentPart object. * * @return a new SOAPMessage object * @throws javax.xml.soap.SOAPException * if a SOAP error occurs */ public SOAPMessage createMessage() throws SOAPException { if (dynamic) throw new UnsupportedOperationException("Cannot create default message when protocol is dynamic"); SOAPMessageImpl soapMessage = new SOAPMessageImpl(); SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); new SOAPEnvelopeImpl(soapPart, envNamespace, true); return soapMessage; } /** * Internalizes the contents of the given InputStream object into a new * SOAPMessage object and returns the SOAPMessage object. * * @param mimeHeaders * the transport-specific headers passed to the message in a * transport-independent fashion for creation of the message * @param ins * the InputStream object that contains the data for a message * @return a new SOAPMessage object containing the data from the given * InputStream object * @throws java.io.IOException * if there is a problem in reading data from the input stream * @throws javax.xml.soap.SOAPException * if the message is invalid */ public SOAPMessage createMessage(MimeHeaders mimeHeaders, InputStream ins) throws IOException, SOAPException { return createMessage(mimeHeaders, ins, false); } public SOAPMessage createMessage(MimeHeaders mimeHeaders, InputStream inputStream, boolean ignoreParseError) throws IOException, SOAPException { if (mimeHeaders == null) { mimeHeaders = new MimeHeaders(); } else if (log.isTraceEnabled()) { Iterator itMimeHeaders = mimeHeaders.getAllHeaders(); while (itMimeHeaders.hasNext()) { MimeHeader mh = itMimeHeaders.next(); log.trace(mh); } } ContentType contentType = getContentType(mimeHeaders); log.debug("createMessage: [contentType=" + contentType + "]"); SOAPMessageImpl soapMessage = new SOAPMessageImpl(); if (inputStream != null) { // Debug the incoming message if (log.isTraceEnabled()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); IOUtils.copyStream(baos, inputStream); byte[] bytes = baos.toByteArray(); log.trace("createMessage\n" + new String(bytes)); inputStream = new ByteArrayInputStream(bytes); } Collection attachments = null; if (isMultipartRelatedContent(contentType)) { MultipartRelatedDecoder decoder; try { decoder = new MultipartRelatedDecoder(contentType); decoder.decodeMultipartRelatedMessage(inputStream); } catch (RuntimeException rte) { throw rte; } catch (IOException ex) { throw ex; } catch (Exception ex) { throw new SOAPException("Cannot decode multipart related message", ex); } inputStream = decoder.getRootPart().getDataHandler().getInputStream(); attachments = decoder.getRelatedParts(); } else if (isSoapContent(contentType) == false) { throw new SOAPException("Unsupported content type: " + contentType); } if (mimeHeaders != null) soapMessage.setMimeHeaders(mimeHeaders); if (attachments != null) soapMessage.setAttachments(attachments); // Get the SOAPEnvelope builder envelopeBuilder.setStyle(getStyle()); // Build the payload envelopeBuilder.build(soapMessage, inputStream, ignoreParseError); } return soapMessage; } private static ContentType getContentType(MimeHeaders headers) throws SOAPException { ContentType contentType = null; try { String[] type = headers.getHeader(MimeConstants.CONTENT_TYPE); if (type != null) { contentType = new ContentType(type[0]); } else { contentType = new ContentType(MimeConstants.TYPE_SOAP11); } return contentType; } catch (ParseException e) { throw new SOAPException("Could not parse content type:" + e); } } private boolean isSoapContent(ContentType type) { String baseType = type.getBaseType(); return MimeConstants.TYPE_SOAP11.equalsIgnoreCase(baseType) || MimeConstants.TYPE_SOAP12.equalsIgnoreCase(baseType); } private boolean isMultipartRelatedContent(ContentType type) { String baseType = type.getBaseType(); return MimeConstants.TYPE_MULTIPART_RELATED.equalsIgnoreCase(baseType); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPElementImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPElementImpl.ja0000644000175000017500000007417510650145103031314 0ustar godgod/* * 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.core.soap; // $Id: SOAPElementImpl.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import java.io.Writer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.Node; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.Text; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; /** * An object representing an element of a SOAP message that is allowed but not specifically prescribed by a * SOAP specification. This interface serves as the base interface for those objects that are specifically * prescribed by a SOAP specification. * * Methods in this interface that are required to return SAAJ specific objects may "silently" replace nodes * in the tree as required to successfully return objects of the correct type. * * @author Thomas.Diesler@jboss.org */ public class SOAPElementImpl extends NodeImpl implements SOAPElement, SAAJVisitable { // provide logging private static Logger log = Logger.getLogger(SOAPElementImpl.class); // The org.w3c.dom.Element private Element element; // The element name private Name elementName; /** Called by SOAPFactory */ public SOAPElementImpl(String localPart) { super(DOMUtils.createElement(localPart, null, null)); this.element = (Element)domNode; log.trace("new SOAPElementImpl: " + getElementName()); } /** Called by SOAPFactory */ public SOAPElementImpl(String localPart, String prefix, String nsURI) { super(DOMUtils.createElement(localPart, prefix, nsURI)); this.element = (Element)domNode; log.trace("new SOAPElementImpl: " + getElementName()); } /** Called by SOAPFactory */ public SOAPElementImpl(Name name) { this(name.getLocalName(), name.getPrefix(), name.getURI()); } /** Called by SOAPFactory */ public SOAPElementImpl(QName qname) { this(qname.getLocalPart(), qname.getPrefix(), qname.getNamespaceURI()); } /** Copy constructor for converting SOAPElement types */ protected SOAPElementImpl(SOAPElementImpl element) { super(element); this.element = (Element)domNode; log.trace("new SOAPElementImpl: " + getElementName()); } /** Get the SOAPEnvelope for this SOAPElement */ public SOAPEnvelope getSOAPEnvelope() { SOAPElement soapElement = this; while (soapElement != null && (soapElement instanceof SOAPEnvelope) == false) soapElement = soapElement.getParentElement(); return (SOAPEnvelope)soapElement; } // javax.xml.soap.SOAPElement ************************************************************************************* public QName getElementQName() { return ((NameImpl)getElementName()).toQName(); } /** * Changes the name of this Element to newName if possible. SOAP Defined elements such as SOAPEnvelope, SOAPHeader, SOAPBody etc. cannot * have their names changed using this method. Any attempt to do so will result in a SOAPException being thrown. * * Callers should not rely on the element instance being renamed as is. * Implementations could end up copying the content of the SOAPElement to a renamed instance. * @param qname the new name for the Element. * @return The renamed Node * @throws SOAPException if changing the name of this Element is not allowed. */ public SOAPElement setElementQName(QName qname) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI()) || Constants.NS_SOAP12_ENV.equals(getNamespaceURI())) throw new SOAPException("Changing the name of this SOAP Element is not allowed: " + getLocalName()); return setElementQNameInternal(qname); } public SOAPElement setElementQNameInternal(QName qname) throws SOAPException { elementName = new NameImpl(qname); Document owner = domNode.getOwnerDocument(); domNode = owner.renameNode(domNode, elementName.getURI(), elementName.getQualifiedName()); element = (Element)domNode; return this.completeNamespaceDeclaration(); } /** * Adds an attribute with the specified name and value to this SOAPElement object. * * @param name a Name object with the name of the attribute * @param value a String giving the value of the attribute * @return the SOAPElement object into which the attribute was inserted * @throws javax.xml.soap.SOAPException if there is an error in creating the Attribute */ public SOAPElement addAttribute(Name name, String value) throws SOAPException { // xml:lang='en' if ("xml".equals(name.getPrefix())) { setAttribute(name.getQualifiedName(), value); } else { setAttributeNS(name.getURI(), name.getQualifiedName(), value); } return this; } public SOAPElement addAttribute(QName qname, String value) throws SOAPException { return addAttribute(new NameImpl(qname), value); } /** * Creates a new SOAPElement object initialized with the specified local name and adds the new element to this SOAPElement object. * * @param name a String giving the local name for the element * @return the new SOAPElement object that was created * @throws javax.xml.soap.SOAPException if there is an error in creating the SOAPElement object */ public SOAPElement addChildElement(String name) throws SOAPException { SOAPElement soapElement = new SOAPElementImpl(name); soapElement = addChildElement(soapElement); return soapElement; } /** * Creates a new SOAPElement object initialized with the specified local name and prefix and adds the new element to this SOAPElement object. * * @param localName a String giving the local name for the new element * @param prefix a String giving the namespace prefix for the new element * @return the new SOAPElement object that was created * @throws javax.xml.soap.SOAPException if there is an error in creating the SOAPElement object */ public SOAPElement addChildElement(String localName, String prefix) throws SOAPException { String nsURI = getNamespaceURI(prefix); if (nsURI == null) throw new IllegalArgumentException("Cannot obtain namespace URI for prefix: " + prefix); SOAPElement soapElement = new SOAPElementImpl(localName, prefix, nsURI); soapElement = addChildElement(soapElement); return soapElement; } /** * Creates a new SOAPElement object initialized with the specified local name, prefix, and URI and adds the new element to this SOAPElement object. * * @param localName a String giving the local name for the new element * @param prefix a String giving the namespace prefix for the new element * @param uri a String giving the URI of the namespace to which the new element belongs * @return the new SOAPElement object that was created * @throws javax.xml.soap.SOAPException if there is an error in creating the SOAPElement object */ public SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException { SOAPElement soapElement = new SOAPElementImpl(localName, prefix, uri); soapElement = addChildElement(soapElement); return soapElement; } /** * Creates a new SOAPElement object initialized with the given Name object and adds the new element to this SOAPElement object. * * @param name a Name object with the XML name for the new element * @return the new SOAPElement object that was created * @throws javax.xml.soap.SOAPException if there is an error in creating the SOAPElement object */ public SOAPElement addChildElement(Name name) throws SOAPException { SOAPElement soapElement = new SOAPElementImpl(name); soapElement = addChildElement(soapElement); return soapElement; } public SOAPElement addChildElement(QName qname) throws SOAPException { return addChildElement(new NameImpl(qname)); } /** * Add a SOAPElement as a child of this SOAPElement instance. The SOAPElement is expected to be created by a * SOAPElementFactory. *

      * Callers should not rely on the element instance being added as is into the XML tree. * Implementations could end up copying the content of the SOAPElement passed into an instance of a different SOAPElement * implementation. For instance if addChildElement() is called on a SOAPHeader, element will be copied into an instance * of a SOAPHeaderElement. *

      * The fragment rooted in element is either added as a whole or not at all, if there was an error. *

      * The fragment rooted in element cannot contain elements named "Envelope", "Header" or "Body" and in the SOAP namespace. * Any namespace prefixes present in the fragment should be fully resolved using appropriate namespace declarations * within the fragment itself. * * @param child the SOAPElement to be added as a new child * @return an instance representing the new SOAP element that was actually added to the tree. * @throws javax.xml.soap.SOAPException if there was an error in adding this element as a child */ public SOAPElement addChildElement(SOAPElement child) throws SOAPException { log.trace("addChildElement: " + getElementName() + " -> " + child.getElementName()); SOAPElementImpl soapElement = (SOAPElementImpl)child; soapElement = (SOAPElementImpl)appendChild(soapElement); return soapElement.completeNamespaceDeclaration(); } /** * Adds a namespace declaration with the specified prefix and URI to this SOAPElement object. * * @param prefix a String giving the prefix of the namespace * @param nsURI a String giving the uri of the namespace * @return the SOAPElement object into which this namespace declaration was inserted. * @throws javax.xml.soap.SOAPException if there is an error in creating the namespace */ public SOAPElement addNamespaceDeclaration(String prefix, String nsURI) { if (nsURI == null) throw new IllegalArgumentException("Invalid 'null' namespace URI"); if (nsURI.length() == 0) throw new IllegalArgumentException("Invalid empty namespace URI"); String qualifiedName = "xmlns"; if (prefix != null && prefix.length() > 0) qualifiedName += ":" + prefix; log.trace("addNamespaceDeclaration: " + qualifiedName + "='" + nsURI + "'"); element.setAttributeNS("http://www.w3.org/2000/xmlns/", qualifiedName, nsURI); return this; } // Add the namespace declaration if it is not visible yet private SOAPElement completeNamespaceDeclaration() { String prefix = getPrefix(); String nsURI = getNamespaceURI(); if (prefix != null && nsURI != null) { String prevNS = getNamespaceURI(prefix); if (nsURI.equals(prevNS) == false) addNamespaceDeclaration(prefix, nsURI); } return this; } /** * Creates a new Text object initialized with the given String and adds it to this SOAPElement object. * * @param value a String object with the textual content to be added * @return the SOAPElement object into which the new Text object was inserted * @throws javax.xml.soap.SOAPException if there is an error in creating the new Text object * or if it is not legal to attach it as a child to this SOAPElement */ public SOAPElement addTextNode(String value) throws SOAPException { log.trace("addTextNode: " + value); org.w3c.dom.Node domNode; if (value.startsWith("")) { value = value.substring(4, value.length() - 3); domNode = element.getOwnerDocument().createComment(value); } else { domNode = element.getOwnerDocument().createTextNode(value); } javax.xml.soap.Text soapText = new TextImpl(domNode); appendChild(soapText); return this; } /** * Returns an Iterator over all of the attribute Name objects in this SOAPElement object. *

      * The iterator can be used to get the attribute names, which can then be passed to the method getAttributeValue to * retrieve the value of each attribute. * * @return an iterator over the names of the attributes */ public Iterator getAllAttributes() { ArrayList list = new ArrayList(); NamedNodeMap nnm = getAttributes(); for (int i = 0; i < nnm.getLength(); i++) { org.w3c.dom.Node node = (org.w3c.dom.Node)nnm.item(i); String local = node.getLocalName(); String prefix = node.getPrefix(); String uri = node.getNamespaceURI(); if ("xmlns".equals(prefix) == false) { Name name; if (uri != null && uri.length() > 0) { name = new NameImpl(local, prefix, uri); } else { name = new NameImpl(local); } list.add(name); } } return list.iterator(); } public Iterator getAllAttributesAsQNames() { ArrayList list = new ArrayList(); NamedNodeMap nnm = getAttributes(); for (int i = 0; i < nnm.getLength(); i++) { org.w3c.dom.Node node = (org.w3c.dom.Node)nnm.item(i); String local = node.getLocalName(); String prefix = node.getPrefix(); String uri = node.getNamespaceURI(); if ("xmlns".equals(prefix) == false) { QName qname; if (uri != null && uri.length() > 0) { qname = new QName(uri, local, prefix); } else { qname = new QName(local); } list.add(qname); } } return list.iterator(); } /** * Returns the value of the attribute with the specified name. * * @param name a Name object with the name of the attribute * @return a String giving the value of the specified attribute */ public String getAttributeValue(Name name) { Attr attr = getAttributeNode(name); return (attr != null ? attr.getValue() : null); } public String getAttributeValue(QName qname) { return getAttributeValue(new NameImpl(qname)); } private Attr getAttributeNode(Name name) { Attr attr = null; String nsURI = name.getURI(); if (nsURI.length() > 0) attr = element.getAttributeNodeNS(nsURI, name.getLocalName()); else attr = element.getAttributeNode(name.getLocalName()); return attr; } /** * Creates a QName whose namespace URI is the one associated with the parameter, prefix, in the context of this SOAPElement. * The remaining elements of the new QName are taken directly from the parameters, localName and prefix. * @param localName a String containing the local part of the name. * @param prefix a String containing the prefix for the name. * @return a QName with the specified localName and prefix, and with a namespace that is associated with the prefix in the context of this SOAPElement. * This namespace will be the same as the one that would be returned by getNamespaceURI(String) if it were given prefix as it's parameter. * @throws SOAPException if the QName cannot be created. * @since SAAJ 1.3 */ public QName createQName(String localName, String prefix) throws SOAPException { String nsURI = getNamespaceURI(prefix); if (nsURI == null) throw new SOAPException("CAnnot obtain namespace URI for prefix: " + prefix); return new QName(nsURI, localName, prefix); } /** * Returns an Iterator over all the immediate child Nodes of this element. *

      * This includes javax.xml.soap.Text objects as well as SOAPElement objects. * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes to be replaced by SOAPElement, * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for the type of this parent node. * As a result the calling application must treat any existing references to these child nodes that have been obtained * through DOM APIs as invalid and either discard them or refresh them with the values returned by this Iterator. * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details. * * @return an iterator with the content of this SOAPElement object */ public Iterator getChildElements() { List list = new ArrayList(); NodeList nodeList = getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { org.w3c.dom.Node node = nodeList.item(i); if (node instanceof SOAPElement) { list.add(node); } else if (node instanceof Text) { list.add(node); } } return list.iterator(); } /** * Returns an Iterator over all the immediate child Nodes of this element with the specified name. *

      * All of these children will be SOAPElement nodes. * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes to be replaced by SOAPElement, * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for the type of this parent node. * As a result the calling application must treat any existing references to these child nodes that have been obtained * through DOM APIs as invalid and either discard them or refresh them with the values returned by this Iterator. * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details. * * @param name a Name object with the name of the child elements to be returned * @return an Iterator object over all the elements in this SOAPElement object with the specified name */ public Iterator getChildElements(Name name) { return getChildElements(((NameImpl)name).toQName()); } public Iterator getChildElements(QName qname) { List list = new ArrayList(); Iterator it = getChildElements(); while (it.hasNext()) { Object elementOrTextNode = it.next(); if (elementOrTextNode instanceof SOAPElement) { SOAPElement el = (SOAPElement)elementOrTextNode; if (el.getElementQName().equals(qname)) list.add(el); } } return list.iterator(); } /** * Returns the name of this SOAPElement object. * * @return a Name object with the name of this SOAPElement object */ public Name getElementName() { if (elementName == null) { String nsURI = element.getNamespaceURI(); if (nsURI != null && nsURI.length() > 0) { String prefix = element.getPrefix(); String localName = element.getLocalName(); elementName = new NameImpl(localName, prefix, nsURI); } else { String nodeName = element.getNodeName(); elementName = new NameImpl(nodeName); } } return elementName; } /** * Returns an Iterator over the namespace prefix Strings declared by this element. *

      * The prefixes returned by this iterator can be passed to the method getNamespaceURI to retrieve the URI of each namespace. * * @return an iterator over the namespace prefixes in this SOAPElement object */ public Iterator getNamespacePrefixes() { ArrayList list = getNamespacePrefixList(); return list.iterator(); } private ArrayList getNamespacePrefixList() { ArrayList list = new ArrayList(); NamedNodeMap attrMap = element.getAttributes(); for (int i = 0; i < attrMap.getLength(); i++) { Attr attr = (Attr)attrMap.item(i); String attrName = attr.getNodeName(); if (attrName.startsWith("xmlns:")) list.add(attrName.substring(6)); } return list; } /** * Returns the URI of the namespace that has the given prefix. * * @param prefix a String giving the prefix of the namespace for which to search * @return a String with the uri of the namespace that has the given prefix */ public String getNamespaceURI(String prefix) { String nsURI = element.getAttribute("xmlns:" + prefix); if (nsURI.length() == 0 && getParentElement() != null) return getParentElement().getNamespaceURI(prefix); return (nsURI.length() > 0 ? nsURI : null); } /** * Returns an Iterator over the namespace prefix Strings visible to this element. *

      * The prefixes returned by this iterator can be passed to the method getNamespaceURI to retrieve the URI of each namespace. * * @return an iterator over the namespace prefixes are within scope of this SOAPElement object */ public Iterator getVisibleNamespacePrefixes() { ArrayList list = getNamespacePrefixList(); SOAPElementImpl parent = (SOAPElementImpl)getParentElement(); while (parent != null) { list.addAll(parent.getNamespacePrefixList()); parent = (SOAPElementImpl)parent.getParentElement(); } return list.iterator(); } /** * Removes the attribute with the specified name. * * @param name the Name object with the name of the attribute to be removed * @return true if the attribute was removed successfully; false if it was not */ public boolean removeAttribute(Name name) { Attr attr = getAttributeNode(name); if (attr != null) { element.removeAttributeNode(attr); return true; } return false; } public boolean removeAttribute(QName qname) { return removeAttribute(new NameImpl(qname)); } /** * Detaches all children of this SOAPElement. *

      * This method is useful for rolling back the construction of partially completed SOAPHeaders and SOAPBodys in * preparation for sending a fault when an error condition is detected. * It is also useful for recycling portions of a document within a SOAP message. */ public void removeContents() { log.trace("removeContents"); Iterator it = getChildElements(); while (it.hasNext()) { Node el = (Node)it.next(); el.detachNode(); } } /** * Removes the namespace declaration corresponding to the given prefix. * * @param prefix a String giving the prefix for which to search * @return true if the namespace declaration was removed successfully; false if it was not */ public boolean removeNamespaceDeclaration(String prefix) { boolean ret = getAttributeNode("xmlns:" + prefix) != null; removeAttribute("xmlns:" + prefix); return ret; } /** * Returns the encoding style for this SOAPElement object. * @return a String giving the encoding style */ public String getEncodingStyle() { // JBCTS-440 #getEncodingStyleTest1 expects the initial value of the encodingStyle property to be null String encodingStyle = getAttribute(Constants.PREFIX_ENV + ":encodingStyle"); return (encodingStyle.length() > 0 ? encodingStyle : null); } /** * Sets the encoding style for this SOAPElement object to one specified. * * @see http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383495 * @see http://www.w3.org/TR/soap12-part1/#soapencattr * * @param encodingStyle a String giving the encoding style * @throws IllegalArgumentException if there was a problem in the encoding style being set. * @throws javax.xml.soap.SOAPException if setting the encodingStyle is invalid for this SOAPElement. */ public void setEncodingStyle(String encodingStyle) throws SOAPException { String namespaceURI = getNamespaceURI(Constants.PREFIX_ENV); NameImpl name = new NameImpl("encodingStyle", Constants.PREFIX_ENV, namespaceURI); addAttribute(name, encodingStyle); } public String getTagName() { return element.getTagName(); } public void removeAttribute(String name) throws DOMException { element.removeAttribute(name); } public boolean hasAttribute(String name) { return element.hasAttribute(name); } public String getAttribute(String name) { return element.getAttribute(name); } public void removeAttributeNS(String namespaceURI, String localName) throws DOMException { element.removeAttributeNS(namespaceURI, localName); } public void setAttribute(String name, String value) throws DOMException { element.setAttribute(name, value); } public boolean hasAttributeNS(String namespaceURI, String localName) { return element.hasAttributeNS(namespaceURI, localName); } public Attr getAttributeNode(String name) { Attr attr = element.getAttributeNode(name); return (attr == null) ? null : new AttrImpl(this, attr); } public Attr removeAttributeNode(Attr oldAttr) throws DOMException { return element.removeAttributeNode(oldAttr); } public Attr setAttributeNode(Attr newAttr) throws DOMException { return element.setAttributeNode(newAttr); } public Attr setAttributeNodeNS(Attr newAttr) throws DOMException { return element.setAttributeNodeNS(newAttr); } public NodeList getElementsByTagName(String name) { return new NodeListImpl(DOMUtils.getChildElements(this, name)); } public String getAttributeNS(String namespaceURI, String localName) { return element.getAttributeNS(namespaceURI, localName); } public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { element.setAttributeNS(namespaceURI, qualifiedName, value); } public Attr getAttributeNodeNS(String namespaceURI, String localName) { /* FIXME We really need to do more than just return an object wrapper. * All Attrs should be stored as nodes on our local tree, so that * they are discovered during node traversal calls. */ Attr attr = element.getAttributeNodeNS(namespaceURI, localName); return (attr == null) ? null : new AttrImpl(this, attr); } public NodeList getElementsByTagNameNS(String namespaceURI, String localName) { return new NodeListImpl(DOMUtils.getChildElements(this, new QName(namespaceURI, localName))); } public TypeInfo getSchemaTypeInfo() { throw new NotImplementedException("getSchemaTypeInfo"); } public void setIdAttribute(String name, boolean isId) throws DOMException { throw new NotImplementedException("setIdAttribute"); } public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { throw new NotImplementedException("setIdAttributeNode"); } public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { throw new NotImplementedException("setIdAttributeNS"); } public void accept(SAAJVisitor visitor) { visitor.visitSOAPElement(this); } /** * The default implementation uses a DOMWriter. * SOAPContentElements overwrite this to optimize DOM callbacks. */ public void writeElement(Writer writer) throws IOException { String qualName = getElementName().getQualifiedName(); writer.write("<" + qualName); // namespaces Iterator nsPrefixes = getNamespacePrefixes(); while (nsPrefixes.hasNext()) { String prefix = (String)nsPrefixes.next(); writer.write(" xmlns:" + prefix + "='" + getNamespaceURI(prefix) + "'"); } // attributes Iterator attNames = getAllAttributes(); while (attNames.hasNext()) { NameImpl name = (NameImpl)attNames.next(); String attPrefix = name.getPrefix() != null ? name.getPrefix() : ""; String attFqn = attPrefix.length() > 0 ? attPrefix + ":" + name.getLocalName() : name.getLocalName(); writer.write(" " + attFqn + "='" + getAttributeValue(name) + "'"); } writer.write(">"); writeElementContent(writer); writer.write(""); } protected void writeElementContent(Writer out) throws IOException { Iterator it = getChildElements(); if (it.hasNext()) { while (it.hasNext()) { Node node = (Node)it.next(); if (node instanceof SOAPElementImpl) { ((SOAPElementImpl)node).writeElement(out); } else if (node instanceof TextImpl) { ((TextImpl)node).writeNode(out); } else { throw new WSException("Unhandled soap node: " + node.getClass().getName()); } } } else { String value = getValue(); if (value != null) out.write(value); } } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPBodyElementMessage.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPBodyElementMes0000644000175000017500000000366410650145103031357 0ustar godgod/* * 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.core.soap; import java.io.Writer; import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import javax.xml.soap.SOAPBodyElement; import org.jboss.wsf.common.DOMWriter; /** * An abstract implemenation of the SOAPBodyElement *

      * This class should not expose functionality that is not part of * {@link javax.xml.soap.SOAPBodyElement}. Client code should use SOAPBodyElement. * * @author Thomas.Diesler@jboss.org */ public class SOAPBodyElementMessage extends SOAPElementImpl implements SOAPBodyElement { public SOAPBodyElementMessage(QName name) { super(name); } public SOAPBodyElementMessage(SOAPElementImpl element) { super(element); } public void writeElement(Writer writer) { try { DOMWriter domWriter = new DOMWriter(writer); domWriter.print(this); } catch (Exception e) { throw new JAXRPCException(e); } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPBodyElementRpc.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPBodyElementRpc0000644000175000017500000000326210577755313031373 0ustar godgod/* * 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.core.soap; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPBodyElement; /** * An abstract implemenation of the SOAPBodyElement *

      * This class should not expose functionality that is not part of * {@link javax.xml.soap.SOAPBodyElement}. Client code should use SOAPBodyElement. * * @author Thomas.Diesler@jboss.org */ public class SOAPBodyElementRpc extends SOAPElementImpl implements SOAPBodyElement { public SOAPBodyElementRpc(Name name) { super(name); } public SOAPBodyElementRpc(QName qname) { super(qname); } public SOAPBodyElementRpc(SOAPElementImpl element) { super(element); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPElementWriter.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPElementWriter.0000644000175000017500000001076010650145103031342 0ustar godgod/* * 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.core.soap; // $Id: SOAPElementWriter.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; import javax.xml.soap.SOAPEnvelope; import org.jboss.ws.WSException; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; /** * Writes a SAAJ elements to an output stream. * * @author Heiko Braun * @author Thomas.Diesler@jboss.com * @since 4-Aug-2006 */ public class SOAPElementWriter { // Print writer private PrintWriter out; // True, if the XML declaration should be written private boolean writeXMLDeclaration; // Explicit character set encoding private String charsetName; public SOAPElementWriter(Writer w) { this.out = new PrintWriter(w); } public SOAPElementWriter(OutputStream stream) { try { this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); } catch (UnsupportedEncodingException e) { // ignore, UTF-8 should be available } } public SOAPElementWriter(OutputStream stream, String charsetName) { try { this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName)); this.charsetName = charsetName; } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Unsupported encoding: " + charsetName); } } /** * Set wheter the XML declaration should be written. * The default is false. */ public SOAPElementWriter setWriteXMLDeclaration(boolean writeXMLDeclaration) { this.writeXMLDeclaration = writeXMLDeclaration; return this; } /** * Print a node with explicit prettyprinting. * The defaults for all other DOMWriter properties apply. */ public static String writeElement(SOAPElementImpl element, boolean pretty) { if (element == null) return null; StringWriter strw = new StringWriter(); new SOAPElementWriter(strw).writeElement(element); String xmlStr = strw.toString(); if (pretty) { // This is expensive. Make sure it only happens for debugging try { // TODO: this unescapes sepcial chars, which might be quiet confusing // but they are actually send escaped. xmlStr = DOMWriter.printNode(DOMUtils.parse(xmlStr), true); } catch (IOException ex) { throw new WSException ("Cannot parse xml: " + xmlStr, ex); } } return xmlStr; } public void writeElement(SOAPElementImpl element) { writeElementInternal(element); } private void writeElementInternal(SOAPElementImpl element) { if (element != null) { try { if (writeXMLDeclaration == true && element instanceof SOAPEnvelope) { out.print(""); writeXMLDeclaration = false; } element.writeElement(out); out.flush(); } catch (IOException ex) { throw new WSException("Cannot write SOAP element", ex); } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPBodyImpl.java0000644000175000017500000002405010650145103031132 0ustar godgod/* * 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.core.soap; // $Id: SOAPBodyImpl.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.util.Iterator; import java.util.Locale; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFault; import javax.xml.soap.Text; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Comment; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * An object that represents the contents of the SOAP body element in a SOAP message. * A SOAP body element consists of XML data that affects the way the application-specific content is processed. * * A SOAPBody object contains SOAPBodyElement objects, which have the content for the SOAP body. * A SOAPFault object, which carries status and/or error information, is an example of a SOAPBodyElement object. * * @author Thomas.Diesler@jboss.org */ public class SOAPBodyImpl extends SOAPElementImpl implements SOAPBody { // provide logging private static Logger log = Logger.getLogger(SOAPBodyImpl.class); public SOAPBodyImpl(String prefix, String namespace) { super("Body", prefix, namespace); } /** Convert the child into a SOAPBodyElement */ public SOAPElement addChildElement(SOAPElement child) throws SOAPException { log.trace("addChildElement: " + child.getElementName()); if ((child instanceof SOAPBodyElement) == false) child = convertToBodyElement(child); child = super.addChildElement(child); return child; } public SOAPBodyElement addBodyElement(Name name) throws SOAPException { log.trace("addBodyElement: " + name); SOAPBodyElement child = new SOAPBodyElementDoc(name); return (SOAPBodyElement)addChildElement(child); } public SOAPBodyElement addBodyElement(QName qname) throws SOAPException { log.trace("addBodyElement: " + qname); SOAPBodyElement child = new SOAPBodyElementDoc(qname); return (SOAPBodyElement)addChildElement(child); } public SOAPBodyElement addDocument(Document doc) throws SOAPException { log.trace("addDocument"); Element rootElement = doc.getDocumentElement(); SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); SOAPElement soapElement = soapFactory.createElement(rootElement); return (SOAPBodyElement)addChildElement(soapElement); } public SOAPFault addFault() throws SOAPException { log.trace("addFault"); if (hasFault()) throw new SOAPException("A SOAPBody may contain at most one SOAPFault child element"); SOAPFaultImpl soapFault = new SOAPFaultImpl(getPrefix(), getNamespaceURI()); soapFault = (SOAPFaultImpl)addChildElement(soapFault); soapFault.setFaultCode(soapFault.getDefaultFaultCode()); return soapFault; } public SOAPFault addFault(Name faultCode, String faultString) throws SOAPException { log.trace("addFault"); if (hasFault()) throw new SOAPException("A SOAPBody may contain at most one SOAPFault child element"); SOAPFaultImpl soapFault = new SOAPFaultImpl(getPrefix(), getNamespaceURI()); soapFault = (SOAPFaultImpl)addChildElement(soapFault); soapFault.setFaultCode(faultCode); soapFault.setFaultString(faultString); return soapFault; } public SOAPFault addFault(QName faultCode, String faultString) throws SOAPException { log.trace("addFault"); if (hasFault()) throw new SOAPException("A SOAPBody may contain at most one SOAPFault child element"); SOAPFaultImpl soapFault = new SOAPFaultImpl(getPrefix(), getNamespaceURI()); soapFault = (SOAPFaultImpl)addChildElement(soapFault); soapFault.setFaultCode(faultCode); soapFault.setFaultString(faultString); return soapFault; } public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException { log.trace("addFault"); if (hasFault()) throw new SOAPException("A SOAPBody may contain at most one SOAPFault child element"); SOAPFaultImpl soapFault = new SOAPFaultImpl(getPrefix(), getNamespaceURI()); soapFault.setFaultCode(faultCode); soapFault.setFaultString(faultString, locale); addChildElement(soapFault); return soapFault; } public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException { log.trace("addFault"); if (hasFault()) throw new SOAPException("A SOAPBody may contain at most one SOAPFault child element"); SOAPFaultImpl soapFault = new SOAPFaultImpl(getPrefix(), getNamespaceURI()); soapFault.setFaultCode(faultCode); soapFault.setFaultString(faultString, locale); addChildElement(soapFault); return soapFault; } public SOAPFault getFault() { log.trace("getFault"); Iterator it = faultIterator(); SOAPFault soapFault = it.hasNext() ? (SOAPFault)it.next() : null; return soapFault; } public boolean hasFault() { log.trace("hasFault"); return faultIterator().hasNext(); } private Iterator faultIterator() { return getChildElements(new QName(getNamespaceURI(), "Fault")); } public SOAPBodyElement getBodyElement() { SOAPBodyElement bodyElement = null; Iterator it = getChildElements(); while (bodyElement == null && it.hasNext()) { Object next = it.next(); if (next instanceof SOAPBodyElement) bodyElement = (SOAPBodyElement)next; } return bodyElement; } public Node appendChild(Node newChild) throws DOMException { log.trace("appendChild: " + newChild.getNodeName()); if (needsConversionToBodyElement(newChild)) newChild = convertToBodyElement(newChild); return super.appendChild(newChild); } public Node insertBefore(Node newChild, Node refChild) throws DOMException { log.trace("insertBefore: " + newChild.getNodeName()); if (needsConversionToBodyElement(newChild)) newChild = convertToBodyElement(newChild); return super.insertBefore(newChild, refChild); } public Node replaceChild(Node newChild, Node oldChild) throws DOMException { log.trace("replaceChild: " + newChild.getNodeName()); if (needsConversionToBodyElement(newChild)) newChild = convertToBodyElement(newChild); return super.replaceChild(newChild, oldChild); } @Override public SOAPElement addAttribute(Name name, String value) throws SOAPException { String envNamespace = getNamespaceURI(); if (Constants.NS_SOAP12_ENV.equals(envNamespace) && name.equals(new NameImpl("encodingStyle", Constants.PREFIX_ENV, envNamespace))) throw new SOAPException("Cannot set encodingStyle on: " + getElementQName()); return super.addAttribute(name, value); } public Document extractContentAsDocument() throws SOAPException { log.trace("extractContentAsDocument"); Iterator childElements = getChildElements(); // zero child elements? if (!childElements.hasNext()) throw new SOAPException("Cannot find SOAPBodyElement"); SOAPElementImpl childElement = (SOAPElementImpl)childElements.next(); // more than one child element? if (childElements.hasNext()) throw new SOAPException("Multiple SOAPBodyElement"); if (childElement instanceof SOAPContentElement) { // cause expansion to DOM SOAPContentElement contentElement = (SOAPContentElement)childElement; // TODO change visibility of SOAPContentElement.expandToDOM() to package? contentElement.getPayload(); } // child SOAPElement is removed as part of this process childElement.detachNode(); // child element's owner document might be shared with other elements; // we have to create a separate document for returning to our caller Document newDocument = DOMUtils.getDocumentBuilder().newDocument(); Node adoptedElement = newDocument.adoptNode(childElement.domNode); newDocument.appendChild(adoptedElement); return newDocument; } private static boolean needsConversionToBodyElement(Node newChild) { // JBCTS-440 #addTextNodeTest1 appends a Text node to a SOAPBody boolean validChild = newChild instanceof SOAPBodyElement; validChild = validChild || newChild instanceof DocumentFragment; validChild = validChild || newChild instanceof Text; validChild = validChild || newChild instanceof Comment; return validChild == false; } private static SOAPBodyElementDoc convertToBodyElement(Node node) { if (!(node instanceof SOAPElementImpl)) throw new IllegalArgumentException("SOAPElement expected"); SOAPElementImpl element = (SOAPElementImpl)node; element.detachNode(); return new SOAPBodyElementDoc(element); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/DOMContent.java0000644000175000017500000000665410600057335030720 0ustar godgod/* * 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.core.soap; // $Id: $ import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import org.jboss.logging.Logger; /** * Represents the DOM_VALID state of an {@link SOAPContentElement}.
      * * @author Heiko.Braun@jboss.org * @version $Id$ * @since 05.02.2007 */ public class DOMContent extends SOAPContent { private static Logger log = Logger.getLogger(DOMContent.class); private Source payload; protected DOMContent(SOAPContentElement container) { super(container); } State getState() { return State.DOM_VALID; } SOAPContent transitionTo(State nextState) { SOAPContent next = null; if (State.XML_VALID == nextState) { log.debug("getXMLFragment from DOM"); DOMSource domSource = new DOMSource(container); XMLFragment fragment = new XMLFragment(domSource); log.debug("xmlFragment: " + fragment); SOAPContent xmlValid = new XMLContent(container); xmlValid.setXMLFragment(fragment); next = xmlValid; } else if (State.OBJECT_VALID == nextState) { // transition to xml valid first XMLFragment fragment = new XMLFragment(new DOMSource(container)); XMLContent tmpState = new XMLContent(container); tmpState.setXMLFragment(fragment); // and from XML valid to Object valid next = tmpState.transitionTo(State.OBJECT_VALID); } else if (State.DOM_VALID == nextState) { next = this; } else { throw new IllegalArgumentException("Illegal state requested: " + nextState); } return next; } public Source getPayload() { return new DOMSource(container); } public void setPayload(Source source) { if (!(source instanceof DOMSource)) throw new IllegalArgumentException("DOMSource expected, but got: " + source); this.payload = source; } public XMLFragment getXMLFragment() { throw new IllegalStateException("XMLFragment not available"); } public void setXMLFragment(XMLFragment xmlFragment) { throw new IllegalStateException("XMLFragment not available"); } public Object getObjectValue() { throw new IllegalStateException("Object value not available"); } public void setObjectValue(Object objValue) { throw new IllegalStateException("Object value not available"); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/Use.java0000644000175000017500000000426110630511747027477 0ustar godgod/* * 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.core.soap; import org.jboss.ws.Constants; // $Id: Use.java 3400 2007-06-03 10:11:51Z thomas.diesler@jboss.com $ /** A type-safe enumeration for encoding use. * * @author Thomas.Diesler@jboss.org * @since 16-Oct-2005 */ public class Use { private String use; public static final Use LITERAL = new Use("literal"); public static final Use ENCODED = new Use("encoded"); private Use(String use) { this.use = use; } public static Use getDefaultUse() { return LITERAL; } public static Use valueOf(String encodingStyle) { if (Constants.URI_LITERAL_ENC.equals(encodingStyle) || LITERAL.use.equals(encodingStyle)) return LITERAL; if (Constants.URI_SOAP11_ENC.equals(encodingStyle) || ENCODED.use.equals(encodingStyle)) return ENCODED; throw new IllegalArgumentException("Unsupported encoding style: " + encodingStyle); } public String toURI() { String encURI = null; if (this == LITERAL) encURI = Constants.URI_LITERAL_ENC; else if (this == ENCODED) encURI = Constants.URI_SOAP11_ENC; return encURI; } public String toString() { return use; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPHeaderElementImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPHeaderElementI0000644000175000017500000001544310673747600031333 0ustar godgod/* * 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.core.soap; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPHeaderElement; import org.jboss.ws.Constants; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Attr; /** * An object representing the contents in the SOAP header part of the SOAP envelope. * The immediate children of a SOAPHeader object can be represented only as SOAPHeaderElement objects. * * A SOAPHeaderElement object can have other SOAPElement objects as its children. * * @author Thomas.Diesler@jboss.org */ public class SOAPHeaderElementImpl extends SOAPContentElement implements SOAPHeaderElement { public SOAPHeaderElementImpl(Name name) { super(name); } public SOAPHeaderElementImpl(QName qname) { super(qname); } public SOAPHeaderElementImpl(SOAPElementImpl element) { super(element); } public String getRole() { final String headerURI = getParentElement().getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) throw new UnsupportedOperationException("SOAP 1.1 does not support the concept of Role"); Attr roleAttr = getAttributeNodeNS(headerURI, Constants.SOAP12_ATTR_ROLE); return roleAttr != null ? roleAttr.getValue() : null; } public void setRole(String roleURI) { final SOAPElement header = getParentElement(); final String headerURI = header.getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) throw new UnsupportedOperationException("SOAP 1.1 does not support the concept of Role"); setAttributeNS(headerURI, header.getPrefix() + ":" + Constants.SOAP12_ATTR_ROLE, roleURI); } public boolean getRelay() { final String headerURI = getParentElement().getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) throw new UnsupportedOperationException("SOAP 1.1 does not support the concept of Role"); return DOMUtils.getAttributeValueAsBoolean(this, new QName(headerURI, Constants.SOAP12_ATTR_RELAY)); } public void setRelay(boolean relay) { final SOAPElement header = getParentElement(); final String headerURI = header.getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) throw new UnsupportedOperationException("SOAP 1.1 does not support the concept of Role"); setAttributeNS(headerURI, header.getPrefix() + ":" + Constants.SOAP12_ATTR_RELAY, Boolean.toString(relay)); } public String getActor() { final String headerURI = getParentElement().getNamespaceURI(); if (!Constants.NS_SOAP11_ENV.equals(headerURI)) return getRole(); Attr actorAttr = getAttributeNodeNS(headerURI, Constants.SOAP11_ATTR_ACTOR); return actorAttr != null ? actorAttr.getValue() : null; } public void setActor(String actorURI) { final SOAPElement header = getParentElement(); final String headerURI = header.getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) setAttributeNS(headerURI, header.getPrefix() + ":" + Constants.SOAP11_ATTR_ACTOR, actorURI); else setRole(actorURI); } public boolean getMustUnderstand() { final String headerURI = getParentElement().getNamespaceURI(); return DOMUtils.getAttributeValueAsBoolean(this, new QName(headerURI, Constants.SOAP11_ATTR_MUST_UNDERSTAND)); } public void setMustUnderstand(boolean mustUnderstand) { final SOAPElement header = getParentElement(); final String headerURI = header.getNamespaceURI(); setAttributeNS(headerURI, header.getPrefix() + ":" + Constants.SOAP11_ATTR_MUST_UNDERSTAND, mustUnderstand ? "1" : "0"); } public void setParentElement(SOAPElement parent) throws SOAPException { if (parent == null) throw new SOAPException("Invalid null parent element"); if ((parent instanceof SOAPHeader) == false) throw new SOAPException("Invalid parent element: " + parent.getElementName()); super.setParentElement(parent); } @Override public void writeElement(Writer writer) throws IOException { StringWriter strwr = new StringWriter(256); super.writeElement(strwr); SOAPHeader soapHeader = (SOAPHeader)getParentElement(); SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapHeader.getParentElement(); // Find known namespace declarations List knownNamespaces = new ArrayList(); Iterator prefixes = soapEnvelope.getNamespacePrefixes(); while (prefixes.hasNext()) { String prefix = (String)prefixes.next(); String nsURI = soapEnvelope.getNamespaceURI(prefix); String xmlns = " xmlns:" + prefix + "='" + nsURI + "'"; knownNamespaces.add(xmlns); } prefixes = soapHeader.getNamespacePrefixes(); while (prefixes.hasNext()) { String prefix = (String)prefixes.next(); String nsURI = soapHeader.getNamespaceURI(prefix); String xmlns = " xmlns:" + prefix + "='" + nsURI + "'"; knownNamespaces.add(xmlns); } // Remove known namespace declarations String xmlFragment = strwr.toString(); for (String xmlns : knownNamespaces) { int start = xmlFragment.indexOf(xmlns); while (start > 0) { int end = start + xmlns.length(); xmlFragment = xmlFragment.substring(0, start) + xmlFragment.substring(end); start = xmlFragment.indexOf(xmlns); } } writer.write(xmlFragment); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageDispatcher.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageDispatc0000644000175000017500000001207210730542057031400 0ustar godgod/* * 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.core.soap; // $Id: SOAPMessageDispatcher.java 5322 2007-12-14 17:58:07Z richard.opalka@jboss.com $ import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.JAXWSAConstants; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * Derive the operation meta data from incomming SOAP message * * @author Thomas.Diesler@jboss.org * @since 22-Nov-2005 */ public class SOAPMessageDispatcher { // provide logging private static Logger log = Logger.getLogger(SOAPMessageDispatcher.class); /** Get the operation meta data for a given SOAP message */ public OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, SOAPMessage soapMessage) throws SOAPException { OperationMetaData opMetaData = null; // Dispatch based on wsa:Action CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); AddressingProperties inProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND); if (inProps != null && inProps.getAction() != null) { String wsaAction = inProps.getAction().getURI().toASCIIString(); for (OperationMetaData opAux : epMetaData.getOperations()) { if (wsaAction.equals(opAux.getSOAPAction())) { opMetaData = opAux; log.debug("Use wsa:Action dispatch: " + wsaAction); break; } } } // Dispatch to JAXWS Provider if (opMetaData == null && epMetaData.getServiceMode() != null) { QName xmlName = new QName(epMetaData.getPortName().getNamespaceURI(), "invoke"); opMetaData = epMetaData.getOperation(xmlName); } // Dispatch based on SOAPBodyElement name if (opMetaData == null) { SOAPBody soapBody = soapMessage.getSOAPBody(); SOAPBodyElement soapBodyElement = null; Iterator bodyChildren = soapBody.getChildElements(); while (bodyChildren.hasNext() && soapBodyElement == null) { Object childNode = bodyChildren.next(); if (childNode instanceof SOAPBodyElement) { soapBodyElement = (SOAPBodyElement)childNode; } } if (soapBodyElement == null) { boolean wsrmDisabled = epMetaData.getConfig().getRMMetaData() == null; if ((epMetaData.getStyle() == Style.RPC) && (wsrmDisabled)) // RM hack throw new SOAPException("Empty SOAP body with no child element not supported for RPC"); // [JBWS-1125] Support empty soap body elements for (OperationMetaData opAux : epMetaData.getOperations()) { if (opAux.getParameters().size() == 0) { log.debug ("Dispatching empty SOAP body"); opMetaData = opAux; break; } } } else { Name soapName = soapBodyElement.getElementName(); QName xmlElementName = new QName(soapName.getURI(), soapName.getLocalName()); opMetaData = epMetaData.getOperation(xmlElementName); } } // Dispatch to a generic operation that takes an org.w3c.dom.Element if (opMetaData == null) { for (OperationMetaData opAux : epMetaData.getOperations()) { if (opAux.isMessageEndpoint()) { log.debug("Use generic message style dispatch"); opMetaData = opAux; break; } } } log.debug("getDispatchDestination: " + (opMetaData != null ? opMetaData.getQName() : null)); return opMetaData; } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPFactoryImpl.ja0000644000175000017500000001520310650145103031315 0ustar godgod/* * 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.core.soap; // $Id: SOAPFactoryImpl.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.soap.Detail; import javax.xml.soap.Name; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFactory; import javax.xml.soap.SOAPFault; import org.jboss.logging.Logger; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * SOAPFactory implementation. * * @author Thomas.Diesler@jboss.org */ public class SOAPFactoryImpl extends SOAPFactory { // provide logging private static Logger log = Logger.getLogger(SOAPFactoryImpl.class); // The envelope namespace used by the SOAPFactoryImpl // JBCTS-441 null means the specified protocol was DYNAMIC_SOAP_PROTOCOL private String envNamespace; public SOAPFactoryImpl() { envNamespace = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE; } public SOAPFactoryImpl(String protocol) throws SOAPException { if (SOAPConstants.SOAP_1_2_PROTOCOL.equals(protocol)) envNamespace = SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE; else if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol)) envNamespace = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE; else if (SOAPConstants.DYNAMIC_SOAP_PROTOCOL.equals(protocol)) envNamespace = null; // JBCTS-441 #newInstanceTest4 passes "BOGUS" as the protocol and // expects us to throw SOAPException else throw new SOAPException("Unknown protocol: " + protocol); } @Override public SOAPElement createElement(Name name) throws SOAPException { return new SOAPElementImpl(name); } @Override public SOAPElement createElement(QName qname) throws SOAPException { return createElement(new NameImpl(qname)); } @Override public SOAPElement createElement(String localName) throws SOAPException { return new SOAPElementImpl(localName); } @Override public SOAPElement createElement(String localName, String prefix, String uri) throws SOAPException { return new SOAPElementImpl(localName, prefix, uri); } @Override public SOAPElement createElement(Element domElement) throws SOAPException { return createElement(domElement, true); } /** * Create a SOAPElement from a DOM Element. * This method is not part of the javax.xml.soap.SOAPFactory interface. */ public SOAPElement createElement(Element domElement, boolean deep) throws SOAPException { if (domElement == null) throw new IllegalArgumentException("Source node cannot be null"); // Can only use this optimization if we are doing a deep copy. if (domElement instanceof SOAPElement && deep==true) return (SOAPElement)domElement; String localName = domElement.getLocalName(); String prefix = domElement.getPrefix() != null ? domElement.getPrefix() : ""; String nsURI = domElement.getNamespaceURI() != null ? domElement.getNamespaceURI() : ""; SOAPFactory factory = SOAPFactory.newInstance(); SOAPElement soapElement = factory.createElement(localName, prefix, nsURI); if (domElement instanceof Element) DOMUtils.copyAttributes(soapElement, (Element)domElement); if (deep) { // Add the child elements as well NodeList nlist = domElement.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); short nodeType = child.getNodeType(); if (nodeType == Node.ELEMENT_NODE) { SOAPElement soapChild = createElement((Element)child); soapElement.addChildElement(soapChild); } else if (nodeType == Node.TEXT_NODE) { String nodeValue = child.getNodeValue(); soapElement.addTextNode(nodeValue); } else if (nodeType == Node.CDATA_SECTION_NODE) { String nodeValue = child.getNodeValue(); soapElement.addTextNode(nodeValue); } else { log.trace("Ignore child type: " + nodeType); } } } return soapElement; } @Override public Detail createDetail() throws SOAPException { assertEnvNamespace(); return SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(envNamespace) ? new DetailImpl() : new DetailImpl(SOAPConstants.SOAP_ENV_PREFIX, envNamespace); } @Override public Name createName(String localName, String prefix, String uri) throws SOAPException { return new NameImpl(localName, prefix, uri); } @Override public Name createName(String localName) throws SOAPException { return new NameImpl(localName); } @Override public SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException { assertEnvNamespace(); SOAPFaultImpl soapFault = new SOAPFaultImpl(SOAPConstants.SOAP_ENV_PREFIX, envNamespace); soapFault.setFaultCode(faultCode); soapFault.setFaultString(reasonText); return soapFault; } @Override public SOAPFault createFault() throws SOAPException { assertEnvNamespace(); SOAPFaultImpl soapFault = new SOAPFaultImpl(SOAPConstants.SOAP_ENV_PREFIX, envNamespace); soapFault.setFaultCode(soapFault.getDefaultFaultCode()); return soapFault; } private void assertEnvNamespace() { if (envNamespace == null) throw new UnsupportedOperationException("Envelope namespace not specified, use one of the SOAP protocols"); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageMarshaller.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageMarshal0000644000175000017500000000477010634204450031401 0ustar godgod/* * 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.core.soap; import java.io.IOException; import java.io.OutputStream; import javax.xml.soap.SOAPMessage; import org.jboss.logging.Logger; import org.jboss.remoting.InvocationRequest; import org.jboss.remoting.invocation.OnewayInvocation; import org.jboss.remoting.marshal.Marshaller; /** * @author Thomas.Diesler@jboss.org * @since 25-Nov-2004 */ public class SOAPMessageMarshaller implements Marshaller { // Provide logging private static Logger log = Logger.getLogger(SOAPMessageMarshaller.class); /** * Marshaller will need to take the dataObject and convert * into primitive java data types and write to the * given output. * * @param dataObject Object to be writen to output * @param output The data output to write the object * data to. */ public void write(Object dataObject, OutputStream output) throws IOException { if (dataObject instanceof InvocationRequest) dataObject = ((InvocationRequest)dataObject).getParameter(); if (dataObject instanceof OnewayInvocation) dataObject = ((OnewayInvocation)dataObject).getParameters()[0]; if ((dataObject instanceof SOAPMessage) == false) throw new IllegalArgumentException("Not a SOAPMessage: " + dataObject); SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject; soapMessage.writeTo(output); } public Marshaller cloneMarshaller() throws CloneNotSupportedException { return new SOAPMessageMarshaller(); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPEnvelopeImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPEnvelopeImpl.j0000644000175000017500000001513610642000211031316 0ustar godgod/* * 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.core.soap; // $Id: SOAPEnvelopeImpl.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.rpc.soap.SOAPFaultException; import javax.xml.soap.Name; import javax.xml.soap.Node; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPMessage; import org.jboss.ws.Constants; import org.jboss.ws.core.CommonSOAPFaultException; import org.w3c.dom.Document; /** * The container for the SOAPHeader and SOAPBody portions of a SOAPPart object. By default, a * SOAPMessage object is created with a SOAPPart object that has a SOAPEnvelope object. * The SOAPEnvelope object by default has an empty SOAPBody object and an empty SOAPHeader object. * The SOAPBody object is required, and the SOAPHeader object, though optional, is used in the majority of cases. * * @author Thomas.Diesler@jboss.org */ public class SOAPEnvelopeImpl extends SOAPElementImpl implements SOAPEnvelope { // Reference the enclosing SOAPPart, so that getOwnerDocument() works correctly private SOAPPartImpl soapPart; /** Construct a SOAP envelope for the given SOAP version URI prefix, etc. */ public SOAPEnvelopeImpl(SOAPPartImpl soapPart, SOAPElement element, boolean addHeaderAndBody) throws SOAPException { super((SOAPElementImpl)element); this.soapPart = soapPart; soapPart.setEnvelope(this); String prefix = getPrefix(); String namespaceURI = getNamespaceURI(); String localName = getLocalName(); if ("Envelope".equals(localName) == false) throw new IllegalArgumentException("Cannot create SOAP envelope from: " + element.getElementQName()); assertEnvelopeNamespace(namespaceURI); addNamespaceDeclaration(prefix, namespaceURI); if (addHeaderAndBody) { addHeader(); addBody(); } } /** Construct a SOAP envelope for the given SOAP version URI. */ SOAPEnvelopeImpl(SOAPPartImpl soapPart, String namespace, boolean addHeaderAndBody) throws SOAPException { super("Envelope", Constants.PREFIX_ENV, namespace); this.soapPart = soapPart; soapPart.setEnvelope(this); assertEnvelopeNamespace(namespace); addNamespaceDeclaration(getPrefix(), namespace); if (addHeaderAndBody) { addHeader(); addBody(); } } public SOAPMessage getSOAPMessage() { return soapPart.getSOAPMessage(); } public SOAPBody addBody() throws SOAPException { SOAPBody body = getBody(); if (body != null) throw new SOAPException("SOAPEnvelope already has a body element"); body = new SOAPBodyImpl(getPrefix(), getNamespaceURI()); addChildElement(body); return body; } public SOAPHeader addHeader() throws SOAPException { SOAPHeader header = getHeader(); if (header != null) throw new SOAPException("SOAPEnvelope already has a header element"); header = new SOAPHeaderImpl(getPrefix(), getNamespaceURI()); return (SOAPHeader)addChildElement(header); } @Override public SOAPElement addAttribute(Name name, String value) throws SOAPException { String envNamespace = getNamespaceURI(); if (Constants.NS_SOAP12_ENV.equals(envNamespace) && name.equals(new NameImpl("encodingStyle", Constants.PREFIX_ENV, envNamespace))) throw new SOAPException("Cannot set encodingStyle on: " + getElementQName()); return super.addAttribute(name, value); } /** Make sure the child is either a SOAPHeader or SOAPBody */ public SOAPElement addChildElement(SOAPElement child) throws SOAPException { String envNamespace = getNamespaceURI(); if (Constants.NS_SOAP12_ENV.equals(envNamespace) && !(child instanceof SOAPHeader) && !(child instanceof SOAPBody)) throw new SOAPException("SOAPHeader or SOAPBody expected"); return super.addChildElement(child); } public Name createName(String localName) throws SOAPException { return new NameImpl(localName); } public Name createName(String localName, String prefix, String uri) throws SOAPException { return new NameImpl(localName, prefix, uri); } public SOAPBody getBody() throws SOAPException { Iterator it = getChildElements(); while (it.hasNext()) { Node node = (Node)it.next(); if ("Body".equals(node.getLocalName())) return (SOAPBody)node; } return null; } public SOAPHeader getHeader() throws SOAPException { Iterator it = getChildElements(); while (it.hasNext()) { Node node = (Node)it.next(); if ("Header".equals(node.getLocalName())) return (SOAPHeader)node; } return null; } /** * Text nodes are not supported. */ public SOAPElement addTextNode(String value) throws SOAPException { if (value.trim().length() > 0) throw new SOAPException("Cannot add Text node to SOAPEnvelope"); return super.addTextNode(value); } public Document getOwnerDocument() { return soapPart; } private void assertEnvelopeNamespace(String namespaceURI) { if (!Constants.NS_SOAP12_ENV.equals(namespaceURI) && !Constants.NS_SOAP11_ENV.equals(namespaceURI)) { QName faultCode = Constants.SOAP11_FAULT_CODE_VERSION_MISMATCH; String faultString = "Invalid SOAP envelope namespace: " + namespaceURI; throw new CommonSOAPFaultException(faultCode, faultString); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/XMLFragment.java0000644000175000017500000001672110660617420031071 0ustar godgod/* * 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.core.soap; // $Id: $ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.StringWriter; import java.io.Writer; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.binding.BufferedStreamResult; import org.jboss.ws.core.jaxrpc.binding.BufferedStreamSource; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Element; /** * A XMLFragment represent an XML {@link Source}. * * The basic idea is that any {@link SOAPContentElement} XML_VALID state * (either before unmarshalling or after marshalling) is represented through a single interface.
      * * @see SOAPContentElement * @see XMLContent * * @author Heiko.Braun@jboss.org * @author Thomas.Diesler@jboss.org * @since 05-Feb-2007 */ public class XMLFragment { // provide logging private static Logger log = Logger.getLogger(XMLFragment.class); private Source source; private final static String XML_PROC = "jbossws.SOAPMessage==TRACE */ private void writeSourceInternal(Writer writer) throws IOException { try { source = beginSourceAccess(source); if (source instanceof DOMSource) { DOMSource domSource = (DOMSource)source; new DOMWriter(writer).print(domSource.getNode()); } else if (source instanceof StreamSource || source instanceof SAXSource) { StreamSource streamSource = (StreamSource)source; Reader reader = streamSource.getReader(); { if (reader == null) reader = new InputStreamReader(streamSource.getInputStream()); } char[] cbuf = new char[1024]; int len = reader.read(cbuf); int off = 0; if (len == -1) throw new IOException("StreamSource already exhausted"); // Remove XML processing instruction String xmlProc = new String(cbuf, 0, XML_PROC.length()); if (XML_PROC.equals(xmlProc)) { off = XML_PROC.length(); while (cbuf[off] != '>' && off < len) off++; if (cbuf[off] != '>') throw new IllegalStateException("Cannot find end of XML processing instruction"); off++; len -= off; } while (len > 0) { writer.write(cbuf, off, len); len = reader.read(cbuf); off = 0; } } else { throw new IllegalArgumentException("Unsupported source type: " + source); } endSourceAccess(); } catch (IOException ex) { handleSourceAccessException(ex); } } private Source beginSourceAccess(Source source) { // no need to buffer those if (source instanceof BufferedStreamSource || source instanceof DOMSource) return source; // Buffer the source content if (source instanceof StreamSource) { source = new BufferedStreamSource((StreamSource)source); } else { try { Element element = DOMUtils.sourceToElement(source); source = new DOMSource(element); } catch (IOException ex) { WSException.rethrow(ex); } } return source; } private void endSourceAccess() { // Create the marker exception if (source instanceof StreamSource) { streamSourceAccessMarker = new RuntimeException(); } } private void handleSourceAccessException(IOException ex) { if (source instanceof StreamSource && streamSourceAccessMarker != null) { log.error("StreamSource was previously accessed from", streamSourceAccessMarker); } WSException.rethrow(ex); } public String toString() { return "[source=" + source + "]"; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/EnvelopeBuilderDOM.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/EnvelopeBuilderDOM0000644000175000017500000003220310650145103031433 0ustar godgod/* * 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.core.soap; //$Id: EnvelopeBuilderDOM.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.io.Reader; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPMessage; import javax.xml.transform.dom.DOMSource; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonSOAPFaultException; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Comment; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; /** * A SOAPEnvelope builder for JAXRPC based on DOM * * @author Heiko Braun, * @author Thomas.Diesler@jboss.com * @since 19-Apr-2006 */ public class EnvelopeBuilderDOM implements EnvelopeBuilder { // provide logging private static Logger log = Logger.getLogger(EnvelopeBuilderDOM.class); private SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); private Style style; public Style getStyle() { return style; } public void setStyle(Style style) { this.style = style; } public SOAPEnvelope build(SOAPMessage soapMessage, InputStream ins, boolean ignoreParseError) throws IOException, SOAPException { // Parse the XML input stream Element domEnv = null; try { domEnv = DOMUtils.parse(ins); } catch (IOException ex) { if (ignoreParseError) { return null; } QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT; throw new CommonSOAPFaultException(faultCode, ex.getMessage()); } return build(soapMessage, domEnv); } public SOAPEnvelope build(SOAPMessage soapMessage, Reader reader, boolean ignoreParseError) throws IOException, SOAPException { // Parse the XML input stream Element domEnv = null; try { domEnv = DOMUtils.parse(new InputSource(reader)); } catch (IOException ex) { if (ignoreParseError) { return null; } QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT; throw new CommonSOAPFaultException(faultCode, ex.getMessage()); } return build(soapMessage, domEnv); } public SOAPEnvelope build(SOAPMessage soapMessage, Element domEnv) throws SOAPException { // Construct the envelope SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); SOAPEnvelopeImpl soapEnv = new SOAPEnvelopeImpl(soapPart, soapFactory.createElement(domEnv, false), false); DOMUtils.copyAttributes(soapEnv, domEnv); NodeList envChildNodes = domEnv.getChildNodes(); for (int i = 0; i < envChildNodes.getLength(); i++) { Node child = envChildNodes.item(i); short childType = child.getNodeType(); if (childType == Node.ELEMENT_NODE) { String elName = child.getLocalName(); if ("Header".equals(elName)) { buildSOAPHeader(soapEnv, (Element)child); } else if ("Body".equals(elName)) { buildSOAPBody(soapEnv, (Element)child); } else { log.warn("Ignore envelope child: " + elName); } } } return soapEnv; } private SOAPHeader buildSOAPHeader(SOAPEnvelopeImpl soapEnv, Element domHeader) throws SOAPException { SOAPHeader soapHeader = soapEnv.getHeader(); if (soapHeader == null) soapHeader = soapEnv.addHeader(); DOMUtils.copyAttributes(soapHeader, domHeader); NodeList headerChildNodes = domHeader.getChildNodes(); for (int i = 0; i < headerChildNodes.getLength(); i++) { Node child = headerChildNodes.item(i); short childType = child.getNodeType(); if (childType == Node.ELEMENT_NODE) { Element srcElement = (Element)child; XMLFragment xmlFragment = new XMLFragment(new DOMSource(srcElement)); Name name = new NameImpl(srcElement.getLocalName(), srcElement.getPrefix(), srcElement.getNamespaceURI()); SOAPContentElement destElement = new SOAPHeaderElementImpl(name); soapHeader.addChildElement(destElement); DOMUtils.copyAttributes(destElement, srcElement); destElement.setXMLFragment(xmlFragment); } else { log.warn("Ignore child type: " + childType); } } return soapHeader; } private SOAPBody buildSOAPBody(SOAPEnvelopeImpl soapEnv, Element domBody) throws SOAPException { String envNS = soapEnv.getNamespaceURI(); SOAPBodyImpl soapBody = (SOAPBodyImpl)soapEnv.getBody(); if (soapBody == null) soapBody = (SOAPBodyImpl)soapEnv.addBody(); DOMUtils.copyAttributes(soapBody, domBody); SOAPBodyElement soapBodyElement = null; boolean attachHRefElements = Constants.URI_SOAP11_ENC.equals(soapEnv.getAttributeNS(envNS, "encodingStyle")); NodeList bodyChildNodes = domBody.getChildNodes(); for (int i = 0; i < bodyChildNodes.getLength(); i++) { Node child = bodyChildNodes.item(i); short childType = child.getNodeType(); if (childType == Node.ELEMENT_NODE) { if (soapBodyElement == null) { soapBodyElement = buildSOAPBodyElement(soapEnv, (Element)child); attachHRefElements = attachHRefElements || Constants.URI_SOAP11_ENC.equals(soapBody.getAttributeNS(envNS, "encodingStyle")); } else if (attachHRefElements) { // Process additional soap encoded body elements soapBody.addChildElement(soapFactory.createElement((Element)child, true)); } } else if (childType == Node.COMMENT_NODE) { appendCommentNode(soapBody, child); } else if (childType == Node.TEXT_NODE) { appendTextNode(soapBody, child); } else { log.warn("Ignore child type: " + childType); } } // Inline all attached href elements if (attachHRefElements) { HRefInlineHandler inlineHandler = new HRefInlineHandler(soapBody); inlineHandler.processHRefs(); } return soapBody; } private SOAPBodyElement buildSOAPBodyElement(SOAPEnvelopeImpl soapEnv, Element domBodyElement) throws SOAPException { String envNS = soapEnv.getNamespaceURI(); String envPrefix = soapEnv.getPrefix(); SOAPBodyImpl soapBody = (SOAPBodyImpl)soapEnv.getBody(); QName beName = DOMUtils.getElementQName(domBodyElement); SOAPBodyElement soapBodyElement = null; // Process a message if (beName.equals(new QName(envNS, "Fault"))) { SOAPFaultImpl soapFault = new SOAPFaultImpl(envPrefix, envNS); soapBody.addChildElement(soapFault); soapBodyElement = soapFault; DOMUtils.copyAttributes(soapFault, domBodyElement); // copy everything and let soapFault discover child elements itself XMLFragment xmlFragment = new XMLFragment(new DOMSource(domBodyElement)); soapFault.setXMLFragment(xmlFragment); } // Process and RPC or DOCUMENT style message else { if (style == Style.DOCUMENT) { buildBodyElementDoc(soapBody, domBodyElement); } else if (style == Style.RPC) { soapBodyElement = buildBodyElementRpc(soapBody, domBodyElement); } else if (style == null) { buildBodyElementDefault(soapBody, domBodyElement); } else { throw new WSException("Unsupported message style: " + style); } } return soapBodyElement; } public SOAPBodyElement buildBodyElementDoc(SOAPBodyImpl soapBody, Element domBodyElement) throws SOAPException { Element srcElement = (Element)domBodyElement; QName beName = DOMUtils.getElementQName(domBodyElement); SOAPBodyElementDoc soapBodyElement = new SOAPBodyElementDoc(beName); SOAPContentElement contentElement = (SOAPContentElement)soapBody.addChildElement(soapBodyElement); DOMUtils.copyAttributes(contentElement, srcElement); XMLFragment xmlFragment = new XMLFragment(new DOMSource(srcElement)); contentElement.setXMLFragment(xmlFragment); return soapBodyElement; } public SOAPBodyElement buildBodyElementRpc(SOAPBodyImpl soapBody, Element domBodyElement) throws SOAPException { QName beName = DOMUtils.getElementQName(domBodyElement); SOAPBodyElementRpc soapBodyElement = new SOAPBodyElementRpc(beName); soapBodyElement = (SOAPBodyElementRpc)soapBody.addChildElement(soapBodyElement); DOMUtils.copyAttributes(soapBodyElement, domBodyElement); NodeList nlist = domBodyElement.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); short childType = child.getNodeType(); if (childType == Node.ELEMENT_NODE) { Element srcElement = (Element)child; Name name = new NameImpl(srcElement.getLocalName(), srcElement.getPrefix(), srcElement.getNamespaceURI()); SOAPContentElement destElement = new SOAPContentElement(name); destElement = (SOAPContentElement)soapBodyElement.addChildElement(destElement); DOMUtils.copyAttributes(destElement, srcElement); XMLFragment xmlFragment = new XMLFragment(new DOMSource(srcElement)); destElement.setXMLFragment(xmlFragment); } else if (childType == Node.COMMENT_NODE) { appendCommentNode(soapBodyElement, child); } else if (childType == Node.TEXT_NODE) { appendTextNode(soapBodyElement, child); } else { log.warn("Ignore child type: " + childType); } } return soapBodyElement; } public SOAPBodyElement buildBodyElementDefault(SOAPBodyImpl soapBody, Element domBodyElement) throws SOAPException { QName beName = DOMUtils.getElementQName(domBodyElement); SOAPBodyElement soapBodyElement = new SOAPBodyElementMessage(beName); soapBodyElement = (SOAPBodyElementMessage)soapBody.addChildElement(soapBodyElement); DOMUtils.copyAttributes(soapBodyElement, domBodyElement); NodeList nlist = domBodyElement.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); short childType = child.getNodeType(); if (childType == Node.ELEMENT_NODE) { SOAPElement soapElement = soapFactory.createElement((Element)child); soapBodyElement.addChildElement(soapElement); } else if (childType == Node.COMMENT_NODE) { appendCommentNode(soapBodyElement, child); } else if (childType == Node.TEXT_NODE) { appendTextNode(soapBodyElement, child); } else if (childType == Node.CDATA_SECTION_NODE) { String nodeValue = child.getNodeValue(); soapBodyElement.addTextNode(nodeValue); } else { log.warn("Ignore child type: " + childType); } } return soapBodyElement; } private void appendCommentNode(SOAPElement soapElement, Node child) { String nodeValue = child.getNodeValue(); Document ownerDoc = soapElement.getOwnerDocument(); Comment comment = ownerDoc.createComment(nodeValue); soapElement.appendChild(comment); } private void appendTextNode(SOAPElement soapElement, Node child) throws SOAPException { String nodeValue = child.getNodeValue(); soapElement.addTextNode(nodeValue); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/EnvelopeBuilderStax.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/EnvelopeBuilderSta0000644000175000017500000003533510630511747031565 0ustar godgod/* * 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.core.soap; // $Id: EnvelopeBuilderStax.java 3400 2007-06-03 10:11:51Z thomas.diesler@jboss.com $ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFault; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPMessage; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.transform.stream.StreamSource; import org.jboss.util.NotImplementedException; import org.w3c.dom.Element; import com.ctc.wstx.stax.WstxInputFactory; /** * A SOAPEnvelope builder for JAXRPC based on Stax * * @author Heiko Braun, * @author Thomas.Diesler@jboss.com * @since 15-Apr-2006 */ public class EnvelopeBuilderStax implements EnvelopeBuilder { private static final String END_ELEMENT_BRACKET = ""; private static final String START_ELEMENT_BRACKET = "<"; private static final String HEADER_ELEMENT_NAME = "Header"; private static final String BODY_ELEMENT_NAME = "Body"; private static final String FAULT_ELEMENT_NAME = "Fault"; private static enum Part { ENVELOPE, HEADER, BODY, FAULT, RPC_PAYLOAD, DOC_PAYLOAD, BARE_PAYLOAD } private Part currentPart = Part.ENVELOPE; private Part previousPart = null; // saaj private SOAPPartImpl soapPart; private SOAPEnvelopeImpl soapEnv; private StringBuffer fragmentBuffer; private QName fragmentRootCursor = null; private QName currentRootElement = null; private XMLStreamReader reader; private static XMLInputFactory factory; public EnvelopeBuilderStax() { resetFragmentBuffer(); } private void resetFragmentBuffer() { this.fragmentBuffer = new StringBuffer(); this.fragmentBuffer.ensureCapacity(2048); } public SOAPEnvelope build(SOAPMessage soapMessage, InputStream in, boolean ignoreParseError) throws IOException, SOAPException { try { reader = getFactoryInstance().createXMLStreamReader(in); } catch (XMLStreamException e) { throw new IOException("Failed to create stream reader:" + e.getMessage()); } try { soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); while (reader.hasNext()) { if (reader.isStartElement()) { processStartElement(); } else if (reader.isCharacters()) { processCharacters(); } else if (reader.isEndElement()) { processEndElement(); } reader.next(); } } catch (XMLStreamException e) { if (!ignoreParseError) throw new IOException("Failed to parse stream: " + e.getMessage()); } finally { try { if (reader != null) reader.close(); } catch (XMLStreamException e) { // ignore } } return soapEnv; } private static synchronized XMLInputFactory getFactoryInstance() { if (null == factory) { System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory"); //System.setProperty("javax.xml.stream.XMLInputFactory", "com.sun.xml.stream.ZephyrParserFactory"); factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE); ((WstxInputFactory)factory).configureForSpeed(); } return factory; } private void processCharacters() throws SOAPException { if (fragmentRootCursor != null) consumeCharacters(); } private void consumeCharacters() throws SOAPException { String text = normalize(reader.getText()); if (!atPartMargin() && !reader.isWhiteSpace()) { fragmentBuffer.append(text); if (Part.FAULT == currentPart) { String localName = currentRootElement.getLocalPart(); SOAPFault fault = soapEnv.getBody().getFault(); if ("faultcode".equalsIgnoreCase(localName)) fault.setFaultCode(text); else if ("faultactor".equalsIgnoreCase(localName)) fault.setFaultActor(text); else if ("faultstring".equalsIgnoreCase(localName)) fault.setFaultString(text); } } } private void processEndElement() throws SOAPException { if (fragmentRootCursor != null) consumeEndElement(); } private void consumeEndElement() throws SOAPException { QName qName = reader.getName(); fragmentBuffer.append(END_ELEMENT_BRACKET); fragmentBuffer.append(getFQElementName(qName)); fragmentBuffer.append(CLOSING_BRACKET); if (fragmentRootCursor != null && fragmentRootCursor.equals(qName)) { flushBuffer(); fragmentRootCursor = null; } } private void flushBuffer() throws SOAPException { if (Part.HEADER == currentPart) { SOAPHeader soapHeader = soapEnv.getHeader(); SOAPContentElement lastHeaderElement = (SOAPContentElement)soapHeader.getChildNodes().item(soapHeader.getChildNodes().getLength() - 1); lastHeaderElement.setXMLFragment(bufferToFragment(fragmentBuffer)); } else if (Part.BODY == currentPart) { SOAPBody soapBody = soapEnv.getBody(); SOAPContentElement lastBodyElement = (SOAPContentElement)soapBody.getChildNodes().item(soapBody.getChildNodes().getLength() - 1); lastBodyElement.setXMLFragment(bufferToFragment(fragmentBuffer)); } else if (Part.FAULT == currentPart) { SOAPBody soapBody = soapEnv.getBody(); SOAPContentElement faultElement = (SOAPContentElement)soapBody.getFault(); faultElement.setXMLFragment(bufferToFragment(fragmentBuffer)); } resetFragmentBuffer(); } // TODO: this is rubbish. Use Source internally instead... private XMLFragment bufferToFragment(StringBuffer fragmentBuffer) { StreamSource source = new StreamSource(new ByteArrayInputStream(fragmentBuffer.toString().getBytes())); return new XMLFragment(source); } private void processStartElement() throws SOAPException { QName qName = reader.getName(); currentRootElement = qName; // identify current envelope part togglePartMargin(qName); // toggle current element Element destElement = null; if (Part.ENVELOPE == currentPart) { // setup envelope impl soapEnv = new SOAPEnvelopeImpl(soapPart, qName.getNamespaceURI(), false); destElement = soapEnv; // soapEnv becomes current } else if (Part.HEADER == currentPart) { if (atPartMargin()) { // the env:Header element itself SOAPHeader soapHeader = soapEnv.getHeader(); destElement = soapHeader; // header becomes current previousPart = Part.HEADER; } else { // child element of env:Header if (fragmentRootCursor == null) { Name name = new NameImpl(qName.getLocalPart(), qName.getPrefix(), qName.getNamespaceURI()); SOAPContentElement headerElement = new SOAPHeaderElementImpl(name); soapEnv.getHeader().addChildElement(headerElement); destElement = headerElement; // headerElement becomes current fragmentRootCursor = qName; } consumeStartElement(); } } else if (Part.BODY == currentPart) { SOAPBody soapBody = soapEnv.getBody(); if (atPartMargin()) { // the env:Body element destElement = soapBody; previousPart = Part.BODY; } else { // payload not fault Name bodyElementName = new NameImpl(qName.getLocalPart(), qName.getPrefix(), qName.getNamespaceURI()); if (fragmentRootCursor == null) { SOAPBodyElementDoc docBodyElement = new SOAPBodyElementDoc(bodyElementName); docBodyElement = (SOAPBodyElementDoc)soapBody.addChildElement(docBodyElement); destElement = docBodyElement; fragmentRootCursor = qName; } consumeStartElement(); } } else if (Part.FAULT == currentPart) { // payload is fault if (atPartMargin()) { SOAPBody soapBody = soapEnv.getBody(); SOAPFaultImpl soapFault = new SOAPFaultImpl(soapEnv.getPrefix(), soapEnv.getNamespaceURI()); soapBody.addChildElement(soapFault); destElement = soapFault; previousPart = Part.FAULT; } if (fragmentRootCursor == null) { fragmentRootCursor = qName; } consumeStartElement(); } if (fragmentRootCursor == null) // constructing soap elements { copyAttributes(destElement); } } private void togglePartMargin(QName qName) { // identify the current part if (qName.getLocalPart().equalsIgnoreCase(HEADER_ELEMENT_NAME)) { previousPart = currentPart; currentPart = Part.HEADER; } else if (qName.getLocalPart().equalsIgnoreCase(BODY_ELEMENT_NAME)) { previousPart = currentPart; currentPart = Part.BODY; } else if (qName.getLocalPart().equalsIgnoreCase(FAULT_ELEMENT_NAME)) { previousPart = currentPart; currentPart = Part.FAULT; } } private void consumeStartElement() { QName qName = reader.getName(); // element fragmentBuffer.append(START_ELEMENT_BRACKET); fragmentBuffer.append(getFQElementName(qName)); // local namespaces for (int x = 0; x < reader.getNamespaceCount(); x++) { if (reader.getNamespacePrefix(x) != null) { fragmentBuffer.append(" xmlns:"); fragmentBuffer.append(reader.getNamespacePrefix(x)).append("='"); fragmentBuffer.append(reader.getNamespaceURI(x)).append("'"); } else if (reader.getNamespaceURI(x) != null) { fragmentBuffer.append(" xmlns='"); fragmentBuffer.append(reader.getNamespaceURI(x)).append("'"); } } // attributes if (reader.getAttributeCount() > 0) { for (int i = 0; i < reader.getAttributeCount(); i++) { QName attQName = reader.getAttributeName(i); fragmentBuffer.append(" ").append(getFQElementName(attQName)); fragmentBuffer.append("='").append(reader.getAttributeValue(i)).append("'"); } } fragmentBuffer.append(CLOSING_BRACKET); } private String getFQElementName(QName qName) { return !qName.getPrefix().equals(EMPTY_STRING) ? qName.getPrefix() + ":" + qName.getLocalPart() : qName.getLocalPart(); } private void copyAttributes(Element destElement) { if (reader.getAttributeCount() == 0) return; for (int i = 0; i < reader.getAttributeCount(); i++) { destElement.setAttributeNS(reader.getAttributeNamespace(i), reader.getAttributeLocalName(i), reader.getAttributeValue(i)); } } private boolean atPartMargin() { return previousPart != currentPart; } private static String normalize(String valueStr) { // We assume most strings will not contain characters that need "escaping", // and optimize for this case. boolean found = false; int i = 0; outer: for (; i < valueStr.length(); i++) { switch (valueStr.charAt(i)) { case '<': case '>': case '&': case '"': found = true; break outer; } } if (!found) return valueStr; // Resume where we left off StringBuilder builder = new StringBuilder(); builder.append(valueStr.substring(0, i)); for (; i < valueStr.length(); i++) { char c = valueStr.charAt(i); switch (c) { case '<': builder.append("<"); break; case '>': builder.append(">"); break; case '&': builder.append("&"); break; case '"': builder.append("""); break; default: builder.append(c); } } return builder.toString(); } public SOAPEnvelope build(SOAPMessage soapMessage, Reader reader, boolean ignoreParseError) throws IOException, SOAPException { throw new NotImplementedException(); } public SOAPEnvelope build(SOAPMessage soapMessage, Element domEnv) throws SOAPException { throw new NotImplementedException(); } public SOAPBodyElement buildBodyElementDoc(SOAPBodyImpl soapBody, Element domBodyElement) throws SOAPException { throw new NotImplementedException(); } public SOAPBodyElement buildBodyElementRpc(SOAPBodyImpl soapBody, Element domBodyElement) throws SOAPException { throw new NotImplementedException(); } public Style getStyle() { throw new NotImplementedException(); } public void setStyle(Style style) { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageUnMarshaller.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageUnMarsh0000644000175000017500000000450210741424331031361 0ustar godgod/* * 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.core.soap; // $Id: SOAPMessageUnMarshaller.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.InputStream; import java.util.Map; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.logging.Logger; import org.jboss.remoting.marshal.UnMarshaller; /** * @author Thomas.Diesler@jboss.org * @since 25-Nov-2004 */ public class SOAPMessageUnMarshaller implements UnMarshaller { // Provide logging private static Logger log = Logger.getLogger(SOAPMessageUnMarshaller.class); public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException { if (log.isTraceEnabled()) log.trace("Read input stream with metadata=" + metadata); try { SOAPMessage soapMsg = new MessageFactoryImpl().createMessage(null, inputStream, true); return soapMsg; } catch (SOAPException e) { log.error("Cannot unmarshall SOAPMessage", e); IOException e2 = new IOException(e.toString()); e2.initCause(e); throw e2; } } public void setClassLoader(ClassLoader classloader) { } public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException { return new SOAPMessageUnMarshaller(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/XMLContent.java0000644000175000017500000003040310650145103030722 0ustar godgod/* * 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.core.soap; // $Id: $ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Array; import java.lang.reflect.Method; import java.util.List; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.transform.Source; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.binding.AbstractDeserializerFactory; import org.jboss.ws.core.binding.DeserializerSupport; import org.jboss.ws.core.binding.SerializationContext; import org.jboss.ws.core.binding.TypeMappingImpl; import org.jboss.ws.core.jaxws.SerializationContextJAXWS; import org.jboss.ws.core.soap.attachment.SwapableMemoryDataSource; import org.jboss.ws.core.utils.MimeUtils; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.wsf.common.DOMUtils; import org.jboss.wsf.common.JavaUtils; import org.w3c.dom.Comment; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Represents the XML_VALID state of an {@link SOAPContentElement}.
      * Aggregates a {@link XMLFragment}. * * @author Heiko.Braun@jboss.org * @since 05.02.2007 */ class XMLContent extends SOAPContent { private static final Logger log = Logger.getLogger(XMLContent.class); // The well formed XML content of this element. private XMLFragment xmlFragment; protected XMLContent(SOAPContentElement container) { super(container); } State getState() { return State.XML_VALID; } SOAPContent transitionTo(State nextState) { SOAPContent next; if (nextState == State.XML_VALID) { next = this; } else if (nextState == State.OBJECT_VALID) { Object obj = unmarshallObjectContents(); SOAPContent objectValid = new ObjectContent(container); objectValid.setObjectValue(obj); next = objectValid; } else if (nextState == State.DOM_VALID) { try { expandContainerChildren(); } catch (SOAPException ex) { throw new WSException("Cannot expand container children", ex); } next = new DOMContent(container); } else { throw new IllegalArgumentException("Illegal state requested: " + nextState); } return next; } public Source getPayload() { return xmlFragment.getSource(); } public void setPayload(Source source) { xmlFragment = new XMLFragment(source); } public XMLFragment getXMLFragment() { return xmlFragment; } public void setXMLFragment(XMLFragment xmlFragment) { this.xmlFragment = xmlFragment; } public Object getObjectValue() { throw new IllegalStateException("Object value not available"); } public void setObjectValue(Object objValue) { throw new IllegalStateException("Object value not available"); } private Object unmarshallObjectContents() { Object obj; QName xmlType = container.getXmlType(); Class javaType = container.getJavaType(); log.debug("getObjectValue [xmlType=" + xmlType + ",javaType=" + javaType + "]"); CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext == null) throw new WSException("MessageContext not available"); SerializationContext serContext = msgContext.getSerializationContext(); ParameterMetaData pmd = container.getParamMetaData(); OperationMetaData opMetaData = pmd.getOperationMetaData(); serContext.setProperty(ParameterMetaData.class.getName(), pmd); serContext.setJavaType(javaType); List registeredTypes = opMetaData.getEndpointMetaData().getRegisteredTypes(); serContext.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES, registeredTypes.toArray(new Class[0])); try { // Get the deserializer from the type mapping TypeMappingImpl typeMapping = serContext.getTypeMapping(); AbstractDeserializerFactory deserializerFactory = getDeserializerFactory(typeMapping, javaType, xmlType); DeserializerSupport des = (DeserializerSupport)deserializerFactory.getDeserializer(); obj = des.deserialize(container, serContext); if (obj != null) { Class objType = obj.getClass(); boolean isAssignable = JavaUtils.isAssignableFrom(javaType, objType); if (!isAssignable && javaType.isArray()) { try { Method toArrayMethod = objType.getMethod("toArray"); Class returnType = toArrayMethod.getReturnType(); if (JavaUtils.isAssignableFrom(javaType, returnType)) { Method getValueMethod = objType.getMethod("getValue"); Object value = getValueMethod.invoke(obj); if (value != null) { // Do not invoke toArray if getValue returns null obj = toArrayMethod.invoke(obj); } else { // if the fragment did not indicate a null return // by an xsi:nil we return an empty array Class componentType = javaType.getComponentType(); obj = Array.newInstance(componentType, 0); } isAssignable = true; } } catch (Exception e) { // ignore } } if (!isAssignable) { // handle XOP simple types, i.e. in RPC/LIT try { String contentType = MimeUtils.resolveMimeType(javaType); log.debug("Adopt DataHandler to " + javaType + ", contentType " + contentType); DataSource ds = new SwapableMemoryDataSource(((DataHandler)obj).getInputStream(), contentType); DataHandler dh = new DataHandler(ds); obj = dh.getContent(); // 'application/octet-stream' will return a byte[] instead fo the stream if (obj instanceof InputStream) { ByteArrayOutputStream bout = new ByteArrayOutputStream(); dh.writeTo(bout); obj = bout.toByteArray(); } } catch (IOException e) { throw new WSException("Failed to adopt XOP content type", e); } if (!JavaUtils.isAssignableFrom(javaType, obj.getClass())) { throw new WSException("Java type '" + javaType + "' is not assignable from: " + objType.getName()); } } } } catch (BindingException e) { throw new WSException(e); } log.debug("objectValue: " + (obj != null ? obj.getClass().getName() : null)); return obj; } // Get the deserializer factory for a given javaType and xmlType private static AbstractDeserializerFactory getDeserializerFactory(TypeMappingImpl typeMapping, Class javaType, QName xmlType) { AbstractDeserializerFactory deserializerFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(javaType, xmlType); // The type mapping might contain a mapping for the array wrapper bean if (deserializerFactory == null && javaType.isArray()) { Class arrayWrapperType = typeMapping.getJavaType(xmlType); if (arrayWrapperType != null) { try { Method toArrayMethod = arrayWrapperType.getMethod("toArray"); Class returnType = toArrayMethod.getReturnType(); if (JavaUtils.isAssignableFrom(javaType, returnType)) { deserializerFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(arrayWrapperType, xmlType); } } catch (NoSuchMethodException e) { // ignore } } } if (deserializerFactory == null) throw new WSException("Cannot obtain deserializer factory for: [xmlType=" + xmlType + ",javaType=" + javaType + "]"); return deserializerFactory; } /** * Turn the xml fragment into a DOM repersentation and append * all children to the container. */ private void expandContainerChildren() throws SOAPException { // Do nothing if the source of the XMLFragment is the container itself Element domElement = xmlFragment.toElement(); if (domElement == container) return; // Make sure the content root element name matches this element name QName qname = container.getElementQName(); QName contentRootName = DOMUtils.getElementQName(domElement); boolean artificalElement = (SOAPContentElement.GENERIC_PARAM_NAME.equals(qname) || SOAPContentElement.GENERIC_RETURN_NAME.equals(qname)); if (!artificalElement && !contentRootName.equals(qname)) throw new WSException("Content root name does not match element name: " + contentRootName + " != " + qname); // Remove all child nodes container.removeContents(); // In case of dispatch and provider we use artifical element names // These need to be replaced (costly!) if (artificalElement) { container.setElementQNameInternal(contentRootName); } Document ownerDoc = container.getOwnerDocument(); DOMUtils.copyAttributes(container, domElement); SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); NodeList nlist = domElement.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); short childType = child.getNodeType(); if (childType == Node.ELEMENT_NODE) { SOAPElement soapElement = soapFactory.createElement((Element)child); container.addChildElement(soapElement); if (Constants.NAME_XOP_INCLUDE.equals(qname) || container.isXOPParameter()) XOPContext.inlineXOPData(soapElement); } else if (childType == Node.TEXT_NODE) { String nodeValue = child.getNodeValue(); container.addTextNode(nodeValue); } else if (childType == Node.COMMENT_NODE) { String nodeValue = child.getNodeValue(); Comment comment = ownerDoc.createComment(nodeValue); container.appendChild(comment); } else if (childType == Node.CDATA_SECTION_NODE) { String nodeValue = child.getNodeValue(); container.addTextNode(nodeValue); } else { log.trace("Ignore child type: " + childType); } } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/MessageContextAssociation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/MessageContextAsso0000644000175000017500000000547110561611275031606 0ustar godgod/* * 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.core.soap; // $Id: MessageContextAssociation.java 2275 2007-02-05 11:19:25Z heiko.braun@jboss.com $ import java.util.Stack; import org.jboss.logging.Logger; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.utils.ThreadLocalAssociation; /** * A thread local association with the current message context * * @author Thomas.Diesler@jboss.org * @since 14-Dec-2004 */ public class MessageContextAssociation { // provide logging private static Logger log = Logger.getLogger(MessageContextAssociation.class); public static void pushMessageContext(CommonMessageContext msgContext) { if(log.isDebugEnabled()) log.debug("pushMessageContext: " + msgContext + " (Thread " +Thread.currentThread().getName()+ ")"); Stack stack = ThreadLocalAssociation.localMsgContextAssoc().get(); if (stack == null) { stack = new Stack(); ThreadLocalAssociation.localMsgContextAssoc().set(stack); } stack.push(msgContext); } public static CommonMessageContext peekMessageContext() { CommonMessageContext msgContext = null; Stack stack = ThreadLocalAssociation.localMsgContextAssoc().get(); if (stack != null && stack.isEmpty() == false) { msgContext = stack.peek(); } return msgContext; } public static CommonMessageContext popMessageContext() { CommonMessageContext msgContext = null; Stack stack = ThreadLocalAssociation.localMsgContextAssoc().get(); if (stack != null && stack.isEmpty() == false) { msgContext = stack.pop(); } if(log.isDebugEnabled()) log.debug("popMessageContext: " + msgContext +" (Thread " +Thread.currentThread().getName()+ ")"); return msgContext; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPMessageImpl.ja0000644000175000017500000003710510716057127031312 0ustar godgod/* * 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.core.soap; // $Id: SOAPMessageImpl.java 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ import java.io.IOException; import java.io.OutputStream; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.mail.MessagingException; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MimeHeader; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFault; import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.SOAPMessageAbstraction; import org.jboss.ws.core.soap.attachment.AttachmentPartImpl; import org.jboss.ws.core.soap.attachment.CIDGenerator; import org.jboss.ws.core.soap.attachment.MimeConstants; import org.jboss.ws.core.soap.attachment.MultipartRelatedEncoder; import org.jboss.ws.core.soap.attachment.MultipartRelatedSwAEncoder; import org.jboss.ws.core.soap.attachment.MultipartRelatedXOPEncoder; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * The root class for all SOAP messages. As transmitted on the "wire", a SOAP message is an XML document or a * MIME message whose first body part is an XML/SOAP document. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene */ public class SOAPMessageImpl extends SOAPMessage implements SOAPMessageAbstraction { private boolean saveRequired = true; private MimeHeaders mimeHeaders = new MimeHeaders(); private List attachments = new LinkedList(); private CIDGenerator cidGenerator = new CIDGenerator(); private boolean isXOPMessage; private boolean isSWARefMessage; private SOAPPartImpl soapPart; private MultipartRelatedEncoder multipartRelatedEncoder; // Cache the associated operation meta data private OperationMetaData opMetaData; SOAPMessageImpl() throws SOAPException { soapPart = new SOAPPartImpl(this); setProperty(CHARACTER_SET_ENCODING, "UTF-8"); setProperty(WRITE_XML_DECLARATION, false); } public CIDGenerator getCidGenerator() { return cidGenerator; } public boolean isXOPMessage() { return isXOPMessage; } public void setXOPMessage(boolean isXOPMessage) { this.isXOPMessage = isXOPMessage; } public boolean isSWARefMessage() { return isSWARefMessage; } public void setSWARefMessage(boolean isSWAMessage) { this.isSWARefMessage = isSWAMessage; } public void setAttachments(Collection parts) throws SOAPException { for (AttachmentPart part : parts) { attachments.add(part); } saveRequired = true; } public void addAttachmentPart(AttachmentPart part) { if (part == null) return; attachments.add(part); saveRequired = true; } public AttachmentPart getAttachmentByContentId(String cid) throws SOAPException { for (AttachmentPart part : attachments) { String contentId = part.getContentId(); if (contentId.equals(cid)) return part; } return null; } public AttachmentPart removeAttachmentByContentId(String cid) { for (AttachmentPart part : attachments) { String contentId = part.getContentId(); if (contentId.equals(cid)) { attachments.remove(part); return part; } } return null; } public AttachmentPart getAttachmentByPartName(String partName) { for (AttachmentPart part : attachments) { String contentId = part.getContentId(); if (contentId.startsWith("<" + partName + "=")) return part; } return null; } public AttachmentPart createAttachmentPart() { return new AttachmentPartImpl(); } public String getContentDescription() { String[] value = mimeHeaders.getHeader(MimeConstants.CONTENT_DESCRIPTION); return (value == null) ? null : value[0]; } public void setContentDescription(String description) { mimeHeaders.setHeader(MimeConstants.CONTENT_DESCRIPTION, description); } public MimeHeaders getMimeHeaders() { return mimeHeaders; } public void setMimeHeaders(MimeHeaders headers) { if (headers == null) throw new IllegalArgumentException("MimeHeaders cannot be null"); this.mimeHeaders = headers; } public SOAPPart getSOAPPart() { return soapPart; } public void removeAllAttachments() { attachments.clear(); saveRequired = true; } public int countAttachments() { return attachments.size(); } public Iterator getAttachments() { // Someone could call remove on this iterator, affecting the attachment count saveRequired = true; return attachments.iterator(); } public Iterator getAttachments(MimeHeaders headers) { if (headers == null) throw new WSException("MimeHeaders can not be null"); return new MimeMatchingAttachmentsIterator(headers, attachments); } private String getSOAPContentType() throws SOAPException { //Check binding type in the endpoint metadata CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext != null && Constants.SOAP12HTTP_BINDING.equalsIgnoreCase(msgContext.getEndpointMetaData().getBindingId())) { return SOAPConstants.SOAP_1_2_CONTENT_TYPE; } //Check the message envelope SOAPEnvelope env = soapPart != null ? soapPart.getEnvelope() : null; if (env != null && SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(env.getNamespaceURI())) { return SOAPConstants.SOAP_1_2_CONTENT_TYPE; } //Default to soap 1.1 return SOAPConstants.SOAP_1_1_CONTENT_TYPE; } public void saveChanges() throws SOAPException { if (saveRequired == true) { try { boolean hasAttachments = attachments.size() > 0; if (isXOPMessage() && !XOPContext.isMTOMEnabled() && hasAttachments) throw new IllegalStateException("XOP parameter not properly inlined"); // default content-type String contentType = getSOAPContentType() + "; charset=" + getCharSetEncoding(); if (hasAttachments) { if (isXOPMessage() && XOPContext.isMTOMEnabled()) { multipartRelatedEncoder = new MultipartRelatedXOPEncoder(this); multipartRelatedEncoder.encodeMultipartRelatedMessage(); contentType = multipartRelatedEncoder.getContentType(); } else { multipartRelatedEncoder = new MultipartRelatedSwAEncoder(this); multipartRelatedEncoder.encodeMultipartRelatedMessage(); contentType = multipartRelatedEncoder.getContentType(); } } mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, contentType); } catch (MessagingException ex) { throw new SOAPException(ex); } /* * We are lazily encoding our message, which means that currently * Content-Length is not being calculated. This should not be a problem * because HTTP/1.1 does not require that it be sent (WS Basic Profile 1.1 * states that implementations SHOULD send HTTP 1.1). If it is determined * that it must be sent, this perhaps should be done by the transport * layer. However, there could be a space optimization where length is * precalulated per attachment, and that calculation would, of course, * belong here. */ saveRequired = false; } CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if(msgContext!=null) msgContext.setModified(true); } public boolean saveRequired() { return saveRequired; } public void writeTo(OutputStream outs) throws IOException { try { // Save all changes saveChanges(); // If there are attachments then we delegate encoding to MultipartRelatedEncoder if (attachments.size() > 0) { multipartRelatedEncoder.writeTo(outs); } else { SOAPEnvelope soapEnv = getSOAPPart().getEnvelope(); if (soapEnv != null) { boolean writeXML = isWriteXMLDeclaration(); String charsetEncoding = getCharSetEncoding(); SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding); writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv); } } } catch (SOAPException ex) { WSException.rethrow(ex); } } private String getCharSetEncoding() throws SOAPException { String charsetName = (String)getProperty(CHARACTER_SET_ENCODING); if (charsetName == null) charsetName = "UTF-8"; return charsetName; } /** Get the operation meta data for this SOAP message */ public OperationMetaData getOperationMetaData(EndpointMetaData epMetaData) throws SOAPException { if (opMetaData == null) { SOAPMessageDispatcher dispatcher = new SOAPMessageDispatcher(); opMetaData = dispatcher.getDispatchDestination(epMetaData, this); } return opMetaData; } public boolean isFaultMessage() { SOAPFault soapFault = null; try { soapFault = getSOAPBody().getFault(); } catch (Exception ignore) { } return soapFault != null; } private boolean isWriteXMLDeclaration() throws SOAPException { Boolean booleanValue = new Boolean(false); Object propValue = getProperty(WRITE_XML_DECLARATION); if (propValue instanceof Boolean) booleanValue = (Boolean)propValue; if (propValue instanceof String) booleanValue = new Boolean((String)propValue); return booleanValue.booleanValue(); } public static class MimeMatchingAttachmentsIterator implements Iterator { private Iterator iterator; private MimeHeaders headers = new MimeHeaders(); private AttachmentPart lastMatch; public MimeMatchingAttachmentsIterator(MimeHeaders headers, List attachments) { iterator = attachments.iterator(); if (headers != null) this.headers = headers; } private boolean containsAllHeaders(Iterator headerIterator, AttachmentPart part) { while (headerIterator.hasNext()) { MimeHeader header = (MimeHeader)headerIterator.next(); String[] values = part.getMimeHeader(header.getName()); if (values == null) return false; boolean match = false; for (int j = 0; j < values.length; j++) { if (values[j].equalsIgnoreCase(header.getValue())) { match = true; break; } } if (!match) return false; } return true; } private void nextMatch() { while (iterator.hasNext()) { AttachmentPart part = (AttachmentPart)iterator.next(); if (containsAllHeaders(headers.getAllHeaders(), part)) { lastMatch = part; break; } } } public boolean hasNext() { if (lastMatch == null) nextMatch(); return lastMatch != null; } public Object next() { if (!hasNext()) return null; Object retval = lastMatch; lastMatch = null; return retval; } public void remove() { iterator.remove(); } } @Override public AttachmentPart getAttachment(SOAPElement element) throws SOAPException { String ref = element.getAttribute("href"); if (ref.length() == 0) { ref = element.getValue(); if (ref == null || ref.length() == 0) return null; } return getAttachmentByRef(ref); } private AttachmentPart getAttachmentByRef(String ref) throws SOAPException { AttachmentPart attachment; if (ref.startsWith("cid:")) { /* SwA 2000-12-11 section 3: if a Content-ID header is present, then an absolute URI * label for the part is formed using the CID URI scheme * * WS-I AP 1.0 section 3.5: when using the CID URI scheme, the syntax and rules defined * in RFC 2392 apply. */ String cid = '<' + ref.substring("cid:".length()) + '>'; attachment = getAttachmentByContentId(cid); } else { /* SwA 2000-12-11 section 3: If a Content-Location header is present with an absolute URI * value then that URI is a label for the part */ attachment = getAttachmentByContentLocation(ref); } if (attachment == null) { // autogenerated CID based on part name attachment = getAttachmentByPartName(ref); } return attachment; } /** * Looks for the first {@linkplain AttachmentPart attachment} where the * {@linkplain AttachmentPart#getContentLocation() content location} matches the * given location. * @param location the content location to match * @return the matching attachment or null if no match was found */ private AttachmentPart getAttachmentByContentLocation(String location) { for (AttachmentPart attachment : attachments) { if (location.equals(attachment.getContentLocation())) return attachment; } return null; } @Override public void removeAttachments(MimeHeaders headers) { /* this code exploits the fact that MimeMatchingAttachmentsIterator.next() returns null * rather than throwing an exception when there are no more elements */ Iterator attachmentItr = new MimeMatchingAttachmentsIterator(headers, attachments); while (attachmentItr.next() != null) attachmentItr.remove(); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPHeaderImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SOAPHeaderImpl.jav0000644000175000017500000002470410613124357031301 0ustar godgod/* * 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.core.soap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPHeaderElement; import javax.xml.soap.Text; import org.jboss.ws.Constants; import org.jboss.ws.core.utils.SAAJUtils; import org.w3c.dom.Comment; import org.w3c.dom.DOMException; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Node; /** * A representation of the SOAP header element. A SOAP header element consists of XML data that affects the way the * application-specific content is processed by the message provider. For example, transaction semantics, * authentication information, and so on, can be specified as the content of a SOAPHeader object. * * @author Thomas.Diesler@jboss.org */ public class SOAPHeaderImpl extends SOAPElementImpl implements SOAPHeader { public SOAPHeaderImpl(String prefix, String namespace) { super("Header", prefix, namespace); } /** Add a SOAPHeaderElement as a child of this SOAPHeader instance. */ public SOAPElement addChildElement(SOAPElement child) throws SOAPException { QName qname = child.getElementQName(); if (qname == null || qname.getNamespaceURI().length() == 0) throw new SOAPException("Invalid SOAPHeaderElement name: " + qname); // Check that we get a SOAPHeaderElement if ((child instanceof SOAPHeaderElement) == false) child = convertToHeaderElement(child); return super.addChildElement(child); } /** Attaching a Text node is not legal. */ @Override public SOAPElement addTextNode(String value) throws SOAPException { // JBCTS-440 #addTextNodeTest2 adds a text node to a SOAPHeader and expects a SOAPException if (Constants.NS_SOAP12_ENV.equals(getNamespaceURI())) throw new SOAPException("Attaching a Text node to this SOAP 1.2 Element is not legal: " + getLocalName()); return super.addTextNode(value); } /** Creates a new SOAPHeaderElement object initialized with the specified name and adds it to this SOAPHeader object. */ public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException { if (name == null) throw new SOAPException("Invalid SOAPHeaderElement name: " + name); return addHeaderElement(((NameImpl)name).toQName()); } public SOAPHeaderElement addHeaderElement(QName qname) throws SOAPException { if (qname == null || qname.getNamespaceURI().length() == 0 || qname.getPrefix().length() == 0) throw new SOAPException("Invalid SOAPHeaderElement name: " + qname); SOAPHeaderElementImpl headerElement = new SOAPHeaderElementImpl(qname); addChildElement(headerElement); return headerElement; } /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object. */ public Iterator examineAllHeaderElements() { // make a defensive copy ArrayList list = new ArrayList(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); list.add(shElement); } return list.iterator(); } /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified actor. */ public Iterator examineHeaderElements(String actor) { if (actor == null) throw new IllegalArgumentException("Invalid actor: " + actor); // make a defensive copy ArrayList list = new ArrayList(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); if (actor.equals(shElement.getActor())) list.add(shElement); } return list.iterator(); } /** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified * actor and that have a MustUnderstand attribute whose value is equivalent to true. */ public Iterator examineMustUnderstandHeaderElements(String actor) { if (actor == null) throw new IllegalArgumentException("Invalid actor: " + actor); // make a defensive copy ArrayList list = new ArrayList(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); if (actor.equals(shElement.getActor()) && shElement.getMustUnderstand()) list.add(shElement); } return list.iterator(); } public Iterator extractAllHeaderElements() { // make a defensive copy ArrayList list = new ArrayList(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); removeChild(shElement); list.add(shElement); } return list.iterator(); } public Iterator extractHeaderElements(String actor) { if (actor == null) throw new IllegalArgumentException("Invalid actor: " + actor); // make a defensive copy ArrayList list = new ArrayList(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); if (actor.equals(shElement.getActor())) { removeChild(shElement); list.add(shElement); } } return list.iterator(); } public Node appendChild(Node newChild) throws DOMException { if (needsConversionToHeaderElement(newChild)) newChild = convertToHeaderElement(newChild); return super.appendChild(newChild); } public Node insertBefore(Node newChild, Node refChild) throws DOMException { if (needsConversionToHeaderElement(newChild)) newChild = convertToHeaderElement(newChild); return super.insertBefore(newChild, refChild); } public Node replaceChild(Node newChild, Node oldChild) throws DOMException { if (needsConversionToHeaderElement(newChild)) newChild = convertToHeaderElement(newChild); return super.replaceChild(newChild, oldChild); } public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException("SOAP 1.1 Header does not support the concept of NotUnderstood"); // create NotUnderstood header block QName notUnderstoodName = new QName(getNamespaceURI(), "NotUnderstood", getPrefix()); SOAPHeaderElement notUnderstoodElement = addHeaderElement(notUnderstoodName); // set qname attribute SAAJUtils.setQualifiedAttributeValue(notUnderstoodElement, "qname", qname); return notUnderstoodElement; } public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSoapUris) throws SOAPException { if (supportedSoapUris == null) throw new SOAPException("list of supported URIs cannot be null"); if (!supportedSoapUris.hasNext()) throw new SOAPException("list of supported URIs cannot be empty"); final String namespaceURI = getNamespaceURI(); final String prefix = getPrefix(); // create Upgrade header block QName upgradeName = new QName(namespaceURI, "Upgrade", prefix); SOAPHeaderElement upgradeElement = addHeaderElement(upgradeName); while (supportedSoapUris.hasNext()) { String soapUri = (String)supportedSoapUris.next(); SOAPElement supportedElement = upgradeElement.addChildElement("SupportedEnvelope", prefix, namespaceURI); SAAJUtils.setQualifiedAttributeValue(supportedElement, "qname", new QName(soapUri, "Envelope")); } return upgradeElement; } public SOAPHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) throws SOAPException { if (supportedSoapUris == null) throw new SOAPException("list of supported URIs cannot be null"); return addUpgradeHeaderElement(Arrays.asList(supportedSoapUris).iterator()); } public SOAPHeaderElement addUpgradeHeaderElement(String supportedSoapUri) throws SOAPException { if (supportedSoapUri == null) throw new SOAPException("supported URI cannot be null"); return addUpgradeHeaderElement(Collections.singletonList(supportedSoapUri).iterator()); } private static boolean needsConversionToHeaderElement(Node newChild) { // JBCTS-440 #addTextNodeTest2 appends a Text node to a SOAPHeader boolean validChild = newChild instanceof SOAPHeaderElementImpl; validChild = validChild || newChild instanceof DocumentFragment; validChild = validChild || newChild instanceof Text; validChild = validChild || newChild instanceof Comment; return validChild == false; } private static SOAPHeaderElementImpl convertToHeaderElement(Node node) { if (!(node instanceof SOAPElementImpl)) throw new IllegalArgumentException("SOAPElement expected"); SOAPElementImpl element = (SOAPElementImpl)node; // convert to SOAPHeaderElement element.detachNode(); return new SOAPHeaderElementImpl(element); } }libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/soap/SAAJVisitor.java0000644000175000017500000000250010542776150031036 0ustar godgod/* * 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.core.soap; /** * @author Heiko Braun * @version $Id: SAAJVisitor.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ * @since Sep 26, 2006 */ public interface SAAJVisitor { void visitSOAPElement(SOAPElementImpl soapElement); void visitSOAPContentElement(SOAPContentElement scElement); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/0000755000175000017500000000000010755000267026437 5ustar godgod././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServiceEndpointI0000644000175000017500000001423610642000211031562 0ustar godgod/* * 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.core.server; // $Id: ServiceEndpointInvokerEJB21.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.core.CommonBinding; import org.jboss.ws.core.CommonBindingProvider; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.EndpointInvocation; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.invocation.HandlerCallback; import org.jboss.wsf.spi.invocation.Invocation; import org.jboss.wsf.spi.invocation.InvocationContext; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Handles invocations on EJB21 endpoints. * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class ServiceEndpointInvokerEJB21 extends ServiceEndpointInvoker { // provide logging private static final Logger log = Logger.getLogger(ServiceEndpointInvokerEJB21.class); @Override protected Invocation setupInvocation(Endpoint ep, EndpointInvocation epInv, InvocationContext invContext) throws Exception { Invocation inv = super.setupInvocation(ep, epInv, invContext); // Attach the handler callback ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); invContext.addAttachment(HandlerCallback.class, new HandlerCallbackImpl(sepMetaData)); return inv; } /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ @Override public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { if (type == HandlerType.PRE) return delegate.callRequestHandlerChain(sepMetaData, type); else return true; } /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ @Override public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { if (type == HandlerType.PRE) return delegate.callResponseHandlerChain(sepMetaData, type); else return true; } /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ @Override public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex) { if (type == HandlerType.PRE) return delegate.callFaultHandlerChain(sepMetaData, type, ex); else return true; } // The ServiceEndpointInterceptor calls the methods in this callback public class HandlerCallbackImpl implements HandlerCallback { private ServerEndpointMetaData sepMetaData; public HandlerCallbackImpl(ServerEndpointMetaData sepMetaData) { this.sepMetaData = sepMetaData; } /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ public boolean callRequestHandlerChain(Invocation wsInv, HandlerType type) { boolean handlerPass = true; if (type == HandlerType.ENDPOINT) { handlerPass = delegate.callRequestHandlerChain(sepMetaData, type); } else if (type == HandlerType.POST) { handlerPass = delegate.callRequestHandlerChain(sepMetaData, type); // Verify that the the message has not been mofified CommonMessageContext messageContext = MessageContextAssociation.peekMessageContext(); if(handlerPass && messageContext.isModified()) { try { OperationMetaData opMetaData = messageContext.getOperationMetaData(); CommonBindingProvider bindingProvider = new CommonBindingProvider(opMetaData.getEndpointMetaData()); CommonBinding binding = bindingProvider.getCommonBinding(); log.debug("Handler modified payload, unbind message and update invocation args"); EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, messageContext.getMessageAbstraction()); wsInv.getInvocationContext().addAttachment(EndpointInvocation.class, epInv); } catch (BindingException ex) { throw new WSException(ex); } } } return handlerPass; } /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ public boolean callResponseHandlerChain(Invocation wsInv, HandlerType type) { if (type == HandlerType.PRE) return true; else return delegate.callResponseHandlerChain(sepMetaData, type); } /** Handlers are beeing called through the HandlerCallback from the EJB interceptor */ public boolean callFaultHandlerChain(Invocation wsInv, HandlerType type, Exception ex) { if (type == HandlerType.PRE) return true; else return delegate.callFaultHandlerChain(sepMetaData, type, ex); } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServiceEndpointInvoker.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServiceEndpointI0000644000175000017500000004571710754336662031624 0ustar godgod/* * 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.core.server; // $Id: ServiceEndpointInvoker.java 5659 2008-02-12 15:39:30Z alessio.soldano@jboss.com $ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.UndeclaredThrowableException; import java.util.HashMap; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.rpc.server.ServiceLifecycle; import javax.xml.rpc.server.ServletEndpointContext; import javax.xml.soap.Name; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.ws.WebServiceContext; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.http.HTTPBinding; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.CommonBinding; import org.jboss.ws.core.CommonBindingProvider; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.CommonSOAPBinding; import org.jboss.ws.core.CommonSOAPFaultException; import org.jboss.ws.core.DirectionHolder; import org.jboss.ws.core.EndpointInvocation; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.DirectionHolder.Direction; import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl; import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC; import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC; import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC; import org.jboss.ws.core.jaxws.binding.BindingProviderImpl; import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS; import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS; import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.SOAPBodyImpl; import org.jboss.ws.core.soap.SOAPMessageImpl; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.extensions.wsrm.server.RMInvocationHandler; import org.jboss.ws.extensions.xop.XOPContext; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.common.JavaUtils; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.deployment.Deployment.DeploymentType; import org.jboss.wsf.spi.invocation.Invocation; import org.jboss.wsf.spi.invocation.InvocationContext; import org.jboss.wsf.spi.invocation.InvocationHandler; import org.jboss.wsf.spi.invocation.InvocationType; import org.jboss.wsf.spi.invocation.WebServiceContextFactory; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** An implementation handles invocations on the endpoint * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class ServiceEndpointInvoker { // provide logging private static final Logger log = Logger.getLogger(ServiceEndpointInvoker.class); protected Endpoint endpoint; protected CommonBindingProvider bindingProvider; protected ServerHandlerDelegate delegate; private WebServiceContextFactory contextFactory; public ServiceEndpointInvoker() { SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); contextFactory = spiProvider.getSPI(WebServiceContextFactory.class); } /** Initialize the service endpoint */ public void init(Endpoint endpoint) { this.endpoint = endpoint; ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); if (sepMetaData == null) throw new IllegalStateException("Cannot obtain endpoint meta data"); if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC) { bindingProvider = new CommonBindingProvider(sepMetaData); delegate = new HandlerDelegateJAXRPC(sepMetaData); } else { bindingProvider = new BindingProviderImpl(sepMetaData); delegate = new HandlerDelegateJAXWS(sepMetaData); } } public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { return delegate.callRequestHandlerChain(sepMetaData, type); } public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { return delegate.callResponseHandlerChain(sepMetaData, type); } public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type) { delegate.closeHandlerChain(sepMetaData, type); } public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex) { return delegate.callFaultHandlerChain(sepMetaData, type, ex); } /** Invoke the the service endpoint */ public void invoke(InvocationContext invContext) throws Exception { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)msgContext.getEndpointMetaData(); MessageAbstraction reqMessage = msgContext.getMessageAbstraction(); // The direction of the message DirectionHolder direction = new DirectionHolder(Direction.InBound); // Get the order of pre/post handlerchains HandlerType[] handlerType = delegate.getHandlerTypeOrder(); HandlerType[] faultType = delegate.getHandlerTypeOrder(); // Set the required inbound context properties setInboundContextProperties(); try { boolean oneway = false; EndpointInvocation sepInv = null; OperationMetaData opMetaData = null; CommonBinding binding = bindingProvider.getCommonBinding(); binding.setHeaderSource(delegate); // call the request handler chain boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]); // Unbind the request message if (handlersPass) { // Get the operation meta data from the SOAP message opMetaData = getDispatchDestination(sepMetaData, reqMessage); msgContext.setOperationMetaData(opMetaData); oneway = opMetaData.isOneWay(); /* * From JAX-WS 10.2.1 - "7. If the node does not understand how to process * the message, then neither handlers nor the endpoint * are invoked and instead the binding generates a SOAP must * understand exception" * * Therefore, this must precede the ENDPOINT chain; however, The PRE * chain still must happen first since the message may be encrypted, in which * case the operation is still not known. Without knowing the operation, it * is not possible to determine what headers are understood by the endpoint. */ if (binding instanceof CommonSOAPBinding) ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData); // Unbind the request message sepInv = binding.unbindRequestMessage(opMetaData, reqMessage); } handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[1]); handlersPass = handlersPass && callRequestHandlerChain(sepMetaData, handlerType[2]); if (handlersPass) { msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE); try { // Check if protocol handlers modified the payload if (msgContext.isModified()) { log.debug("Handler modified payload, unbind message again"); reqMessage = msgContext.getMessageAbstraction(); sepInv = binding.unbindRequestMessage(opMetaData, reqMessage); } // Invoke an instance of the SEI implementation bean Invocation inv = setupInvocation(endpoint, sepInv, invContext); InvocationHandler invHandler = endpoint.getInvocationHandler(); invHandler.invoke(endpoint, inv); // Handler processing might have replaced the endpoint invocation sepInv = inv.getInvocationContext().getAttachment(EndpointInvocation.class); } finally { msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM); } // Reverse the message direction msgContext = processPivotInternal(msgContext, direction); // Set the required outbound context properties setOutboundContextProperties(); if (binding instanceof CommonSOAPBinding) XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled()); // Bind the response message MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData, sepInv); msgContext.setMessageAbstraction(resMessage); } else { // Reverse the message direction without calling the endpoint MessageAbstraction resMessage = msgContext.getMessageAbstraction(); msgContext = processPivotInternal(msgContext, direction); msgContext.setMessageAbstraction(resMessage); } boolean isWsrmMessage = msgContext.get(RMConstant.RESPONSE_CONTEXT) != null; if ((oneway == false) || (isWsrmMessage)) // RM hack { // call the response handler chain, removing the fault type entry will not call handleFault for that chain handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]); faultType[2] = null; handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[1]); faultType[1] = null; handlersPass = handlersPass && callResponseHandlerChain(sepMetaData, handlerType[0]); faultType[0] = null; } } catch (InvocationTargetException invocationEx) { //Unwrap the throwable raised by the service endpoint implementation Throwable targetEx = invocationEx.getTargetException(); Exception ex = targetEx instanceof Exception ? (Exception)targetEx : new UndeclaredThrowableException(targetEx); // Reverse the message direction processPivotInternal(msgContext, direction); try { CommonBinding binding = bindingProvider.getCommonBinding(); MessageAbstraction exMessage = binding.bindFaultMessage(ex); msgContext.setMessageAbstraction(exMessage); // call the fault handler chain boolean handlersPass = true; if (faultType[2] != null) handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[2], ex); if (faultType[1] != null) handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[1], ex); if (faultType[0] != null) handlersPass = handlersPass && callFaultHandlerChain(sepMetaData, faultType[0], ex); } catch (RuntimeException subEx) { log.warn("Exception while processing handleFault: ", ex); ex = subEx; } throw ex; } finally { closeHandlerChain(sepMetaData, handlerType[2]); closeHandlerChain(sepMetaData, handlerType[1]); closeHandlerChain(sepMetaData, handlerType[0]); } } protected Invocation setupInvocation(Endpoint ep, EndpointInvocation epInv, InvocationContext invContext) throws Exception { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext instanceof SOAPMessageContextJAXWS) { if (ep.getService().getDeployment().getType() == DeploymentType.JAXWS_JSE) { if (msgContext.get(MessageContext.SERVLET_REQUEST) != null) { WebServiceContext wsContext = contextFactory.newWebServiceContext(InvocationType.JAXWS_JSE, (SOAPMessageContextJAXWS)msgContext); invContext.addAttachment(WebServiceContext.class, wsContext); } else { log.warn("Cannot provide WebServiceContext, since the current MessageContext does not provide a ServletRequest"); } } invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext); } if (msgContext instanceof SOAPMessageContextJAXRPC) { invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext); } if (ServiceLifecycle.class.isAssignableFrom(ep.getTargetBeanClass()) && invContext instanceof ServletRequestContext) { ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)invContext); invContext.addAttachment(ServletEndpointContext.class, servletEndpointContext); } invContext.addAttachment(EndpointInvocation.class, epInv); Invocation wsInv = new DelegatingInvocation(); wsInv.setInvocationContext(invContext); wsInv.setJavaMethod(getImplMethod(endpoint, epInv)); return wsInv; } protected Method getImplMethod(Endpoint endpoint, EndpointInvocation sepInv) throws ClassNotFoundException, NoSuchMethodException { Class implClass = endpoint.getTargetBeanClass(); Method seiMethod = sepInv.getJavaMethod(); Method implMethod = null; if (seiMethod != null) // RM hack { String methodName = seiMethod.getName(); Class[] paramTypes = seiMethod.getParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { Class paramType = paramTypes[i]; if (JavaUtils.isPrimitive(paramType) == false) { String paramTypeName = paramType.getName(); paramType = JavaUtils.loadJavaType(paramTypeName); paramTypes[i] = paramType; } } try { implMethod = implClass.getMethod(methodName, paramTypes); } catch (NoSuchMethodException ex) { log.error("CodeSource: " + implClass.getProtectionDomain().getCodeSource()); log.error("ClassLoader: " + implClass.getClassLoader()); throw ex; } } else { log.debug("RM method returned as null"); } return implMethod; } protected void setInboundContextProperties() { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext instanceof MessageContextJAXWS) { // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap()); } } protected void setOutboundContextProperties() { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); if (msgContext instanceof MessageContextJAXWS) { // Map of attachments to a message for the outbound message, key is the MIME Content-ID, value is a DataHandler msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new HashMap()); } } private CommonMessageContext processPivotInternal(CommonMessageContext msgContext, DirectionHolder direction) { if (direction.getDirection() == Direction.InBound) { EndpointMetaData epMetaData = msgContext.getEndpointMetaData(); if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC) { msgContext = MessageContextJAXRPC.processPivot(msgContext); } else { msgContext = MessageContextJAXWS.processPivot(msgContext); } direction.setDirection(Direction.OutBound); } return msgContext; } private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData, MessageAbstraction reqMessage) throws SOAPException { OperationMetaData opMetaData; String bindingID = epMetaData.getBindingId(); if (HTTPBinding.HTTP_BINDING.equals(bindingID)) { if (epMetaData.getOperations().size() != 1) throw new IllegalStateException("Multiple operations not supported for HTTP binding"); opMetaData = epMetaData.getOperations().get(0); } else { SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage; opMetaData = soapMessage.getOperationMetaData(epMetaData); SOAPHeader soapHeader = soapMessage.getSOAPHeader(); // Report a MustUnderstand fault if (opMetaData == null) { String faultString; SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody(); SOAPBodyElement soapBodyElement = soapBody.getBodyElement(); if (soapBodyElement != null) { Name soapName = soapBodyElement.getElementName(); faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for: " + soapName; } else { faultString = "Endpoint " + epMetaData.getPortName() + " does not contain operation meta data for empty soap body"; } // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL description, it SHOULD generate a soap:Fault // with a faultcode of "Client", unless a "MustUnderstand" or "VersionMismatch" fault is generated. if (soapHeader != null && soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext()) { QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND; throw new CommonSOAPFaultException(faultCode, faultString); } else { QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT; throw new CommonSOAPFaultException(faultCode, faultString); } } } return opMetaData; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServerHandlerDelegate.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServerHandlerDel0000644000175000017500000000460410623427336031563 0ustar godgod/* * 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.core.server; // $Id: ServerHandlerDelegate.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import org.jboss.ws.core.HeaderSource; import org.jboss.ws.metadata.config.Configurable; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * @author Thomas.Diesler@jboss.org * @since 19-Jan-2005 */ public abstract class ServerHandlerDelegate implements Configurable, HeaderSource { private ServerEndpointMetaData sepMetaData; public ServerHandlerDelegate(ServerEndpointMetaData sepMetaData) { this.sepMetaData = sepMetaData; } // Get the order of pre/post handlerchains public abstract HandlerType[] getHandlerTypeOrder(); public abstract boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type); public abstract boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type); public abstract boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex); public abstract void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type); protected boolean isInitialized() { return sepMetaData.isHandlersInitialized(); } protected void setInitialized(boolean flag) { sepMetaData.setHandlersInitialized(flag); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/PortComponentLinkServlet.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/PortComponentLin0000644000175000017500000000751010652566276031654 0ustar godgod/* * 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.core.server; // $Id: PortComponentLinkServlet.java 4023 2007-07-28 07:14:06Z thomas.diesler@jboss.com $ import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.management.EndpointRegistry; import org.jboss.wsf.spi.management.EndpointRegistryFactory; import org.jboss.wsf.spi.SPIProvider; import org.jboss.wsf.spi.SPIProviderResolver; /** * A servlet that reports the serviceURL for a given service ID. *

      * When the web service client ENC is setup, it may contain port-component-link * entries that point to service endpoints in the same top level deployment. * The final serviceURL of those endpoints will become available after the * reference to the javax.xml.rpc.Service is bound to JNDI. *

      * When the client does a lookup of the javax.xml.rpc.Service from JNDI the ObjectFactory * will contact this servlet for the final serviceURL. It is acceptable that the client * wsdl does not contain the correct serviceURL if the client is using the port-component-link element. * * @author Thomas.Diesler@jboss.org * @since 29-May-2004 */ public class PortComponentLinkServlet extends HttpServlet { // provide logging private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class); protected EndpointRegistry epRegistry; public void init(ServletConfig config) throws ServletException { super.init(config); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry(); } /** * Get the serviceURL as string for a given serviceID. */ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String pcLink = req.getParameter("pcLink"); if (pcLink == null) throw new IllegalArgumentException("Cannot obtain request parameter 'pcLink'"); Endpoint endpoint = epRegistry.resolve( new PortComponentResolver(pcLink) ); if (endpoint == null) throw new WSException("Cannot resolve port-component-link: " + pcLink); res.setContentType("text/plain"); PrintWriter out = res.getWriter(); ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class); String endpointAddress = sepMetaData.getEndpointAddress(); out.println(endpointAddress); log.debug("Resolved " + pcLink + " to: " + endpointAddress); out.close(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/WSDLRequestHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/WSDLRequestHandl0000644000175000017500000002067610737155110031464 0ustar godgod/* * 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.core.server; // $Id: WSDLRequestHandler.java 5392 2008-01-03 12:51:20Z richard.opalka@jboss.com $ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.jboss.logging.Logger; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.wsf.spi.management.ServerConfig; import org.jboss.wsf.common.DOMUtils; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Handles the delivery of the WSDL and its included artifacts. * It rewrites the include URL's. * * http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3871263#3871263 * * For a discussion of this topic. * * @author Thomas.Diesler@jboss.org * @since 23-Mar-2005 */ public class WSDLRequestHandler { // provide logging private Logger log = Logger.getLogger(WSDLRequestHandler.class); private EndpointMetaData epMetaData; public WSDLRequestHandler(EndpointMetaData epMetaData) { this.epMetaData = epMetaData; } /** * Get the WSDL resource for a given resource path *

      * Use path value of null to get the root document * * @param resPath The wsdl resource to get, can be null for the top level wsdl * @return A wsdl document, or null if it cannot be found */ public Document getDocumentForPath(URL reqURL, String wsdlHost, String resPath) throws IOException { Document wsdlDoc; // The WSDLFilePublisher should set the location to an URL URL wsdlLocation = epMetaData.getServiceMetaData().getWsdlLocation(); if (wsdlLocation == null) throw new IllegalStateException("Cannot obtain wsdl location"); // get the root wsdl if (resPath == null) { Element wsdlElement = DOMUtils.parse(wsdlLocation.openStream()); wsdlDoc = wsdlElement.getOwnerDocument(); } // get some imported resource else { String impResourcePath = new File(wsdlLocation.getPath()).getParent() + File.separatorChar + resPath; File impResourceFile = new File(impResourcePath); Element wsdlElement = DOMUtils.parse(impResourceFile.toURL().openStream()); wsdlDoc = wsdlElement.getOwnerDocument(); } modifyAddressReferences(reqURL, wsdlHost, resPath, wsdlDoc.getDocumentElement()); return wsdlDoc; } /** * Modify the location of wsdl and schema imports */ private void modifyAddressReferences(URL reqURL, String wsdlHost, String resPath, Element element) throws IOException { // map wsdl definition imports NodeList nlist = element.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node childNode = nlist.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { Element childElement = (Element)childNode; String nodeName = childElement.getLocalName(); // Replace xsd:import and xsd:include location attributes if ("import".equals(nodeName) || "include".equals(nodeName)) { Attr locationAttr = childElement.getAttributeNode("schemaLocation"); if (locationAttr == null) locationAttr = childElement.getAttributeNode("location"); if (locationAttr != null) { String orgLocation = locationAttr.getNodeValue(); while (orgLocation.startsWith("./")) orgLocation = orgLocation.substring(2); boolean isAbsolute = orgLocation.startsWith("http://") || orgLocation.startsWith("https://"); if (isAbsolute == false && orgLocation.startsWith(reqURL.getPath()) == false) { String newResourcePath = orgLocation; if (resPath != null && resPath.indexOf("/") > 0) { String resParent = resPath.substring(0, resPath.lastIndexOf("/")); // replace parent traversal, results in resParent == null when successfully executed while (orgLocation.startsWith("../") && resParent != null) { if (resParent.indexOf("/") > 0) { resParent = resParent.substring(0, resParent.lastIndexOf("/")); orgLocation = orgLocation.substring(3); newResourcePath = resParent + "/" + orgLocation; } else { orgLocation = orgLocation.substring(3); newResourcePath = orgLocation; resParent = null; } } // no parent traversal happend if(resParent!=null) newResourcePath = resParent +"/"+ orgLocation; } String reqPath = reqURL.getPath(); String completeHost = wsdlHost; if (!(wsdlHost.startsWith("http://") || wsdlHost.startsWith("https://"))) { String reqProtocol = reqURL.getProtocol(); int reqPort = reqURL.getPort(); String hostAndPort = wsdlHost + (reqPort > 0 ? ":" + reqPort : ""); completeHost = reqProtocol + "://" + hostAndPort; } String newLocation = completeHost + reqPath + "?wsdl&resource=" + newResourcePath; locationAttr.setNodeValue(newLocation); log.trace("Mapping import from '" + orgLocation + "' to '" + newLocation + "'"); } } } // Replace the soap:address location attribute else if ("address".equals(nodeName)) { Attr locationAttr = childElement.getAttributeNode("location"); if (locationAttr != null) { String orgLocation = locationAttr.getNodeValue(); URL orgURL = new URL(orgLocation); String orgProtocol = orgURL.getProtocol(); String orgHost = orgURL.getHost(); int orgPort = orgURL.getPort(); String orgPath = orgURL.getPath(); if (ServerConfig.UNDEFINED_HOSTNAME.equals(orgHost)) { URL newURL = new URL(wsdlHost); String newHost = newURL.getHost(); int newPort = newURL.getPort(); String newLocation = orgProtocol + "://" + newHost; if (newPort != -1) newLocation += ":" + newPort; else if (orgPort != -1) newLocation += ":" + orgPort; newLocation += orgPath; locationAttr.setNodeValue(newLocation); log.trace("Mapping address from '" + orgLocation + "' to '" + newLocation + "'"); } } } else { modifyAddressReferences(reqURL, wsdlHost, resPath, childElement); } } } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/MimeHeaderSource.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/MimeHeaderSource0000644000175000017500000000337310576442423031556 0ustar godgod/* * 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.core.server; import javax.xml.soap.MimeHeaders; /** * Generic abstraction of a source that allows getting and setting * of transport specific MIME headers. * * @author Jason T. Greene */ public interface MimeHeaderSource { /** * Gets the MIME headers from an inbound source. An implementation may * return null if the transport does not provide headers. * * @return the MIME headers */ public MimeHeaders getMimeHeaders(); /** * Sets the MIME headers for an outbound source. An implementation may * return null if the transport does not provide headers. * * @param headers the MIME headers */ public void setMimeHeaders(MimeHeaders headers); } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServletRequestContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServletRequestCo0000644000175000017500000000421710650145103031636 0ustar godgod/* * 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.core.server; // $Id: ServletRequestContext.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import org.jboss.wsf.spi.invocation.InvocationContext; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Implementation of ServletEndpointContext * * @author Thomas.Diesler@jboss.org */ public class ServletRequestContext extends InvocationContext { private ServletContext context; private HttpServletRequest request; private HttpServletResponse response; public ServletRequestContext(ServletContext context, HttpServletRequest request, HttpServletResponse response) { this.context = context; this.request = request; this.response = response; } public HttpSession getHttpSession() { return request.getSession(false); } public ServletContext getServletContext() { return context; } public HttpServletRequest getHttpServletRequest() { return request; } public HttpServletResponse getHttpServletResponse() { return response; } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServiceEndpointMetrics.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServiceEndpointM0000644000175000017500000001211010614443405031572 0ustar godgod/* * 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.core.server; // $Id: ServiceEndpointMetrics.java 2947 2007-04-27 18:55:01Z thomas.diesler@jboss.com $ import java.io.Serializable; import java.util.Date; import javax.management.ObjectName; /** * Service Endpoint Metrics * * @author Thomas.Diesler@jboss.org * @since 14-Dec-2005 */ public class ServiceEndpointMetrics implements Serializable, Cloneable { private static final long serialVersionUID = -7730514070812711512L; // The unique service endpointID private ObjectName endpointID; private Date startTime; private Date stopTime; private long requestCount; private long responseCount; private long faultCount; private long maxProcessingTime; private long minProcessingTime; private long avgProcessingTime; private long totalProcessingTime; public ServiceEndpointMetrics(ObjectName endpointID) { this.endpointID = endpointID; } public void start() { startTime = new Date(); stopTime = null; requestCount = 0; responseCount = 0; faultCount = 0; maxProcessingTime = 0; minProcessingTime = 0; avgProcessingTime = 0; totalProcessingTime = 0; } public void stop() { stopTime = new Date(); } public long processRequestMessage() { requestCount++; return System.currentTimeMillis(); } public void processResponseMessage(long beginTime) { responseCount++; processAnyMessage(beginTime); } public void processFaultMessage(long beginTime) { faultCount++; processAnyMessage(beginTime); } private void processAnyMessage(long beginTime) { if (beginTime > 0) { long procTime = System.currentTimeMillis() - beginTime; if (minProcessingTime == 0) minProcessingTime = procTime; maxProcessingTime = Math.max(maxProcessingTime, procTime); minProcessingTime = Math.min(minProcessingTime, procTime); totalProcessingTime = totalProcessingTime + procTime; avgProcessingTime = totalProcessingTime / (responseCount + faultCount); } } public ObjectName getEndpointID() { return endpointID; } public Date getStartTime() { return startTime; } public Date getStopTime() { return stopTime; } public long getMinProcessingTime() { return minProcessingTime; } public long getMaxProcessingTime() { return maxProcessingTime; } public long getAverageProcessingTime() { return avgProcessingTime; } public long getTotalProcessingTime() { return totalProcessingTime; } public long getRequestCount() { return requestCount; } public long getFaultCount() { return faultCount; } public long getResponseCount() { return responseCount; } public Object clone() throws CloneNotSupportedException { ServiceEndpointMetrics sem = new ServiceEndpointMetrics(this.endpointID); sem.avgProcessingTime = this.avgProcessingTime; sem.maxProcessingTime = this.maxProcessingTime; sem.minProcessingTime = this.minProcessingTime; sem.faultCount = this.faultCount; sem.requestCount = this.requestCount; sem.responseCount = this.responseCount; sem.startTime = this.startTime; sem.stopTime = this.stopTime; sem.totalProcessingTime = this.totalProcessingTime; return sem; } public String toString() { StringBuilder buffer = new StringBuilder("\nEndpoint Metrics: " + endpointID); buffer.append("\n startTime=" + startTime); buffer.append("\n stopTime=" + stopTime); buffer.append("\n requestCount=" + requestCount); buffer.append("\n responseCount=" + responseCount); buffer.append("\n faultCount=" + faultCount); buffer.append("\n maxProcessingTime=" + maxProcessingTime); buffer.append("\n minProcessingTime=" + minProcessingTime); buffer.append("\n avgProcessingTime=" + avgProcessingTime); buffer.append("\n totalProcessingTime=" + totalProcessingTime); return buffer.toString(); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/PortComponentResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/PortComponentRes0000644000175000017500000000462110651370327031650 0ustar godgod/* * 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.core.server; import org.jboss.logging.Logger; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.wsf.spi.deployment.Endpoint; import org.jboss.wsf.spi.management.EndpointResolver; import java.util.Iterator; /** * @author Heiko.Braun@jboss.com * Created: Jul 23, 2007 */ public class PortComponentResolver implements EndpointResolver { private static final Logger log = Logger.getLogger(PortComponentResolver.class); private String pcLink; private Endpoint result; public PortComponentResolver(String pcref) { this.pcLink = pcref; } public Endpoint query(Iterator endpoints) { Endpoint endpoint = null; String pcName = this.pcLink; int hashIndex = this.pcLink.indexOf("#"); if (hashIndex > 0) { pcName = pcLink.substring(hashIndex + 1); } while(endpoints.hasNext()) { Endpoint auxEndpoint = endpoints.next(); ServerEndpointMetaData sepMetaData = auxEndpoint.getAttachment(ServerEndpointMetaData.class); if (pcName.equals(sepMetaData.getPortComponentName())) { if (endpoint != null) { log.warn("Multiple service endoints found for: " + pcLink); endpoint = null; break; } endpoint = auxEndpoint; } } return endpoint; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/DelegatingInvocation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/DelegatingInvoca0000644000175000017500000000656210650145103031567 0ustar godgod/* * 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.core.server; // $Id: DelegatingInvocation.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import org.jboss.ws.WSException; import org.jboss.ws.core.CommonBinding; import org.jboss.ws.core.CommonBindingProvider; import org.jboss.ws.core.EndpointInvocation; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.wsf.spi.invocation.Invocation; import javax.xml.rpc.handler.soap.SOAPMessageContext; import javax.xml.soap.SOAPMessage; /** An invocation that delegates to the jbossws-core EndpointInvocation * * @author Thomas.Diesler@jboss.org * @since 25-Apr-2007 */ public class DelegatingInvocation extends Invocation { private EndpointInvocation getEndpointInvocation() { EndpointInvocation epInv = getInvocationContext().getAttachment(EndpointInvocation.class); if (epInv == null) throw new IllegalStateException("Cannot obtain endpoint invocation"); return epInv; } @Override public void setReturnValue(Object value) { EndpointInvocation epInv = getEndpointInvocation(); epInv.setReturnValue(value); SOAPMessageContext msgContext = (SOAPMessageContext)getInvocationContext().getAttachment(javax.xml.rpc.handler.MessageContext.class); if (msgContext != null && msgContext.getMessage() == null) { try { // Bind the response message OperationMetaData opMetaData = epInv.getOperationMetaData(); CommonBindingProvider bindingProvider = new CommonBindingProvider(opMetaData.getEndpointMetaData()); CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding(); SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv); msgContext.setMessage(resMessage); } catch (BindingException ex) { WSException.rethrow(ex); } } } @Override public Object[] getArgs() { EndpointInvocation epInv = getEndpointInvocation(); return epInv.getRequestPayload(); } @Override public Object getReturnValue() { EndpointInvocation epInv = getEndpointInvocation(); return epInv.getReturnValue(); } @Override public void setArgs(Object[] args) { throw new IllegalArgumentException("Cannot set args on this invocation"); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServletHeaderSource.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/server/ServletHeaderSou0000644000175000017500000000654110576442423031621 0ustar godgod/* * 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.core.server; // $Id: ServletHeaderSource.java 2629 2007-03-16 07:19:47Z jason.greene@jboss.com $ import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.soap.MimeHeader; import javax.xml.soap.MimeHeaders; /** * Implementation of HeaderSource that pulls header * information from an HttpServlet. * * @author Jason T. Greene * @author Thomas.Diesler@jboss.org */ public class ServletHeaderSource implements MimeHeaderSource { private HttpServletRequest req; private HttpServletResponse res; public ServletHeaderSource(HttpServletRequest req, HttpServletResponse res) { this.req = req; this.res = res; } public MimeHeaders getMimeHeaders() { Enumeration e = req.getHeaderNames(); if (e == null) return null; MimeHeaders headers = new MimeHeaders(); while (e.hasMoreElements()) { String name = (String)e.nextElement(); headers.addHeader(name, req.getHeader(name)); } return headers; } public Map> getHeaderMap() { Map> headerMap = new HashMap>(); Enumeration e = req.getHeaderNames(); if (e != null) { while (e.hasMoreElements()) { String name = (String)e.nextElement(); List values = new ArrayList(); values.add(req.getHeader(name)); headerMap.put(name, values); } } return headerMap; } public void setMimeHeaders(MimeHeaders headers) { Iterator i = headers.getAllHeaders(); while (i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); res.addHeader(header.getName(), header.getValue()); } } public void setHeaderMap(Map> headers) { Iterator it = headers.keySet().iterator(); while (it.hasNext()) { String name = it.next(); List values = headers.get(name); for (String value : values) { res.addHeader(name, value); } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/ConfigProvider.java0000644000175000017500000000350510702657335030725 0ustar godgod/* * 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.core; // $Id: ConfigProvider.java 4701 2007-10-09 10:58:37Z thomas.diesler@jboss.com $ /** * Provides configuration for JAXRPC/JAXWS ports * * @author Thomas.Diesler@jboss.com * @since 17-Jan-2006 */ public interface ConfigProvider { /** * Get the port configuration file */ String getConfigFile(); /** * Get the port configuration name */ String getConfigName(); /** * Set the port configuration name */ void setConfigName(String configName); /** * Set the port configuration name and file */ void setConfigName(String configName, String configFile); /** * Get the WS-Security configuration */ String getSecurityConfig(); /** * Set the WS-Security configuration */ void setSecurityConfig(String securityConfig); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/0000755000175000017500000000000010755000267026543 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/AbstractSerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/AbstractSeriali0000644000175000017500000000327710642000211031533 0ustar godgod/* * 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.core.binding; // $Id: SerializerFactoryBase.java 2210 2007-01-31 09:51:54Z thomas.diesler@jboss.com $ import java.util.Iterator; import javax.xml.rpc.encoding.Serializer; import javax.xml.rpc.encoding.SerializerFactory; import org.jboss.util.NotImplementedException; /** * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public abstract class AbstractSerializerFactory implements SerializerFactory { public abstract SerializerSupport getSerializer() throws BindingException; public Serializer getSerializerAs(String mechanismType) { throw new NotImplementedException(); } public Iterator getSupportedMechanismTypes() { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/SerializationContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/SerializationCo0000644000175000017500000000443010642000211031546 0ustar godgod/* * 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.core.binding; // $Id: SerializationContext.java 2634 2007-03-16 23:44:09Z jason.greene@jboss.com $ import java.util.HashMap; import java.util.Map; import org.jboss.xb.binding.NamespaceRegistry; /** * An abstract serialization context * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public abstract class SerializationContext { private Class javaType; private TypeMappingImpl typeMapping; // The namespace registry that is valid for this serialization context private NamespaceRegistry namespaceRegistry = new NamespaceRegistry(); // An arbitrary property bag private Map properties = new HashMap(); public Object getProperty(Object key) { return properties.get(key); } public void setProperty(Object key, Object value) { properties.put(key, value); } public TypeMappingImpl getTypeMapping() { return typeMapping; } public void setTypeMapping(TypeMappingImpl typeMapping) { this.typeMapping = typeMapping; } public NamespaceRegistry getNamespaceRegistry() { return namespaceRegistry; } public Class getJavaType() { return javaType; } public void setJavaType(Class javaType) { this.javaType = javaType; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/DeserializerSupport.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/DeserializerSup0000644000175000017500000001336510660617420031610 0ustar godgod/* * 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.core.binding; // $Id: DeserializerSupport.java 4379 2007-08-15 15:43:12Z darran.lofthouse@jboss.com $ import java.io.ByteArrayOutputStream; import javax.xml.namespace.QName; import javax.xml.rpc.encoding.Deserializer; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.jboss.logging.Logger; import org.jboss.util.NotImplementedException; import org.jboss.ws.WSException; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.ws.core.utils.XMLPredefinedEntityReferenceResolver; import org.jboss.wsf.common.DOMWriter; import org.w3c.dom.Node; /** The base class for all Deserializers. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public abstract class DeserializerSupport implements Deserializer { private static final Logger log = Logger.getLogger(DeserializerSupport.class); public Object deserialize(SOAPContentElement soapElement, SerializationContext serContext) throws BindingException { QName xmlName = soapElement.getElementQName(); QName xmlType = soapElement.getXmlType(); Source source = soapElement.getXMLFragment().getSource(); return deserialize(xmlName, xmlType, source, serContext); } /** Deserialize an XML fragment to an object value * * @param xmlName The root element name of the resulting fragment * @param xmlType The associated schema type * @param xmlFragment The XML fragment to deserialize * @param serContext The serialization context */ public abstract Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException; // TODO: remove when JBossXB supports unmarshall(Source) // http://jira.jboss.org/jira/browse/JBXB-100 protected static String sourceToString(Source source) { String xmlFragment = null; try { if (source instanceof DOMSource) { Node node = ((DOMSource)source).getNode(); xmlFragment = DOMWriter.printNode(node, false); } else { // Note, this code will not handler namespaces correctly that // are defined on a parent of the DOMSource // // // // // Hello World! // // // // TransformerFactory tf = TransformerFactory.newInstance(); ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); StreamResult streamResult = new StreamResult(baos); tf.newTransformer().transform(source, streamResult); xmlFragment = new String(baos.toByteArray()); if (xmlFragment.startsWith(""); xmlFragment = xmlFragment.substring(index + 1); } } } catch (TransformerException e) { WSException.rethrow(e); } return xmlFragment; } /** Unwrap the value string from the XML fragment * * @return The value string or null if the startTag contains a xsi:nil='true' attribute */ protected String unwrapValueStr(String xmlFragment) { // We only scan for :nil if the xmlFragment is an empty element if (isEmptyElement(xmlFragment)) { return (isNil(xmlFragment) ? null : ""); } int endOfStartTag = xmlFragment.indexOf(">"); int startOfEndTag = xmlFragment.lastIndexOf(""); } protected boolean isNil(String xmlFragment) { boolean isNil = false; if (isEmptyElement(xmlFragment)) { int endOfStartTag = xmlFragment.indexOf(">"); String startTag = xmlFragment.substring(0, endOfStartTag); isNil = startTag.indexOf(":nil='1'") > 0 || startTag.indexOf(":nil=\"1\"") > 0; isNil = isNil || startTag.indexOf(":nil='true'") > 0 || startTag.indexOf(":nil=\"true\"") > 0; } return isNil; } public String getMechanismType() { throw new NotImplementedException(); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/TypeMappingImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/TypeMappingImpl0000644000175000017500000007052410650145103031546 0ustar godgod/* * 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.core.binding; // $Id: TypeMappingImpl.java 3959 2007-07-20 14:44:19Z heiko.braun@jboss.com $ import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.xml.namespace.QName; import javax.xml.rpc.encoding.DeserializerFactory; import javax.xml.rpc.encoding.SerializerFactory; import javax.xml.rpc.encoding.TypeMapping; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.core.jaxrpc.binding.Base64DeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.Base64SerializerFactory; import org.jboss.ws.core.jaxrpc.binding.CalendarDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.CalendarSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.DateDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.DateSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.HexDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.HexSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.QNameDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.QNameSerializerFactory; import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory; import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory; import org.jboss.ws.core.utils.HashCodeUtil; import org.jboss.wsf.common.JavaUtils; /** * This is the representation of a type mapping. * This TypeMapping implementation supports the literal encoding style. * * The TypeMapping instance maintains a tuple of the type * {XML typeQName, Java Class, SerializerFactory, DeserializerFactory}. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public abstract class TypeMappingImpl implements TypeMapping { // provide logging private static final Logger log = Logger.getLogger(TypeMappingImpl.class); // Map private Map tupleMap = new LinkedHashMap(); private Map> keyPairCache = new ConcurrentHashMap>(); /** * Gets the DeserializerFactory registered for the specified pair of Java type and XML data type. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @return Registered DeserializerFactory or null if there is no registered factory */ public DeserializerFactory getDeserializer(Class javaType, QName xmlType) { FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType); return (fPair != null ? fPair.getDeserializerFactory() : null); } /** * Gets the SerializerFactory registered for the specified pair of Java type and XML data type. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @return Registered SerializerFactory or null if there is no registered factory */ public SerializerFactory getSerializer(Class javaType, QName xmlType) { FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType); return (fPair != null ? fPair.getSerializerFactory() : null); } /** * Returns the encodingStyle URIs (as String[]) supported by this TypeMapping instance. * A TypeMapping that contains only encoding style independent serializers and deserializers * returns null from this method. * * @return Array of encodingStyle URIs for the supported encoding styles */ public abstract String[] getSupportedEncodings(); /** * Sets the encodingStyle URIs supported by this TypeMapping instance. A TypeMapping that contains only encoding * independent serializers and deserializers requires null as the parameter for this method. * * @param encodingStyleURIs Array of encodingStyle URIs for the supported encoding styles */ public abstract void setSupportedEncodings(String[] encodingStyleURIs); /** * Checks whether or not type mapping between specified XML type and Java type is registered. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @return boolean; true if type mapping between the specified XML type and Java type is registered; otherwise false */ public boolean isRegistered(Class javaType, QName xmlType) { return getFactoryPair(new IQName(xmlType), javaType) != null; } /** * Registers SerializerFactory and DeserializerFactory for a specific type mapping between an XML type and Java type. * This method replaces any existing registered SerializerFactory DeserializerFactory instances. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @param sf SerializerFactory * @param df DeserializerFactory * @throws javax.xml.rpc.JAXRPCException If any error during the registration */ public void register(Class javaType, QName xmlType, SerializerFactory sf, DeserializerFactory df) { if (log.isTraceEnabled()) log.trace("register: TypeMappingImpl@" + hashCode() + " [xmlType=" + xmlType + ",javaType=" + javaType.getName() + ",sf=" + sf + ",df=" + df + "]"); registerInternal(javaType, new IQName(xmlType), sf, df); keyPairCache.clear(); } private void registerInternal(Class javaType, IQName xmlType, SerializerFactory sf, DeserializerFactory df) { if (javaType == null) throw new IllegalArgumentException("javaType cannot be null for: " + xmlType); if (xmlType == null) throw new IllegalArgumentException("xmlType cannot be null for: " + javaType); KeyPair kPair = new KeyPair(xmlType, javaType); FactoryPair fPair = new FactoryPair(sf, df); tupleMap.put(kPair, fPair); } /** * Removes the DeserializerFactory registered for the specified pair of Java type and XML data type. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered DeserializerFactory */ public void removeDeserializer(Class javaType, QName xmlType) { FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType); if (fPair != null) fPair.setDeserializerFactory(null); } /** * Removes the SerializerFactory registered for the specified pair of Java type and XML data type. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered SerializerFactory */ public void removeSerializer(Class javaType, QName xmlType) { FactoryPair fPair = getFactoryPair(new IQName(xmlType), javaType); if (fPair != null) fPair.setSerializerFactory(null); } /** Get the list of registered XML types */ public List getRegisteredXmlTypes() { List types = new ArrayList(); for (KeyPair keyPair : getKeyPairs(null, null)) { types.add(keyPair.getXmlType().toQName()); } return types; } /** Get the list of registered Java types */ public List getRegisteredJavaTypes() { List types = new ArrayList(); for (KeyPair keyPair : getKeyPairs(null, null)) { types.add(keyPair.getJavaType()); } return types; } /** Get the Class that was registered last for this xmlType */ public Class getJavaType(QName xmlType) { Class javaType = null; List keyPairList = getKeyPairs(new IQName(xmlType), null); int size = keyPairList.size(); if (size > 0) { KeyPair kPair = (KeyPair)keyPairList.get(size - 1); javaType = kPair.getJavaType(); } return javaType; } /** * Get all of the Classes registered for this xmlType. */ public List getJavaTypes(QName xmlType) { List keyPairList = getKeyPairs( new IQName(xmlType), null); List classes = new ArrayList(keyPairList.size()); for (KeyPair current : keyPairList) { classes.add(current.getJavaType()); } return classes; } /** * Get the Class that was registered last for this xmlType * If there are two Java Types registered for the xmlType * return the primitive type rather than the wrapper, * if available */ public Class getJavaType(QName xmlType,boolean getPrimitive) { //Lets get the primitive type if available Class javaType = null; List keyPairList = getKeyPairs(new IQName(xmlType), null); int size = keyPairList.size(); if (size == 2 && getPrimitive) { KeyPair kPair1 = (KeyPair)keyPairList.get(0); Class javaType1 = kPair1.getJavaType(); KeyPair kPair2 = (KeyPair)keyPairList.get(1); Class javaType2 = kPair2.getJavaType(); if(javaType2.isPrimitive() && !javaType1.isPrimitive()) javaType = javaType2; else if(javaType1.isPrimitive() && !javaType2.isPrimitive()) javaType = javaType1; else javaType = javaType2; //Fallback on the most latest } else return getJavaType(xmlType); return javaType; } /** Get the Class name that was registered last for this xmlType */ public String getJavaTypeName(QName xmlType) { Class javaType = getJavaType(xmlType); return (javaType != null ? javaType.getName() : null); } /** Get the QName that was registered last for this javaType */ public QName getXMLType(Class javaType) { QName xmlType = null; List keyPairList = getKeyPairs(null, javaType); int size = keyPairList.size(); if (size > 0) { KeyPair kPair = (KeyPair)keyPairList.get(size - 1); xmlType = kPair.getXmlType().toQName(); } return xmlType; } /** Get the QNames that was registered last for this javaType */ public List getXMLTypes(Class javaType) { List xmlTypes = new ArrayList(); for (KeyPair kPair : getKeyPairs(null, javaType)) { xmlTypes.add(kPair.getXmlType().toQName()); } return xmlTypes; } /** * Get the QName that was registered last for this javaType * @param javaType class for which XML Type is needed * @param tryAssignable If the xmlType is not registered for javaType * should a base class type be checked? * */ public QName getXMLType(Class javaType, boolean tryAssignable) { if(tryAssignable) return getXMLType(javaType); QName xmlType = null; List keyPairList = getKeyPairs(null, javaType, tryAssignable); int size = keyPairList.size(); if (size > 0) { KeyPair kPair = (KeyPair)keyPairList.get(size - 1); xmlType = kPair.getXmlType().toQName(); } return xmlType; } /** * Get the serializer/deserializer factory pair for the given xmlType, javaType * Both xmlType, javaType may be null. In that case, this implementation still * returns a FactoryPair if there is only one possible match. * * @param xmlType can be null * @param javaType can be null */ private List getKeyPairs(IQName xmlType, Class javaType) { Integer cacheId = cacheIdFor(javaType, xmlType); List keyPairList = keyPairCache.get(cacheId); if(null == keyPairList) { keyPairList = getKeyPairsInternal(xmlType, javaType); keyPairCache.put(cacheId, keyPairList); } return keyPairList; } private Integer cacheIdFor(Class javaType, IQName xmlType) { int result = HashCodeUtil.SEED; int nullHash = HashCodeUtil.hash(result, "null"); result = javaType!= null ? HashCodeUtil.hash(result, javaType.getName()) : HashCodeUtil.hash(result, nullHash); result = xmlType!= null ? HashCodeUtil.hash(result, xmlType.hashCode()): HashCodeUtil.hash(result, nullHash); return new Integer(result); } private List getKeyPairsInternal(IQName xmlType, Class javaType) { List keyPairList = new ArrayList(); // Getting the exact matching pair if (xmlType != null && javaType != null) { for (KeyPair entry : tupleMap.keySet()) { if (xmlType.equals(entry.getXmlType()) && entry.getJavaType() == javaType) { keyPairList.add(entry); } } // No exact match, try assignable if (keyPairList.size() == 0) { for (KeyPair entry : tupleMap.keySet()) { if (xmlType.equals(entry.getXmlType()) && JavaUtils.isAssignableFrom(entry.getJavaType(), javaType)) { keyPairList.add(entry); } } } } // Getting the pair for a given xmlType else if (xmlType != null && javaType == null) { for (KeyPair entry : tupleMap.keySet()) { if (xmlType.equals(entry.getXmlType())) { keyPairList.add(entry); } } } // Getting the pair for a given javaType else if (xmlType == null && javaType != null) { for (KeyPair entry : tupleMap.keySet()) { if (entry.getJavaType() == javaType) { keyPairList.add(entry); } } // No exact match, try assignable if (keyPairList.size() == 0) { for (KeyPair entry : tupleMap.keySet()) { if (JavaUtils.isAssignableFrom(entry.getJavaType(), javaType)) { keyPairList.add(entry); } } } } // Getting the all pairs else if (xmlType == null && javaType == null) { keyPairList.addAll(tupleMap.keySet()); } return keyPairList; } private List getKeyPairs(IQName xmlType, Class javaType, boolean tryAssignable) { Integer cacheId = cacheIdFor(javaType, xmlType); List keyPairList = keyPairCache.get(cacheId); if(null == keyPairList) { keyPairList = getKeyPairsInternal(xmlType, javaType, tryAssignable); keyPairCache.put(cacheId, keyPairList); } return keyPairList; } /** * Get the serializer/deserializer factory pair for the given xmlType, javaType * Both xmlType, javaType may be null. In that case, this implementation still * returns a FactoryPair if there is only one possible match. *
      Note: This method does not try for the base class, if no keypair exists for the * javaType in question. */ private List getKeyPairsInternal(IQName xmlType, Class javaType, boolean tryAssignable) { if(tryAssignable) return getKeyPairs( xmlType, javaType ); List keyPairList = new ArrayList(); // Getting the exact matching pair if (xmlType != null && javaType != null) { for (KeyPair entry : tupleMap.keySet()) { if (xmlType.equals(entry.getXmlType()) && entry.getJavaType() == javaType) { keyPairList.add(entry); } } } // Getting the pair for a given xmlType else if (xmlType != null && javaType == null) { for (KeyPair entry : tupleMap.keySet()) { if (xmlType.equals(entry.getXmlType())) { keyPairList.add(entry); } } } // Getting the pair for a given javaType else if (xmlType == null && javaType != null) { for (KeyPair entry : tupleMap.keySet()) { if (entry.getJavaType() == javaType) { keyPairList.add(entry); } } } // Getting the all pairs else if (xmlType == null && javaType == null) { keyPairList.addAll(tupleMap.keySet()); } return keyPairList; } /** * Get the serializer/deserializer factory pair for the given xmlType, javaType * Both xmlType, javaType may be null. In that case, this implementation still * returns a FactoryPair that was last registered */ private FactoryPair getFactoryPair(IQName xmlType, Class javaType) { FactoryPair fPair = null; List keyPairList = getKeyPairs(xmlType, javaType); int size = keyPairList.size(); if (size > 0) { KeyPair kPair = keyPairList.get(size - 1); fPair = (FactoryPair)tupleMap.get(kPair); } return fPair; } protected void registerStandardLiteralTypes() { register(BigDecimal.class, Constants.TYPE_LITERAL_DECIMAL, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_LITERAL_POSITIVEINTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_LITERAL_NEGATIVEINTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_LITERAL_NONPOSITIVEINTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_LITERAL_NONNEGATIVEINTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_LITERAL_UNSIGNEDLONG, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(BigInteger.class, Constants.TYPE_LITERAL_INTEGER, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Date.class, Constants.TYPE_LITERAL_DATETIME, new DateSerializerFactory(), new DateDeserializerFactory()); register(Calendar.class, Constants.TYPE_LITERAL_DATE, new CalendarSerializerFactory(), new CalendarDeserializerFactory()); register(Calendar.class, Constants.TYPE_LITERAL_TIME, new CalendarSerializerFactory(), new CalendarDeserializerFactory()); register(Calendar.class, Constants.TYPE_LITERAL_DATETIME, new CalendarSerializerFactory(), new CalendarDeserializerFactory()); register(QName.class, Constants.TYPE_LITERAL_QNAME, new QNameSerializerFactory(), new QNameDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_ANYSIMPLETYPE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_DURATION, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_GDAY, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_GMONTH, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_GMONTHDAY, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_GYEAR, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_GYEARMONTH, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_ID, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_LANGUAGE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_NAME, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_NCNAME, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_NMTOKEN, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_NORMALIZEDSTRING, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_TOKEN, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String.class, Constants.TYPE_LITERAL_STRING, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(String[].class, Constants.TYPE_LITERAL_NMTOKENS, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(URI.class, Constants.TYPE_LITERAL_ANYURI, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(boolean.class, Constants.TYPE_LITERAL_BOOLEAN, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Boolean.class, Constants.TYPE_LITERAL_BOOLEAN, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(byte.class, Constants.TYPE_LITERAL_BYTE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Byte.class, Constants.TYPE_LITERAL_BYTE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Byte[].class, Constants.TYPE_LITERAL_HEXBINARY, new HexSerializerFactory(), new HexDeserializerFactory()); register(byte[].class, Constants.TYPE_LITERAL_HEXBINARY, new HexSerializerFactory(), new HexDeserializerFactory()); register(Byte[].class, Constants.TYPE_LITERAL_BASE64BINARY, new Base64SerializerFactory(), new Base64DeserializerFactory()); register(byte[].class, Constants.TYPE_LITERAL_BASE64BINARY, new Base64SerializerFactory(), new Base64DeserializerFactory()); register(double.class, Constants.TYPE_LITERAL_DOUBLE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Double.class, Constants.TYPE_LITERAL_DOUBLE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(float.class, Constants.TYPE_LITERAL_FLOAT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Float.class, Constants.TYPE_LITERAL_FLOAT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(int.class, Constants.TYPE_LITERAL_UNSIGNEDSHORT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Integer.class, Constants.TYPE_LITERAL_UNSIGNEDSHORT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(int.class, Constants.TYPE_LITERAL_INT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Integer.class, Constants.TYPE_LITERAL_INT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(long.class, Constants.TYPE_LITERAL_UNSIGNEDINT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Long.class, Constants.TYPE_LITERAL_UNSIGNEDINT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(long.class, Constants.TYPE_LITERAL_LONG, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Long.class, Constants.TYPE_LITERAL_LONG, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(short.class, Constants.TYPE_LITERAL_UNSIGNEDBYTE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Short.class, Constants.TYPE_LITERAL_UNSIGNEDBYTE, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(short.class, Constants.TYPE_LITERAL_SHORT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); register(Short.class, Constants.TYPE_LITERAL_SHORT, new SimpleSerializerFactory(), new SimpleDeserializerFactory()); } /** A tuple of the type {XML typeQName, Java Class, SerializerFactory, DeserializerFactory}. */ private static class KeyPair { private IQName xmlType; private Class javaType; public KeyPair(IQName xmlType, Class javaType) { this.javaType = javaType; this.xmlType = xmlType; } public Class getJavaType() { return javaType; } public IQName getXmlType() { return xmlType; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof KeyPair)) return false; final KeyPair keyPair = (KeyPair)o; if (!javaType.equals(keyPair.javaType)) return false; if (!xmlType.equals(keyPair.xmlType)) return false; return true; } public int hashCode() { int result; result = xmlType.hashCode(); result = 29 * result + javaType.hashCode(); return result; } public String toString() { return "[xmlType=" + xmlType + ",javaType=" + javaType.getName() + "]"; } } /** A tuple of the type {XML typeQName, Java Class, SerializerFactory, DeserializerFactory}. */ public static class FactoryPair { private SerializerFactory serializerFactory; private DeserializerFactory deserializerFactory; FactoryPair(SerializerFactory sf, DeserializerFactory df) { this.deserializerFactory = df; this.serializerFactory = sf; } public DeserializerFactory getDeserializerFactory() { return deserializerFactory; } public SerializerFactory getSerializerFactory() { return serializerFactory; } public void setDeserializerFactory(DeserializerFactory df) { this.deserializerFactory = df; } public void setSerializerFactory(SerializerFactory sf) { this.serializerFactory = sf; } } /** * A duck typed QName that relies on internalized Strings.

      * Taken from the {@link javax.xml.namespace.QName} docs:
      * The value of a QName contains a Namespace URI, local part and prefix. * The prefix is included in QName to retain lexical information when present in an XML input source. * The prefix is NOT used in QName.equals(Object) or to compute the QName.hashCode(). * Equality and the hash code are defined using only the Namespace URI and local part. * If not specified, the Namespace URI is set to "" (the empty string). * If not specified, the prefix is set to "" (the empty string). */ private final class IQName { public String namespace; public String localPart; public String prefix; public int hash; public IQName(QName name) { namespace = name.getNamespaceURI() != null ? name.getNamespaceURI().intern() : "".intern(); localPart = name.getLocalPart() != null ? name.getLocalPart().intern() : "".intern(); prefix = name.getPrefix() != null ? name.getPrefix().intern() : "".intern(); hash = name.hashCode(); } public boolean equals(Object object) { if(!(object instanceof IQName)) throw new IllegalArgumentException("Cannot compare IQName to " + object); IQName iqn = (IQName)object; return (iqn.namespace == this.namespace && iqn.localPart == this.localPart); } public QName toQName() { QName qname; if(null == namespace) qname = new QName(localPart); else if(null == prefix) qname = new QName(namespace, localPart); else qname = new QName(namespace, localPart, prefix); return qname; } /** * This implementation currently represents a QName as: "{" + Namespace URI + "}" + local part. * If the Namespace URI .equals(""), only the local part is returned. */ public String toString() { String ns = "".equals(namespace) ? namespace : "{"+namespace+"}"; return ns+localPart; } public int hashCode() { return this.hash; } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/ComplexTypeSerializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/ComplexTypeSeri0000644000175000017500000000376610703157542031600 0ustar godgod/* * 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.core.binding; import org.jboss.wsf.spi.binding.BindingCustomization; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.core.soap.MessageContextAssociation; // $Id: ComplexTypeSerializer.java 1757 2006-12-22 15:40:24Z thomas.diesler@jboss.com $ /** * A Serializer that can handle complex types by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public abstract class ComplexTypeSerializer extends SerializerSupport { protected BindingCustomization getBindingCustomization() { BindingCustomization bindingCustomization = null; EndpointMetaData epMetaData = MessageContextAssociation.peekMessageContext().getEndpointMetaData(); if(epMetaData instanceof ServerEndpointMetaData) { bindingCustomization = ((ServerEndpointMetaData)epMetaData).getEndpoint().getAttachment(BindingCustomization.class); } return bindingCustomization; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/ComplexTypeDeserializer.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/ComplexTypeDese0000644000175000017500000000377410703157542031555 0ustar godgod/* * 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.core.binding; import org.jboss.wsf.spi.binding.BindingCustomization; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServerEndpointMetaData; import org.jboss.ws.core.soap.MessageContextAssociation; // $Id: ComplexTypeDeserializer.java 4724 2007-10-10 14:19:14Z heiko.braun@jboss.com $ /** * A Deserializer that can handle complex types by delegating to JAXB. * * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public abstract class ComplexTypeDeserializer extends DeserializerSupport { protected BindingCustomization getBindingCustomization() { BindingCustomization bindingCustomization = null; EndpointMetaData epMetaData = MessageContextAssociation.peekMessageContext().getEndpointMetaData(); if(epMetaData instanceof ServerEndpointMetaData) { bindingCustomization = ((ServerEndpointMetaData)epMetaData).getEndpoint().getAttachment(BindingCustomization.class); } return bindingCustomization; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/SerializerSupport.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/SerializerSuppo0000644000175000017500000001504410642000211031612 0ustar godgod/* * 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.core.binding; // $Id: SerializerSupport.java 3146 2007-05-18 22:55:26Z thomas.diesler@jboss.com $ import java.util.HashMap; import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.rpc.encoding.Serializer; import javax.xml.transform.Result; import org.jboss.util.NotImplementedException; import org.jboss.ws.Constants; import org.jboss.ws.core.soap.SOAPContentElement; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * The base class for all Serializers. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * @since 04-Dec-2004 */ public abstract class SerializerSupport implements Serializer { public Result serialize(SOAPContentElement soapElement, SerializationContext serContext) throws BindingException { QName xmlName = soapElement.getElementQName(); QName xmlType = soapElement.getXmlType(); NamedNodeMap attributes = soapElement.getAttributes(); Object objectValue = soapElement.getObjectValue(); return serialize(xmlName, xmlType, objectValue, serContext, attributes); } /** Serialize an object value to an XML fragment * * @param xmlName The root element name of the resulting fragment * @param xmlType The associated schema type * @param value The value to serialize * @param serContext The serialization context * @param attributes The attributes on this element */ public abstract Result serialize(QName xmlName, QName xmlType, Object value, SerializationContext serContext, NamedNodeMap attributes) throws BindingException; /** Wrap the value string in a XML fragment with the given name */ protected String wrapValueStr(QName xmlName, String valueStr, NamespaceRegistry nsRegistry, Set nsExtras, NamedNodeMap attributes, boolean normalize) { String xmlNameURI = xmlName.getNamespaceURI(); String localPart = xmlName.getLocalPart(); Map namespaces = new HashMap(); StringBuilder nsAttr = new StringBuilder(""); if (attributes != null) { for (int i = 0; i < attributes.getLength(); i++) { Node attr = attributes.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); nsAttr.append(" " + attrName + "='" + attrValue + "'"); if (attrName.startsWith("xmlns:")) { String prefix = attrName.substring(6); namespaces.put(attrValue, prefix); } } } String elName; if (xmlNameURI.length() > 0) { xmlName = nsRegistry.registerQName(xmlName); String prefix = xmlName.getPrefix(); elName = prefix + ":" + localPart; if (namespaces.get(xmlNameURI) == null || !prefix.equals(namespaces.get(xmlNameURI))) { nsAttr.append(" xmlns:" + prefix + "='" + xmlNameURI + "'"); namespaces.put(xmlNameURI, prefix); } } else { elName = localPart; } if (nsExtras != null) { for (String nsURI : nsExtras) { String prefix = nsRegistry.getPrefix(nsURI); if (namespaces.get(nsURI) == null || !prefix.equals(namespaces.get(nsURI))) { nsAttr.append(" xmlns:" + prefix + "='" + nsURI + "'"); namespaces.put(nsURI, prefix); } } } String xmlFragment; if (valueStr == null) { String xsins = ""; if (namespaces.get(Constants.NS_SCHEMA_XSI) == null || !Constants.PREFIX_XSI.equals(namespaces.get(xmlNameURI))) { xsins = " xmlns:" + Constants.PREFIX_XSI + "='" + Constants.NS_SCHEMA_XSI + "'"; namespaces.put(Constants.NS_SCHEMA_XSI, Constants.PREFIX_XSI); } xmlFragment = "<" + elName + nsAttr + " " + Constants.PREFIX_XSI + ":nil='1'" + xsins + "/>"; } else { if (normalize) valueStr = normalize(valueStr); xmlFragment = "<" + elName + nsAttr + ">" + valueStr + ""; } return xmlFragment; } public String getMechanismType() { throw new NotImplementedException(); } private String normalize(String valueStr) { // We assume most strings will not contain characters that need "escaping", // and optimize for this case. boolean found = false; int i = 0; outer: for (; i < valueStr.length(); i++) { switch (valueStr.charAt(i)) { case '<': case '>': case '&': case '"': found = true; break outer; } } if (!found) return valueStr; // Resume where we left off StringBuilder builder = new StringBuilder(); builder.append(valueStr.substring(0, i)); for (; i < valueStr.length(); i++) { char c = valueStr.charAt(i); switch (c) { case '<': builder.append("<"); break; case '>': builder.append(">"); break; case '&': builder.append("&"); break; case '"': builder.append("""); break; default: builder.append(c); } } return builder.toString(); } }././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/BufferedStreamResult.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/BufferedStreamR0000644000175000017500000000443710660617420031516 0ustar godgod/* * 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.core.binding; // $Id: $ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import javax.xml.transform.stream.StreamResult; import org.jboss.ws.WSException; import org.jboss.wsf.common.IOUtils; /** * @author Heiko.Braun@jboss.org * @author Thomas.Diesler@jboss.org * @since 06.02.2007 */ public class BufferedStreamResult extends StreamResult { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); public BufferedStreamResult() { } public BufferedStreamResult(String xmlFragment) { try { IOUtils.copyStream(getOutputStream(), new ByteArrayInputStream(xmlFragment.getBytes())); } catch (IOException e) { WSException.rethrow(e); } } @Override public Writer getWriter() { return null; } @Override public OutputStream getOutputStream() { return baos; } @Override public void setWriter(Writer writer) { throw new UnsupportedOperationException(); } @Override public void setOutputStream(OutputStream outputStream) { throw new UnsupportedOperationException(); } public String toString() { return baos.toString(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/BindingException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/BindingExceptio0000644000175000017500000000656710642000211031537 0ustar godgod/* * 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.core.binding; // $Id: BindingException.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ /** An exception that may occur during message binding * * @author Thomas.Diesler@jboss.org * @since 16-Oct-2004 */ public class BindingException extends Exception { /** * Constructs a new exception with null as its detail message. * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. */ public BindingException() { } /** * Constructs a new exception with the specified detail message. The * cause is not initialized, and may subsequently be initialized by * a call to {@link #initCause}. * * @param message the detail message. The detail message is saved for * later retrieval by the {@link #getMessage()} method. */ public BindingException(String message) { super(message); } /** * Constructs a new exception with the specified cause and a detail * message of (cause==null ? null : cause.toString()) (which * typically contains the class and detail message of cause). * This constructor is useful for exceptions that are little more than * wrappers for other throwables (for example, {@link * java.security.PrivilegedActionException}). * * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A null value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.4 */ public BindingException(Throwable cause) { super(cause); } /** * Constructs a new exception with the specified detail message and * cause.

      Note that the detail message associated with * cause is not automatically incorporated in * this exception's detail message. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A null value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.4 */ public BindingException(String message, Throwable cause) { super(message, cause); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/AbstractDeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/binding/AbstractDeseria0000644000175000017500000000332110642000211031505 0ustar godgod/* * 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.core.binding; // $Id: DeserializerFactoryBase.java 2210 2007-01-31 09:51:54Z thomas.diesler@jboss.com $ import java.util.Iterator; import javax.xml.rpc.encoding.Deserializer; import javax.xml.rpc.encoding.DeserializerFactory; import org.jboss.util.NotImplementedException; /** * @author Thomas.Diesler@jboss.org * @since 04-Dec-2004 */ public abstract class AbstractDeserializerFactory implements DeserializerFactory { public abstract DeserializerSupport getDeserializer() throws BindingException; public Deserializer getDeserializerAs(String mechanismType) { throw new NotImplementedException(); } public Iterator getSupportedMechanismTypes() { throw new NotImplementedException(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/0000755000175000017500000000000010755000267026407 5ustar godgod././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/SOAPProtocolConn0000644000175000017500000001024710741424331031435 0ustar godgod/* * 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.core.client; // $Id: SOAPProtocolConnectionHTTP.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.Properties; import javax.xml.soap.MimeHeader; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.jboss.remoting.marshal.Marshaller; import org.jboss.remoting.marshal.UnMarshaller; import org.jboss.ws.WSException; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.soap.SOAPMessageMarshaller; import org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP; import org.jboss.ws.extensions.xop.XOPContext; /** * SOAPConnection implementation * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * * @since 02-Apr-2007 */ public class SOAPProtocolConnectionHTTP extends HTTPRemotingConnection { public UnMarshaller getUnmarshaller() { return new SOAPMessageUnMarshallerHTTP(); } public Marshaller getMarshaller() { return new SOAPMessageMarshaller(); } public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException { try { // enforce xop transitions // TODO: there should be a clear transition to an immutable object model XOPContext.eagerlyCreateAttachments(); // save object model changes SOAPMessage soapMessage = (SOAPMessage)reqMessage; if (reqMessage != null && soapMessage.saveRequired()) soapMessage.saveChanges(); return super.invoke(reqMessage, endpoint, oneway); } catch (SOAPException ex) { IOException io = new IOException(); io.initCause(ex); throw io; } } protected void populateHeaders(MessageAbstraction reqMessage, Map metadata) { super.populateHeaders(reqMessage, metadata); Properties props = (Properties)metadata.get("HEADER"); // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field // with a quoted value equal to the value of the soapAction attribute of // soapbind:operation, if present in the corresponding WSDL description. // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field // with a quoted empty string value, if in the corresponding WSDL description, // the soapAction attribute of soapbind:operation is either not present, or // present with an empty string as its value. MimeHeaders mimeHeaders = reqMessage.getMimeHeaders(); String[] action = mimeHeaders.getHeader("SOAPAction"); if (action != null && action.length > 0) { String soapAction = action[0]; // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string. if (soapAction.startsWith("\"") == false || soapAction.endsWith("\"") == false) soapAction = "\"" + soapAction + "\""; props.put("SOAPAction", soapAction); } else { props.put("SOAPAction", "\"\""); } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/HTTPProtocolConnection.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/HTTPProtocolConn0000644000175000017500000000315610741424331031453 0ustar godgod/* * 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.core.client; // $Id: HTTPProtocolConnection.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ import org.jboss.remoting.marshal.Marshaller; import org.jboss.remoting.marshal.UnMarshaller; import org.jboss.ws.core.jaxws.binding.HTTPMessageMarshaller; import org.jboss.ws.core.jaxws.binding.HTTPMessageUnMarshaller; /** * @since 02-Apr-2007 */ public class HTTPProtocolConnection extends HTTPRemotingConnection { public UnMarshaller getUnmarshaller() { return new HTTPMessageUnMarshaller(); } public Marshaller getMarshaller() { return new HTTPMessageMarshaller(); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/ServiceObjectFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/ServiceObjectFac0000644000175000017500000001213410642000211031454 0ustar godgod/* * 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. */ // $Id: ServiceObjectFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ package org.jboss.ws.core.client; // $Id: ServiceObjectFactory.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.naming.spi.ObjectFactory; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.ws.WSException; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData; /** * This ServiceObjectFactory reconstructs a service for a given WSDL when the webservice client does a JNDI lookup *

      * It uses the information provided by the service-ref element in application-client.xml * * @author Thomas.Diesler@jboss.org * @since 15-April-2004 */ public abstract class ServiceObjectFactory implements ObjectFactory { // provide logging private static final Logger log = Logger.getLogger(ServiceObjectFactory.class); /** * Narrow available endpoints by declarations. * Service.getPort(SEI) must be able to retrieve a distinct port definition. */ protected void narrowPortSelection(UnifiedServiceRefMetaData serviceRef, ServiceMetaData serviceMetaData) { if (serviceMetaData.getEndpoints().size() > 1) { Map pcrefs = new HashMap(); for (UnifiedPortComponentRefMetaData pcref : serviceRef.getPortComponentRefs()) { String seiName = pcref.getServiceEndpointInterface(); // Constraint#1: within a service-ref it's not allowed to use a SEI across different pcref's if (pcrefs.get(seiName) != null) throw new WSException("Within a it's not allowed to use a SEI across different 's: " + seiName); pcrefs.put(seiName, pcref); } // Constraint#2: A pcref may only match one EndpointMetaData for (String sei : pcrefs.keySet()) { // Narrow available endpoints by port-component-ref declaration List narrowedEndpoints = new ArrayList(); UnifiedPortComponentRefMetaData pcref = pcrefs.get(sei); // Constraint#3: Port selection only applies when both SEI and QName are given if (pcref.getServiceEndpointInterface() != null && pcref.getPortQName() != null) { List pcRef2EndpointMapping = new ArrayList(); for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints()) { if (pcref.getServiceEndpointInterface().equals(epMetaData.getServiceEndpointInterfaceName())) { pcRef2EndpointMapping.add(epMetaData.getPortName()); } } for (QName q : pcRef2EndpointMapping) { EndpointMetaData mappedEndpoint = serviceMetaData.getEndpoint(q); if (!pcref.getPortQName().equals(mappedEndpoint.getPortName())) narrowedEndpoints.add(q); } // Constraint: Dont exclude all of them ;) if (pcRef2EndpointMapping.size() > 0 && (pcRef2EndpointMapping.size() == narrowedEndpoints.size())) throw new WSException("Failed to narrow available endpoints by declaration"); for (QName q : narrowedEndpoints) { EndpointMetaData removed = serviceMetaData.removeEndpoint(q); log.debug("Narrowed endpoint " + q + "(" + removed + ")"); } } else { // TODO: In case there is more then one EMPD this should cause an exception log.warn("Unable to narrow port selection for " + pcref); } } } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/HTTPRemotingConnection.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/HTTPRemotingConn0000644000175000017500000003372510741424331031443 0ustar godgod/* * 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.core.client; // $Id$ import java.io.IOException; import java.lang.reflect.Field; import java.net.MalformedURLException; import java.net.SocketTimeoutException; import java.net.URL; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; import javax.xml.rpc.Stub; import javax.xml.soap.MimeHeader; import javax.xml.soap.MimeHeaders; import javax.xml.ws.BindingProvider; import javax.xml.ws.addressing.EndpointReference; import org.jboss.logging.Logger; import org.jboss.remoting.Client; import org.jboss.remoting.InvokerLocator; import org.jboss.remoting.Version; import org.jboss.remoting.marshal.MarshalFactory; import org.jboss.remoting.marshal.Marshaller; import org.jboss.remoting.marshal.UnMarshaller; import org.jboss.ws.core.CommonMessageContext; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.MessageTrace; import org.jboss.ws.core.StubExt; import org.jboss.ws.core.WSTimeoutException; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.metadata.config.EndpointProperty; import org.jboss.ws.extensions.wsrm.transport.RMChannel; import org.jboss.ws.extensions.wsrm.transport.RMTransportHelper; import org.jboss.ws.extensions.wsrm.transport.RMMetadata; /** * SOAPConnection implementation. *

      * * Per default HTTP 1.1 chunked encoding is used. * This may be ovverriden through {@link org.jboss.ws.metadata.config.EndpointProperty#CHUNKED_ENCODING_SIZE}. * A chunksize value of zero disables chunked encoding. * * @author Thomas.Diesler@jboss.org * @author Jason T. Greene * * @since 02-Feb-2005 */ public abstract class HTTPRemotingConnection implements RemoteConnection { // provide logging private static Logger log = Logger.getLogger(HTTPRemotingConnection.class); private Map clientConfig = new HashMap(); private static Map metadataMap = new HashMap(); static { metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username"); metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password"); metadataMap.put(BindingProvider.USERNAME_PROPERTY, "http.basic.username"); metadataMap.put(BindingProvider.PASSWORD_PROPERTY, "http.basic.password"); } private static Map configMap = new HashMap(); static { configMap.put(StubExt.PROPERTY_KEY_STORE, "org.jboss.remoting.keyStore"); configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD, "org.jboss.remoting.keyStorePassword"); configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE, "org.jboss.remoting.keyStoreType"); configMap.put(StubExt.PROPERTY_TRUST_STORE, "org.jboss.remoting.trustStore"); configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD, "org.jboss.remoting.trustStorePassword"); configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE, "org.jboss.remoting.trustStoreType"); } private boolean closed; private static final RMChannel RM_CHANNEL = RMChannel.getInstance(); public HTTPRemotingConnection() { // HTTPClientInvoker conect sends gratuitous POST // http://jira.jboss.com/jira/browse/JBWS-711 clientConfig.put(Client.ENABLE_LEASE, false); } public boolean isClosed() { return closed; } public void setClosed(boolean closed) { this.closed = closed; } /** * Sends the given message to the specified endpoint. * * A null reqMessage signifies a HTTP GET request. */ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException { if (endpoint == null) throw new IllegalArgumentException("Given endpoint cannot be null"); if (closed) throw new IOException("Connection is already closed"); Object timeout = null; String targetAddress; Map callProps = new HashMap(); if (endpoint instanceof EndpointInfo) { EndpointInfo epInfo = (EndpointInfo)endpoint; targetAddress = epInfo.getTargetAddress(); callProps = epInfo.getProperties(); if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT)) { timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT); targetAddress = addURLParameter(targetAddress, "timeout", timeout.toString()); } } else if (endpoint instanceof EndpointReference) { EndpointReference epr = (EndpointReference)endpoint; targetAddress = epr.getAddress().toString(); } else { targetAddress = endpoint.toString(); } // setup remoting client Map metadata = createRemotingMetaData(reqMessage, callProps); Marshaller marshaller = getMarshaller(); UnMarshaller unmarshaller = getUnmarshaller(); InvokerLocator locator = null; try { // Get the invoker from Remoting for a given endpoint address log.debug("Get locator for: " + endpoint); /** * [JBWS-1704] The Use Of Remoting Causes An Additional 'datatype' Parameter To Be Sent On All Requests * * An HTTPClientInvoker may disconnect from the server and recreated by the remoting layer. * In that case the new invoker does not inherit the marshaller/unmarshaller from the disconnected invoker. * We therefore explicitly specify the invoker locator datatype and register the SOAP marshaller/unmarshaller * with the MarshalFactory. * * This applies to remoting-1.4.5 and less */ String version = getRemotingVersion(); if (version.startsWith("1.4")) { targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE, "JBossWSMessage"); MarshalFactory.addMarshaller("JBossWSMessage", marshaller, unmarshaller); } locator = new InvokerLocator(targetAddress); } catch (MalformedURLException e) { throw new IllegalArgumentException("Malformed endpoint address", e); } try { if (RMTransportHelper.isRMMessage(callProps)) { RMMetadata rmMetadata = new RMMetadata(getRemotingVersion(), targetAddress, marshaller, unmarshaller, callProps, metadata, clientConfig); return RM_CHANNEL.send(reqMessage, rmMetadata); } else { Client client = new Client(locator, "jbossws", clientConfig); client.connect(); client.setMarshaller(marshaller); if (oneway == false) client.setUnMarshaller(unmarshaller); if (log.isDebugEnabled()) log.debug("Remoting metadata: " + metadata); // debug the outgoing message MessageTrace.traceMessage("Outgoing Request Message", reqMessage); MessageAbstraction resMessage = null; if (oneway == true) { client.invokeOneway(reqMessage, metadata, false); } else { resMessage = (MessageAbstraction)client.invoke(reqMessage, metadata); } // Disconnect the remoting client client.disconnect(); callProps.clear(); callProps.putAll(metadata); // trace the incomming response message MessageTrace.traceMessage("Incoming Response Message", resMessage); return resMessage; } } catch (Throwable th) { if (timeout != null && (th.getCause() instanceof SocketTimeoutException)) { throw new WSTimeoutException("Timeout after: " + timeout + "ms", new Long(timeout.toString())); } IOException io = new IOException("Could not transmit message"); io.initCause(th); throw io; } } private String addURLParameter(String urlStr, String key, String value) throws MalformedURLException { URL url = new URL(urlStr); urlStr += (url.getQuery() == null ? "?" : "&") + key + "=" + value; return urlStr; } private String getRemotingVersion() { String version = null; try { // Access the constant dynamically, otherwise it will be the compile time value Field field = Version.class.getDeclaredField("VERSION"); version = (String)field.get(null); } catch (Exception ex) { throw new RuntimeException("Cannot obtain remoting version", ex); } if (version == null) { URL codeURL = Version.class.getProtectionDomain().getCodeSource().getLocation(); throw new RuntimeException("Cannot obtain remoting version from: " + codeURL); } return version; } private Map createRemotingMetaData(MessageAbstraction reqMessage, Map callProps) { CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); Map metadata = new HashMap(); // We need to unmarshall faults (HTTP 500) // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA metadata.put("NoThrowOnError", "true"); if (reqMessage != null) { populateHeaders(reqMessage, metadata); // Enable chunked encoding. This is the default size. clientConfig.put("chunkedLength", "1024"); // May be overridden through endpoint config if (msgContext != null) { Properties epmdProps = msgContext.getEndpointMetaData().getProperties(); // chunksize settings String chunkSizeValue = epmdProps.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE); int chunkSize = chunkSizeValue != null ? Integer.valueOf(chunkSizeValue) : -1; if (chunkSize > 0) { clientConfig.put(EndpointProperty.CHUNKED_ENCODING_SIZE, chunkSizeValue); } else { clientConfig.remove("chunkedLength"); } } } else { metadata.put("TYPE", "GET"); } if (callProps != null) { Iterator it = callProps.entrySet().iterator(); // Get authentication type, default to BASIC authetication String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE); if (authType == null) authType = StubExt.PROPERTY_AUTH_TYPE_BASIC; while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); String key = (String)entry.getKey(); Object val = entry.getValue(); // pass properties to remoting meta data if (metadataMap.containsKey(key)) { String remotingKey = metadataMap.get(key); if ("http.basic.username".equals(remotingKey) || "http.basic.password".equals(remotingKey)) { if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC)) { metadata.put(remotingKey, val); } else { log.warn("Ignore '" + key + "' with auth typy: " + authType); } } else { metadata.put(remotingKey, val); } } // pass properties to remoting client config if (configMap.containsKey(key)) { String remotingKey = configMap.get(key); clientConfig.put(remotingKey, val); } } } return metadata; } protected void populateHeaders(MessageAbstraction reqMessage, Map metadata) { MimeHeaders mimeHeaders = reqMessage.getMimeHeaders(); Properties props = new Properties(); metadata.put("HEADER", props); Iterator i = mimeHeaders.getAllHeaders(); while (i.hasNext()) { MimeHeader header = (MimeHeader)i.next(); String currentValue = props.getProperty(header.getName()); /* * Coalesce multiple headers into one * * From HTTP/1.1 RFC 2616: * * Multiple message-header fields with the same field-name MAY be * present in a message if and only if the entire field-value for that * header field is defined as a comma-separated list [i.e., #(values)]. * It MUST be possible to combine the multiple header fields into one * "field-name: field-value" pair, without changing the semantics of * the message, by appending each subsequent field-value to the first, * each separated by a comma. */ if (currentValue != null) { props.put(header.getName(), currentValue + "," + header.getValue()); } else { props.put(header.getName(), header.getValue()); } } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/RemoteConnectionFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/RemoteConnection0000644000175000017500000000422410741424331031604 0ustar godgod/* * 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.core.client; import org.jboss.wsf.spi.util.ServiceLoader; // $Id: RemoteConnectionFactory.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ /** * A factory for remote connections * * @author Thomas.Diesler@jboss.org * @since 10-Jan-2008 */ public class RemoteConnectionFactory { public RemoteConnection getRemoteConnection(EndpointInfo epInfo) { String targetAddress = epInfo.getTargetAddress(); if (targetAddress == null) throw new IllegalArgumentException("Cannot obtain target address from: " + epInfo); String key = null; if (targetAddress.startsWith("http")) key = RemoteConnection.class.getName() + ".http"; else if (targetAddress.startsWith("jms")) key = RemoteConnection.class.getName() + ".jms"; if (key == null) throw new IllegalArgumentException("Cannot obtain remote connetion for: " + targetAddress); RemoteConnection con = (RemoteConnection)ServiceLoader.loadService(key, null); if (con == null) throw new IllegalArgumentException("Cannot obtain remote connetion for: " + key); return con; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/RemoteConnection.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/RemoteConnection0000644000175000017500000000311710741424331031604 0ustar godgod/* * 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.core.client; import java.io.IOException; import org.jboss.remoting.marshal.Marshaller; import org.jboss.remoting.marshal.UnMarshaller; import org.jboss.ws.core.MessageAbstraction; // $Id: RemoteConnection.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ /** * A remote connection * * @author Thomas.Diesler@jboss.org * @since 02-Apr-2007 */ public interface RemoteConnection { Marshaller getMarshaller(); UnMarshaller getUnmarshaller(); MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException; } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/ServiceRefBinderFactoryImpl.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/ServiceRefBinder0000644000175000017500000000344410654112427031520 0ustar godgod/* * 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.core.client; // $Id: ServiceRefBinderJAXWS.java 4049 2007-08-01 11:26:30Z thomas.diesler@jboss.com $ import org.jboss.ws.core.jaxrpc.client.NativeServiceRefBinderJAXRPC; import org.jboss.ws.core.jaxws.client.NativeServiceRefBinderJAXWS; import org.jboss.wsf.spi.serviceref.ServiceRefBinder; import org.jboss.wsf.spi.serviceref.ServiceRefBinderFactory; import org.jboss.wsf.spi.serviceref.ServiceRefHandler.Type; /** * Binds a JAXWS Service object in the client's ENC * * @author Thomas.Diesler@jboss.org * @since 17-Jan-2007 */ public class ServiceRefBinderFactoryImpl implements ServiceRefBinderFactory { public ServiceRefBinder newServiceRefBinder(Type type) { return (type == Type.JAXRPC ? new NativeServiceRefBinderJAXRPC() : new NativeServiceRefBinderJAXWS()); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/EndpointInfo.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/EndpointInfo.jav0000644000175000017500000000567210702657335031525 0ustar godgod/* * 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.core.client; // $Id: EndpointInfo.java 4701 2007-10-09 10:58:37Z thomas.diesler@jboss.com $ import java.util.Iterator; import java.util.Map; import java.util.Properties; import org.jboss.ws.metadata.umdm.EndpointMetaData; /** A wrapper object that associates the target address with some metadata * * @author Thomas.Diesler@jboss.org * @since 20-Jul-2005 */ public class EndpointInfo { private String targetAddress; private Map properties; public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map callProps) { this.targetAddress = targetAddress; this.properties = callProps; // Add the service properties Properties serviceProps = epMetaData.getServiceMetaData().getProperties(); if (serviceProps != null) { Iterator it = serviceProps.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); String key = (String)entry.getKey(); Object val = entry.getValue(); properties.put(key, val); } } // Add the endpoint properties Properties epProps = epMetaData.getProperties(); Iterator it = epProps.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); String key = (String)entry.getKey(); Object val = entry.getValue(); properties.put(key, val); } } public Map getProperties() { return properties; } public String getTargetAddress() { return targetAddress; } public boolean equals(Object obj) { if (!(obj instanceof EndpointInfo)) return false; return toString().equals(obj.toString()); } public int hashCode() { return toString().hashCode(); } public String toString() { return "[addr=" + targetAddress + ",props=" + properties + "]"; } }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/client/SOAPProtocolConn0000644000175000017500000001456210741424331031441 0ustar godgod/* * 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.core.client; // $Id: SOAPProtocolConnectionJMS.java 5456 2008-01-10 14:16:57Z thomas.diesler@jboss.com $ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URI; import java.util.StringTokenizer; import javax.jms.BytesMessage; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.QueueReceiver; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; import javax.xml.ws.addressing.EndpointReference; import org.jboss.remoting.marshal.Marshaller; import org.jboss.remoting.marshal.UnMarshaller; import org.jboss.ws.core.MessageAbstraction; import org.jboss.ws.core.soap.SOAPMessageMarshaller; import org.jboss.ws.core.soap.SOAPMessageUnMarshaller; /** * A SOAPConnection over JMS * * @author Thomas.Diesler@jboss.org * @since 10-Jan-2008 */ public class SOAPProtocolConnectionJMS implements RemoteConnection { private boolean waitForResponse; public UnMarshaller getUnmarshaller() { return new SOAPMessageUnMarshaller(); } public Marshaller getMarshaller() { return new SOAPMessageMarshaller(); } public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean oneway) throws IOException { if (endpoint == null) throw new IllegalArgumentException("Given endpoint cannot be null"); // Get target address String targetAddress; if (endpoint instanceof EndpointInfo) { EndpointInfo epInfo = (EndpointInfo)endpoint; targetAddress = epInfo.getTargetAddress(); } else if (endpoint instanceof EndpointReference) { EndpointReference epr = (EndpointReference)endpoint; targetAddress = epr.getAddress().toString(); } else { targetAddress = endpoint.toString(); } try { URI jmsURI = new URI(targetAddress); String uriHost = jmsURI.getHost(); String uriPath = jmsURI.getPath(); String reqQueueName = getURLProperty(jmsURI, "destinationName"); if (reqQueueName == null) { reqQueueName = uriHost; if (uriPath != null && uriPath.length() > 0) reqQueueName += uriPath; } InitialContext context = new InitialContext(); QueueConnectionFactory connectionFactory = (QueueConnectionFactory)context.lookup("ConnectionFactory"); Queue reqQueue = (Queue)context.lookup(reqQueueName); QueueConnection con = connectionFactory.createQueueConnection(); QueueSession session = con.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); con.start(); ByteArrayOutputStream output = new ByteArrayOutputStream(); getMarshaller().write(reqMessage, output); BytesMessage message = session.createBytesMessage(); message.writeBytes(output.toByteArray()); ResponseListener responseListener = null; if (oneway == false) { String resQueueName = getURLProperty(jmsURI, "replyToName"); Queue resQueue = (Queue)context.lookup(resQueueName); QueueReceiver receiver = session.createReceiver(resQueue); responseListener = new ResponseListener(); receiver.setMessageListener(responseListener); message.setJMSReplyTo(resQueue); waitForResponse = true; } QueueSender sender = session.createSender(reqQueue); sender.send(message); sender.close(); MessageAbstraction resMessage = null; if (responseListener != null) { int timeout = 5000; while (waitForResponse && timeout > 0) { Thread.sleep(100); timeout -= 100; } ByteArrayInputStream bais = new ByteArrayInputStream(responseListener.resMessage.getBytes()); resMessage = (MessageAbstraction)getUnmarshaller().read(bais, null); } con.stop(); session.close(); con.close(); return resMessage; } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { IOException ioex = new IOException(ex.getMessage()); ioex.initCause(ex); throw ioex; } } private String getURLProperty(URI uri, String key) { String retValue = null; String query = uri.getQuery(); if (query != null) { StringTokenizer st = new StringTokenizer(query, "?:="); while (retValue == null && st.hasMoreTokens()) { String propName = st.nextToken(); String propValue = st.nextToken(); if (propName.equals(key)) retValue = propValue; } } return retValue; } public class ResponseListener implements MessageListener { public String resMessage; public void onMessage(Message msg) { TextMessage textMessage = (TextMessage)msg; try { resMessage = textMessage.getText(); waitForResponse = false; } catch (Throwable t) { t.printStackTrace(); } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/StubExt.java0000644000175000017500000001125510702657335027404 0ustar godgod/* * 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.core; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.soap.AttachmentPart; import org.jboss.ws.metadata.umdm.EndpointMetaData; // $Id: StubExt.java 4701 2007-10-09 10:58:37Z thomas.diesler@jboss.com $ /** * An extension of the standard JAXRPC/JAXWS stubs. * * @author Thomas.Diesler@jboss.org * @since 17-Jan-2007 */ public interface StubExt extends ConfigProvider { /** ClientTimeout property: org.jboss.ws.timeout */ static final String PROPERTY_CLIENT_TIMEOUT = "org.jboss.ws.timeout"; /** KeyStore property: org.jboss.ws.keyStore */ static final String PROPERTY_KEY_STORE = "org.jboss.ws.keyStore"; /** KeyStorePassword property: org.jboss.ws.keyStorePassword */ static final String PROPERTY_KEY_STORE_PASSWORD = "org.jboss.ws.keyStorePassword"; /** KeyStoreType property: org.jboss.ws.keyStoreType */ static final String PROPERTY_KEY_STORE_TYPE = "org.jboss.ws.keyStoreType"; /** TrustStore property: org.jboss.ws.trustStore */ static final String PROPERTY_TRUST_STORE = "org.jboss.ws.trustStore"; /** TrustStorePassword property: org.jboss.ws.trustStorePassword */ static final String PROPERTY_TRUST_STORE_PASSWORD = "org.jboss.ws.trustStorePassword"; /** TrustStoreType property: org.jboss.ws.trustStoreType */ static final String PROPERTY_TRUST_STORE_TYPE = "org.jboss.ws.trustStoreType"; /** Authentication type, used to specify basic, etc) */ static final String PROPERTY_AUTH_TYPE = "org.jboss.ws.authType"; /** Authentication type, BASIC */ static final String PROPERTY_AUTH_TYPE_BASIC = "org.jboss.ws.authType.basic"; /** Authentication type, WSEE */ static final String PROPERTY_AUTH_TYPE_WSSE = "org.jboss.ws.authType.wsse"; /** Enable MTOM on the stub */ static final String PROPERTY_MTOM_ENABLED= "org.jboss.ws.mtom.enabled"; /** * Get the endpoint meta data for this stub */ EndpointMetaData getEndpointMetaData(); /** * Add a header that is not bound to an input parameter. * A propriatory extension, that is not part of JAXRPC. * * @param xmlName The XML name of the header element * @param xmlType The XML type of the header element */ void addUnboundHeader(QName xmlName, QName xmlType, Class javaType, ParameterMode mode); /** * Get the header value for the given XML name. * A propriatory extension, that is not part of JAXRPC. * * @param xmlName The XML name of the header element * @return The header value, or null */ Object getUnboundHeaderValue(QName xmlName); /** * Set the header value for the given XML name. * A propriatory extension, that is not part of JAXRPC. * * @param xmlName The XML name of the header element */ void setUnboundHeaderValue(QName xmlName, Object value); /** * Clear all registered headers. * A propriatory extension, that is not part of JAXRPC. */ void clearUnboundHeaders(); /** * Remove the header for the given XML name. * A propriatory extension, that is not part of JAXRPC. */ void removeUnboundHeader(QName xmlName); /** * Get an Iterator over the registered header XML names. * A propriatory extension, that is not part of JAXRPC. */ Iterator getUnboundHeaders(); /** * Adds the given AttachmentPart object to the outgoing SOAPMessage. * An AttachmentPart object must be created before it can be added to a message. */ void addAttachmentPart(AttachmentPart attachmentpart); /** * Clears the list of attachment parts. */ void clearAttachmentParts(); /** * Creates a new empty AttachmentPart object. */ AttachmentPart createAttachmentPart(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonBinding.java0000644000175000017500000000506510642000211030505 0ustar godgod/* * 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.core; // $Id: CommonBinding.java 3772 2007-07-01 19:29:13Z thomas.diesler@jboss.com $ import java.util.Map; import javax.xml.namespace.QName; import org.jboss.ws.core.binding.BindingException; import org.jboss.ws.core.soap.UnboundHeader; import org.jboss.ws.metadata.umdm.OperationMetaData; /** * The base interface for protocol bindings. * * @author Thomas.Diesler@jboss.com * @since 04-Jul-2006 */ public interface CommonBinding { /** On the client side, generate the Object from IN parameters. */ MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map unboundHeaders) throws BindingException; /** On the server side, extract the IN parameters from the Object and populate an Invocation object */ EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, MessageAbstraction reqMessage) throws BindingException; /** On the server side, generate the Object from OUT parameters in the Invocation object. */ MessageAbstraction bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException; /** On the client side, extract the OUT parameters from the Object and return them to the client. */ void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction resMessage, EndpointInvocation epInv, Map unboundHeaders) throws BindingException; /** bind an exception to a fault message */ MessageAbstraction bindFaultMessage(Exception ex); void setHeaderSource(HeaderSource source); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonSOAPFaultException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonSOAPFaultExceptio0000755000175000017500000000326610642000211031456 0ustar godgod/* * 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.core; // $Id: SOAPFaultException.java 3509 2007-06-08 15:50:12Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; /** * The SOAPFaultException exception represents a SOAP fault. * * @author Thomas.Diesler@jboss.org */ public class CommonSOAPFaultException extends RuntimeException { private QName faultCode; private String faultString; public CommonSOAPFaultException(QName faultCode, String faultString) { super(faultString); this.faultCode = faultCode; this.faultString = faultString; } public QName getFaultCode() { return faultCode; } public String getFaultString() { return faultString; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonClient.java0000644000175000017500000006041110741424331030362 0ustar godgod/* * 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.core; // $Id:CommonClient.java 660 2006-08-01 16:29:43Z thomas.diesler@jboss.com $ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.ParameterMode; import javax.xml.soap.AttachmentPart; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPException; import javax.xml.ws.addressing.AddressingProperties; import javax.xml.ws.addressing.JAXWSAConstants; import org.jboss.logging.Logger; import org.jboss.ws.Constants; import org.jboss.ws.WSException; import org.jboss.ws.core.DirectionHolder.Direction; import org.jboss.ws.core.client.EndpointInfo; import org.jboss.ws.core.client.RemoteConnection; import org.jboss.ws.core.client.RemoteConnectionFactory; import org.jboss.ws.core.client.SOAPProtocolConnectionHTTP; import org.jboss.ws.core.jaxrpc.ParameterWrapping; import org.jboss.ws.core.soap.MessageContextAssociation; import org.jboss.ws.core.soap.Style; import org.jboss.ws.core.soap.UnboundHeader; import org.jboss.ws.core.utils.HolderUtils; import org.jboss.ws.extensions.addressing.AddressingConstantsImpl; import org.jboss.ws.extensions.wsrm.RMConstant; import org.jboss.ws.metadata.umdm.ClientEndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.OperationMetaData; import org.jboss.ws.metadata.umdm.ParameterMetaData; import org.jboss.ws.metadata.umdm.ServiceMetaData; import org.jboss.ws.metadata.umdm.UnifiedMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory; import org.jboss.ws.metadata.wsse.WSSecurityConfiguration; import org.jboss.wsf.common.ResourceLoaderAdapter; import org.jboss.wsf.spi.deployment.UnifiedVirtualFile; import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType; /** * Provides support for the dynamic invocation of a service endpoint. * * @author Thomas.Diesler@jboss.org * @since 10-Oct-2004 */ public abstract class CommonClient implements StubExt, HeaderSource { // provide logging private static Logger log = Logger.getLogger(CommonClient.class); public static String SESSION_COOKIES = "org.jboss.ws.maintain.session.cookies"; // The endpoint together with the operationName uniquely identify the call operation protected EndpointMetaData epMetaData; // The current operation name protected QName operationName; // Output parameters protected EndpointInvocation epInv; // The binding provider protected CommonBindingProvider bindingProvider; // A Map of header entries private Map unboundHeaders = new LinkedHashMap(); // A List of attachment parts set through the proxy private List attachmentParts = new ArrayList(); // The WS-Security config private String securityConfig; /** Create a call that needs to be configured manually */ protected CommonClient(ServiceMetaData serviceMetaData) { // If the WSDLService has only one endpoint, use it if (serviceMetaData != null && serviceMetaData.getEndpoints().size() == 1) { this.epMetaData = serviceMetaData.getEndpoints().get(0); } // Initialize the binding provider this.bindingProvider = getCommonBindingProvider(); } /** Create a call for a known WSDL endpoint. */ protected CommonClient(EndpointMetaData epMetaData) { this.epMetaData = epMetaData; // Initialize the binding provider this.bindingProvider = getCommonBindingProvider(); } /** Create a call for a known WSDL endpoint. */ protected CommonClient(ServiceMetaData serviceMetaData, QName portName, QName opName) { if (serviceMetaData != null) { EndpointMetaData epMetaData = null; if (serviceMetaData.getEndpoints().size() > 0) { epMetaData = serviceMetaData.getEndpoint(portName); if (epMetaData == null) throw new WSException("Cannot find endpoint for name: " + portName); } if (epMetaData != null) { this.epMetaData = epMetaData; } } if (opName != null) { setOperationName(opName); } // Initialize the binding provider this.bindingProvider = getCommonBindingProvider(); } /** Gets the address of a target service endpoint. */ public abstract String getTargetEndpointAddress(); /** Sets the address of the target service endpoint. */ public abstract void setTargetEndpointAddress(String address); /** Gets the name of the operation to be invoked using this Call instance. */ public QName getOperationName() { return this.operationName; } /** Sets the name of the operation to be invoked using this Call instance. */ public void setOperationName(QName operationName) { this.operationName = operationName; } /** Get the OperationMetaData for the given operation name * If it does not exist, it will be created */ public OperationMetaData getOperationMetaData() { if (operationName == null) throw new WSException("Operation name not set"); return getOperationMetaData(operationName); } // Get the OperationMetaData for the given operation name // If it does not exist, it will be created public OperationMetaData getOperationMetaData(QName opName) { if (opName == null) throw new IllegalArgumentException("Cannot get OperationMetaData for null"); EndpointMetaData epMetaData = getEndpointMetaData(); OperationMetaData opMetaData = epMetaData.getOperation(opName); if (opMetaData == null && epMetaData.getServiceMetaData().getWsdlDefinitions() == null) { opMetaData = new OperationMetaData(epMetaData, opName, opName.getLocalPart()); epMetaData.addOperation(opMetaData); } if (opMetaData == null) throw new WSException("Cannot obtain operation meta data for: " + opName); return opMetaData; } // Get the EndpointMetaData for all OperationMetaData public EndpointMetaData getEndpointMetaData() { if (epMetaData == null) { ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); UnifiedVirtualFile vfsRoot = new ResourceLoaderAdapter(); UnifiedMetaData wsMetaData = new UnifiedMetaData(vfsRoot); wsMetaData.setClassLoader(ctxLoader); ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(Constants.NS_JBOSSWS_URI, "AnonymousService")); wsMetaData.addService(serviceMetaData); QName anonQName = new QName(Constants.NS_JBOSSWS_URI, "Anonymous"); QName anonPort = new QName(Constants.NS_JBOSSWS_URI, "AnonymousPort"); epMetaData = new ClientEndpointMetaData(serviceMetaData, anonPort, anonQName, Type.JAXRPC); epMetaData.setStyle(Style.RPC); serviceMetaData.addEndpoint(epMetaData); } return epMetaData; } protected abstract boolean callRequestHandlerChain(QName portName, HandlerType type); protected abstract boolean callResponseHandlerChain(QName portName, HandlerType type); protected abstract boolean callFaultHandlerChain(QName portName, HandlerType type, Exception ex); protected abstract void closeHandlerChain(QName portName, HandlerType type); protected abstract void setInboundContextProperties(); protected abstract void setOutboundContextProperties(); protected abstract boolean shouldMaintainSession(); /** Call invokation goes as follows: * * 1) synchronize the operation name with the operation meta data * 2) synchronize the input parameters with the operation meta data * 3) generate the payload using a BindingProvider * 4) get the Invoker from Remoting, based on the target endpoint address * 5) do the invocation through the Remoting framework * 6) unwrap the result using the BindingProvider * 7) return the result */ protected Object invoke(QName opName, Object[] inputParams, boolean forceOneway) throws Exception { if (opName.equals(operationName) == false) setOperationName(opName); OperationMetaData opMetaData = getOperationMetaData(); boolean oneway = forceOneway || opMetaData.isOneWay(); // Associate a message context with the current thread CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext(); msgContext.setOperationMetaData(opMetaData); // Copy properties to the message context msgContext.putAll(getRequestContext()); // The direction of the message DirectionHolder direction = new DirectionHolder(Direction.OutBound); // Get the order of pre/post handlerchains HandlerType[] handlerType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST }; HandlerType[] faultType = new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST }; QName portName = epMetaData.getPortName(); try { // Get the binding from the provider CommonBinding binding = (CommonBinding)getCommonBindingProvider().getCommonBinding(); binding.setHeaderSource(this); // Create the invocation and sync the input parameters epInv = new EndpointInvocation(opMetaData); epInv.initInputParams(inputParams); // Set the required outbound properties setOutboundContextProperties(); // Bind the request message MessageAbstraction reqMessage = binding.bindRequestMessage(opMetaData, epInv, unboundHeaders); // Add possible attachment parts addAttachmentParts(reqMessage); // Call the request handlers boolean handlerPass = callRequestHandlerChain(portName, handlerType[0]); handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[1]); handlerPass = handlerPass && callRequestHandlerChain(portName, handlerType[2]); // Handlers might have replaced the message reqMessage = msgContext.getMessageAbstraction(); if (handlerPass) { String targetAddress = getTargetEndpointAddress(); // Fall back to wsa:To AddressingProperties addrProps = (AddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND); if (targetAddress == null && addrProps != null && addrProps.getTo() != null) { AddressingConstantsImpl ADDR = new AddressingConstantsImpl(); String wsaTo = addrProps.getTo().getURI().toString(); if (wsaTo.equals(ADDR.getAnonymousURI()) == false) { try { URL wsaToURL = new URL(wsaTo); log.debug("Sending request to addressing destination: " + wsaToURL); targetAddress = wsaToURL.toExternalForm(); } catch (MalformedURLException ex) { log.debug("Not a valid URL: " + wsaTo); } } } // The endpoint address must be known beyond this point if (targetAddress == null) throw new WSException("Target endpoint address not set"); Map callProps = new HashMap(getRequestContext()); EndpointInfo epInfo = new EndpointInfo(epMetaData, targetAddress, callProps); if (shouldMaintainSession()) addSessionInfo(reqMessage, callProps); RemoteConnection remoteConnection = new RemoteConnectionFactory().getRemoteConnection(epInfo); MessageAbstraction resMessage = remoteConnection.invoke(reqMessage, epInfo, oneway); if (shouldMaintainSession()) saveSessionInfo(callProps, getRequestContext()); // At pivot the message context might be replaced msgContext = processPivotInternal(msgContext, direction); // Copy the remoting meta data msgContext.put(CommonMessageContext.REMOTING_METADATA, callProps); // Associate response message with message context msgContext.setMessageAbstraction(resMessage); } setInboundContextProperties(); // Get the return object Object retObj = null; boolean isWsrmMessage = msgContext.get(RMConstant.REQUEST_CONTEXT) != null; boolean wsrmOneWay = false; if (isWsrmMessage) { Boolean temp = (Boolean)((Map)msgContext.get(RMConstant.REQUEST_CONTEXT)).get(RMConstant.ONE_WAY_OPERATION); wsrmOneWay = (temp == null) ? Boolean.FALSE : temp.booleanValue(); } if ((oneway == false && handlerPass) || (isWsrmMessage && (wsrmOneWay == false))) { // Verify if (binding instanceof CommonSOAPBinding) ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData); // Call the response handler chain, removing the fault type entry will not call handleFault for that chain handlerPass = callResponseHandlerChain(portName, handlerType[2]); faultType[2] = null; // unbind the return values if (handlerPass) { // unbind the return values MessageAbstraction resMessage = msgContext.getMessageAbstraction(); binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders); } handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[1]); faultType[1] = null; handlerPass = handlerPass && callResponseHandlerChain(portName, handlerType[0]); faultType[0] = null; // Check if protocol handlers modified the payload if (msgContext.isModified()) { log.debug("Handler modified body payload, unbind message again"); MessageAbstraction resMessage = msgContext.getMessageAbstraction(); binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders); } retObj = syncOutputParams(inputParams, epInv); } return retObj; } catch (Exception ex) { // Reverse the message direction processPivotInternal(msgContext, direction); if (faultType[2] != null) callFaultHandlerChain(portName, faultType[2], ex); if (faultType[1] != null) callFaultHandlerChain(portName, faultType[1], ex); if (faultType[0] != null) callFaultHandlerChain(portName, faultType[0], ex); throw ex; } finally { closeHandlerChain(portName, handlerType[2]); closeHandlerChain(portName, handlerType[1]); closeHandlerChain(portName, handlerType[0]); } } private void saveSessionInfo(Map remotingMetadata, Map requestContext) { Map cookies = (Map)requestContext.get(SESSION_COOKIES); if (cookies == null) { cookies = new HashMap(); requestContext.put(SESSION_COOKIES, cookies); } List setCookies = new ArrayList(); List setCookies1 = (List)remotingMetadata.get("Set-Cookie"); if (setCookies1 != null) setCookies.addAll(setCookies1); List setCookies2 = (List)remotingMetadata.get("Set-Cookie2"); if (setCookies2 != null) setCookies.addAll(setCookies2); // TODO: The parsing here should be improved to be fully compliant with the RFC for (String setCookie : setCookies) { int index = setCookie.indexOf(';'); if (index == -1) continue; String pair = setCookie.substring(0, index); index = pair.indexOf('='); if (index == -1) continue; String name = pair.substring(0, index); String value = pair.substring(index + 1); cookies.put(name, value); } } protected void addSessionInfo(MessageAbstraction reqMessage, Map callProperties) { Map cookies = (Map)callProperties.get(SESSION_COOKIES); if (cookies != null) { for (Map.Entry cookie : cookies.entrySet()) { reqMessage.getMimeHeaders().addHeader("Cookie", cookie.getKey() + "=" + cookie.getValue()); } } } private CommonMessageContext processPivotInternal(CommonMessageContext msgContext, DirectionHolder direction) { if (direction.getDirection() == Direction.OutBound) { msgContext = processPivot(msgContext); direction.setDirection(Direction.InBound); } return msgContext; } protected void addAttachmentParts(MessageAbstraction reqMessage) { for (AttachmentPart part : attachmentParts) { log.debug("Adding attachment part: " + part.getContentId()); reqMessage.addAttachmentPart(part); } } protected abstract CommonMessageContext processPivot(CommonMessageContext requestContext); protected abstract CommonBindingProvider getCommonBindingProvider(); protected abstract Map getRequestContext(); /** Synchronize the operation paramters with the call output parameters. */ private Object syncOutputParams(Object[] inParams, EndpointInvocation epInv) throws SOAPException { Object retValue = null; // Assign the return value, if we have a return param OperationMetaData opMetaData = getOperationMetaData(); ParameterMetaData retMetaData = opMetaData.getReturnParameter(); if (retMetaData != null) { retValue = epInv.getReturnValue(); if (opMetaData.isDocumentWrapped() && retMetaData.isMessageType() == false) retValue = ParameterWrapping.unwrapResponseParameters(retMetaData, retValue, inParams); } // Set the holder values for INOUT parameters for (ParameterMetaData paramMetaData : opMetaData.getParameters()) { ParameterMode paramMode = paramMetaData.getMode(); int index = paramMetaData.getIndex(); if (index == -1 || paramMode == ParameterMode.INOUT || paramMode == ParameterMode.OUT) { QName xmlName = paramMetaData.getXmlName(); Object value = epInv.getResponseParamValue(xmlName); // document/literal wrapped return value header if (index == -1) { retValue = value; } else { if (log.isTraceEnabled()) log.trace("holder [" + index + "] " + xmlName); HolderUtils.setHolderValue(inParams[index], value); } } } return retValue; } /** * Add a header that is not bound to an input parameter. * A propriatory extension, that is not part of JAXRPC. * * @param xmlName The XML name of the header element * @param xmlType The XML type of the header element */ public void addUnboundHeader(QName xmlName, QName xmlType, Class javaType, ParameterMode mode) { UnboundHeader unboundHeader = new UnboundHeader(xmlName, xmlType, javaType, mode); unboundHeaders.put(xmlName, unboundHeader); } /** * Get the header value for the given XML name. * A propriatory extension, that is not part of JAXRPC. * * @param xmlName The XML name of the header element * @return The header value, or null */ public Object getUnboundHeaderValue(QName xmlName) { UnboundHeader unboundHeader = unboundHeaders.get(xmlName); return (unboundHeader != null ? unboundHeader.getHeaderValue() : null); } /** * Set the header value for the given XML name. * A propriatory extension, that is not part of JAXRPC. * * @param xmlName The XML name of the header element */ public void setUnboundHeaderValue(QName xmlName, Object value) { UnboundHeader unboundHeader = unboundHeaders.get(xmlName); if (unboundHeader == null) throw new IllegalArgumentException("Cannot find unbound header: " + xmlName); unboundHeader.setHeaderValue(value); } /** * Clear all registered headers. * A propriatory extension, that is not part of JAXRPC. */ public void clearUnboundHeaders() { unboundHeaders.clear(); } /** * Remove the header for the given XML name. * A propriatory extension, that is not part of JAXRPC. */ public void removeUnboundHeader(QName xmlName) { unboundHeaders.remove(xmlName); } /** * Get an Iterator over the registered header XML names. * A propriatory extension, that is not part of JAXRPC. */ public Iterator getUnboundHeaders() { return unboundHeaders.keySet().iterator(); } /** * Adds the given AttachmentPart object to the outgoing SOAPMessage. * An AttachmentPart object must be created before it can be added to a message. */ public void addAttachmentPart(AttachmentPart part) { attachmentParts.add(part); } /** * Clears the list of attachment parts. */ public void clearAttachmentParts() { attachmentParts.clear(); } /** * Creates a new empty AttachmentPart object. */ public AttachmentPart createAttachmentPart() { try { MessageFactory factory = MessageFactory.newInstance(); return factory.createMessage().createAttachmentPart(); } catch (SOAPException ex) { throw new JAXRPCException("Cannot create attachment part"); } } public String getConfigName() { EndpointMetaData epMetaData = getEndpointMetaData(); return epMetaData.getConfigName(); } public void setConfigName(String configName) { setConfigName(configName, null); } public abstract void setConfigName(String configName, String configFile); public String getConfigFile() { EndpointMetaData epMetaData = getEndpointMetaData(); return epMetaData.getConfigFile(); } public String getSecurityConfig() { return securityConfig; } public void setSecurityConfig(String securityConfig) { this.securityConfig = securityConfig; if (securityConfig != null) { EndpointMetaData epMetaData = getEndpointMetaData(); ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData(); if (serviceMetaData.getSecurityConfiguration() == null) { try { WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance(); UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile(); WSSecurityConfiguration config = wsseConfFactory.createConfiguration(vfsRoot, securityConfig); serviceMetaData.setSecurityConfiguration(config); } catch (IOException ex) { WSException.rethrow("Cannot set security config", ex); } } } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonBindingProvider.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/core/CommonBindingProvider.j0000644000175000017500000000726310702676776031572 0ustar godgod/* * 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.core; // $Id: CommonBindingProvider.java 4707 2007-10-09 13:11:26Z heiko.braun@jboss.com $ import java.util.Observable; import javax.xml.ws.http.HTTPBinding; import javax.xml.ws.soap.SOAPBinding; import org.jboss.logging.Logger; import org.jboss.ws.core.jaxrpc.SOAP11BindingJAXRPC; import org.jboss.ws.core.jaxrpc.SOAP12BindingJAXRPC; import org.jboss.ws.core.jaxws.binding.HTTPBindingJAXWS; import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS; import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS; import org.jboss.ws.metadata.config.Configurable; import org.jboss.ws.metadata.umdm.EndpointMetaData; import org.jboss.ws.metadata.umdm.EndpointMetaData.Type; /** * Provides access to the protocol binding. * * @author Thomas.Diesler@jboss.com * @author Heiko.Braun@jboss.com * @since 04-Jul-2006 */ public class CommonBindingProvider implements Configurable { private static Logger log = Logger.getLogger(CommonBindingProvider.class); protected EndpointMetaData epMetaData; protected CommonBinding binding; public CommonBindingProvider(EndpointMetaData epMetaData) { this.epMetaData = epMetaData; initBinding(epMetaData.getBindingId(), epMetaData.getType()); this.epMetaData.registerConfigObserver(this); configure(); } public CommonBindingProvider(String bindingId, Type type) { initBinding(bindingId, type); configure(); } private void configure() { // process MTOM config elements if (epMetaData != null) { epMetaData.configure(this); } } protected void initBinding(String bindingId, Type type) { if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId)) { binding = (type == Type.JAXWS ? new SOAP11BindingJAXWS() : new SOAP11BindingJAXRPC()); } else if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingId)) { binding = (type == Type.JAXWS ? new SOAP11BindingJAXWS(true) : new SOAP11BindingJAXRPC(true)); } else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId)) { binding = (type == Type.JAXWS ? new SOAP12BindingJAXWS() : new SOAP12BindingJAXRPC()); } else if (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingId)) { binding = (type == Type.JAXWS ? new SOAP12BindingJAXWS(true) : new SOAP12BindingJAXRPC(true)); } else if (HTTPBinding.HTTP_BINDING.equals(bindingId)) { binding = new HTTPBindingJAXWS(); } } public CommonBinding getCommonBinding() { return binding; } public void update(Observable observable, Object object) { if(log.isDebugEnabled()) log.debug("Update config: " + object); configure(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/annotation/0000755000175000017500000000000010755000267026353 5ustar godgod././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/annotation/EndpointConfig.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/annotation/EndpointConfig.ja0000644000175000017500000000404310565334563031606 0ustar godgod/* * 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.annotation; // $Id: $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Defines an endpoint or client configuration. * This annotation is valid on an endpoint implementaion bean or a SEI. * * @author Heiko.Braun@jboss.org * @since 16.01.2007 */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.TYPE }) public @interface EndpointConfig { /** * The optional config-name element gives the configuration name that must be present in * the configuration given by element config-file. * * Server side default: Standard Endpoint * Client side default: Standard Client */ String configName() default ""; /** * The optional config-file element is a URL or resource name for the configuration. * * Server side default: standard-jaxws-endpoint-config.xml * Client side default: standard-jaxws-client-config.xml */ String configFile() default ""; } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/annotation/Documentation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/annotation/Documentation.jav0000644000175000017500000000277310743173754031710 0ustar godgod/* * 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.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation to be used to add wsdl:documentation elements to the generated wsdl. * * @author alessio.soldano@jboss.org * @since 15-Jan-2008 */ @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Documentation { public String content(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/WSException.java0000644000175000017500000000362310553433253027261 0ustar godgod/* * 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; /** * A RuntimeException that should be thrown when a cause is needed * * The retrotranslator-0.9.5 cannot handle * * new IllegalStateException(String, Throwable) * * @author Thomas.Diesler@jboss.org * @since 06-Jan-2006 */ public class WSException extends RuntimeException { public WSException() { } public WSException(String message) { super(message); } public WSException(String message, Throwable cause) { super(message, cause); } public WSException(Throwable cause) { super(cause); } public static void rethrow(String string, Throwable th) { if (th instanceof WSException) throw (WSException)th; throw new WSException(string, th); } public static void rethrow(Throwable th) { if (th instanceof WSException) throw (WSException)th; throw new WSException(th); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/ws/Constants.java0000644000175000017500000005150710703375307027033 0ustar godgod/* * 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; import javax.xml.namespace.QName; import javax.xml.soap.Name; import javax.xml.soap.SOAPConstants; import javax.xml.ws.http.HTTPBinding; import javax.xml.ws.soap.SOAPBinding; import org.jboss.ws.core.soap.NameImpl; /** * A collection of constants relevant to JBossWS * * @author Thomas.Diesler@jboss.org * @author Anil.Saldhana@jboss.org * @since 10-Oct-2004 */ public interface Constants { /** Header for XML Documents */ static final String XML_HEADER = ""; /** Default charset for XML Documents */ static final String DEFAULT_XML_CHARSET = "UTF-8"; /** JBossWS namespace URI */ static final String NS_JBOSSWS_URI = "http://www.jboss.org/jbossws"; /** XML Namespace */ static final String NS_XML = "http://www.w3.org/XML/1998/namespace"; /** XML namespace declaration namespace */ static final String NS_XMLNS = "http://www.w3.org/2000/xmlns/"; /** XMLSchema namespace http://www.w3.org/2001/XMLSchema */ static final String NS_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema"; /** XMLSchema instance namespace http://www.w3.org/2001/XMLSchema-instance */ static final String NS_SCHEMA_XSI = "http://www.w3.org/2001/XMLSchema-instance"; /** SOAP-1.1 namespace http://schemas.xmlsoap.org/wsdl/soap/ */ static final String NS_SOAP11 = "http://schemas.xmlsoap.org/wsdl/soap/"; /** SOAP-1.1 envelope namespace http://schemas.xmlsoap.org/soap/envelope/ */ static final String NS_SOAP11_ENV = SOAPConstants.URI_NS_SOAP_ENVELOPE; /** SOAP-1.2 namespace http://schemas.xmlsoap.org/wsdl/soap12/ */ static final String NS_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/"; /** HTTP binding namespace http://schemas.xmlsoap.org/wsdl/http/ */ static final String NS_HTTP = "http://schemas.xmlsoap.org/wsdl/http/"; /** SOAP-1.2 envelope namespace http://www.w3.org/2003/05/soap-envelope */ static final String NS_SOAP12_ENV = SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE; /** The namespace for the SwA mime type */ static final String NS_SWA_MIME = "http://schemas.xmlsoap.org/wsdl/mime/"; /** Default namespace for WSDL-1.1 http://schemas.xmlsoap.org/wsdl/ */ static final String NS_WSDL11 = "http://schemas.xmlsoap.org/wsdl/"; /** The namespace for the MTOM content type attribute. */ static final String NS_XML_MIME = "http://www.w3.org/2005/05/xmlmime"; /** The namespace for XOP. */ static final String NS_XOP = "http://www.w3.org/2004/08/xop/include"; /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */ public static final String SOAP11HTTP_BINDING = SOAPBinding.SOAP11HTTP_BINDING; /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */ public static final String SOAP12HTTP_BINDING = SOAPBinding.SOAP12HTTP_BINDING; /** A constant representing the identity of the SOAP 1.1 over HTTP binding with MTOM enabled by default. */ public static final String SOAP11HTTP_MTOM_BINDING = SOAPBinding.SOAP11HTTP_MTOM_BINDING; /** A constant representing the identity of the SOAP 1.2 over HTTP binding with MTOM enabled by default. */ public static final String SOAP12HTTP_MTOM_BINDING = SOAPBinding.SOAP12HTTP_MTOM_BINDING; /** A constant representing the identity of the XML/HTTP binding. */ public static final String HTTP_BINDING = HTTPBinding.HTTP_BINDING; /** SOAP-1.1 encoding URI */ static final String URI_SOAP11_ENC = SOAPConstants.URI_NS_SOAP_ENCODING; /** SOAP-1.2 encoding URI */ static final String URI_SOAP12_ENC = SOAPConstants.URI_NS_SOAP_1_2_ENCODING; /** SOAP HTTP transport URI in wsdl soap binding */ static final String URI_SOAP_HTTP = "http://schemas.xmlsoap.org/soap/http"; /** Literal encoding URI */ static final String URI_LITERAL_ENC = ""; /** WSDL 2.0 Encoding Rules */ static final String URI_STYLE_RPC = "http://www.w3.org/2004/03/wsdl/style/rpc"; static final String URI_STYLE_DOCUMENT = "http://www.w3.org/2004/03/wsdl/style/iri"; /** WS-Eventing namespace uri **/ static final String URI_WS_EVENTING = "http://schemas.xmlsoap.org/ws/2004/08/eventing"; /** WS-Policy namespace uri **/ static final String URI_WS_POLICY = "http://schemas.xmlsoap.org/ws/2004/09/policy"; /** WS-Addressing namespace uri **/ static final String URI_WS_ADDRESSING = "http://www.w3.org/2005/08/addressing"; /**Style of WSDL */ static final String RPC_LITERAL = "RPC/Literal"; static final String DOCUMENT_LITERAL = "Document/Literal"; // Some prefixes static final String PREFIX_ENV = SOAPConstants.SOAP_ENV_PREFIX; static final String PREFIX_XMIME = "xmime"; static final String PREFIX_SOAP11 = "soap"; static final String PREFIX_SOAP11_ENC = "soap11-enc"; static final String PREFIX_TNS = "tns"; static final String PREFIX_WSDL = "wsdl"; static final String PREFIX_XOP = "xop"; static final String PREFIX_XSD = "xsd"; static final String PREFIX_XSI = "xsi"; static final String PREFIX_XML = "xml"; /** XOP Include */ static final QName NAME_XOP_INCLUDE = new QName(NS_XOP, "Include", PREFIX_XOP); /** SOAP-1.1 roles */ static final String URI_SOAP11_NEXT_ACTOR = "http://schemas.xmlsoap.org/soap/actor/next"; /** SOAP-1.1 attributes */ static final String SOAP11_ATTR_ACTOR = "actor"; static final String SOAP11_ATTR_MUST_UNDERSTAND = "mustUnderstand"; /** SOAP-1.1 fault codes */ static final QName SOAP11_FAULT_CODE_CLIENT = new QName(NS_SOAP11_ENV, "Client", PREFIX_ENV); static final QName SOAP11_FAULT_CODE_SERVER = new QName(NS_SOAP11_ENV, "Server", PREFIX_ENV); static final QName SOAP11_FAULT_CODE_VERSION_MISMATCH = new QName(NS_SOAP11_ENV, "VersionMismatch", PREFIX_ENV); static final QName SOAP11_FAULT_CODE_MUST_UNDERSTAND = new QName(NS_SOAP11_ENV, "MustUnderstand", PREFIX_ENV); /** SOAP-1.1 elements */ static final Name SOAP11_ENVELOPE = new NameImpl("Envelope", PREFIX_ENV, NS_SOAP11_ENV); static final Name SOAP11_HEADER = new NameImpl("Header", PREFIX_ENV, NS_SOAP11_ENV); static final Name SOAP11_BODY = new NameImpl("Body", PREFIX_ENV, NS_SOAP11_ENV); static final Name SOAP11_FAULT = new NameImpl("Fault", PREFIX_ENV, NS_SOAP11_ENV); static final QName SOAP11_FAULTCODE = new QName("faultcode"); static final QName SOAP11_FAULTSTRING = new QName("faultstring"); static final QName SOAP11_FAULTACTOR = new QName("faultactor"); static final QName SOAP11_DETAIL = new QName("detail"); /** SOAP-1.2 attributes */ static final String SOAP12_ATTR_ROLE = "role"; static final String SOAP12_ATTR_RELAY = "relay"; /**SOAP-1.2 elements */ static final QName SOAP12_CODE = new QName(NS_SOAP12_ENV, "Code", PREFIX_ENV); static final QName SOAP12_VALUE = new QName(NS_SOAP12_ENV, "Value", PREFIX_ENV); static final QName SOAP12_SUBCODE = new QName(NS_SOAP12_ENV, "Subcode", PREFIX_ENV); static final QName SOAP12_REASON = new QName(NS_SOAP12_ENV, "Reason", PREFIX_ENV); static final QName SOAP12_TEXT = new QName(NS_SOAP12_ENV, "Text", PREFIX_ENV); static final QName SOAP12_ROLE = new QName(NS_SOAP12_ENV, "Role", PREFIX_ENV); static final QName SOAP12_NODE = new QName(NS_SOAP12_ENV, "Node", PREFIX_ENV); static final QName SOAP12_DETAIL = new QName(NS_SOAP12_ENV, "Detail", PREFIX_ENV); /** The default RPC return parameter name */ static final String DEFAULT_RPC_RETURN_NAME = "result"; // FIXME: According to JSR-181 this should be 'return' /** Standard Literal XML types */ static final QName TYPE_LITERAL_ANYSIMPLETYPE = new QName(NS_SCHEMA_XSD, "anySimpleType", PREFIX_XSD); static final QName TYPE_LITERAL_ANYTYPE = new QName(NS_SCHEMA_XSD, "anyType", PREFIX_XSD); static final QName TYPE_LITERAL_ANYURI = new QName(NS_SCHEMA_XSD, "anyURI", PREFIX_XSD); static final QName TYPE_LITERAL_BASE64BINARY = new QName(NS_SCHEMA_XSD, "base64Binary", PREFIX_XSD); static final QName TYPE_LITERAL_BOOLEAN = new QName(NS_SCHEMA_XSD, "boolean", PREFIX_XSD); static final QName TYPE_LITERAL_BYTE = new QName(NS_SCHEMA_XSD, "byte", PREFIX_XSD); static final QName TYPE_LITERAL_DATE = new QName(NS_SCHEMA_XSD, "date", PREFIX_XSD); static final QName TYPE_LITERAL_DATETIME = new QName(NS_SCHEMA_XSD, "dateTime", PREFIX_XSD); static final QName TYPE_LITERAL_DECIMAL = new QName(NS_SCHEMA_XSD, "decimal", PREFIX_XSD); static final QName TYPE_LITERAL_DOUBLE = new QName(NS_SCHEMA_XSD, "double", PREFIX_XSD); static final QName TYPE_LITERAL_DURATION = new QName(NS_SCHEMA_XSD, "duration", PREFIX_XSD); static final QName TYPE_LITERAL_FLOAT = new QName(NS_SCHEMA_XSD, "float", PREFIX_XSD); static final QName TYPE_LITERAL_GDAY = new QName(NS_SCHEMA_XSD, "gDay", PREFIX_XSD); static final QName TYPE_LITERAL_GMONTH = new QName(NS_SCHEMA_XSD, "gMonth", PREFIX_XSD); static final QName TYPE_LITERAL_GMONTHDAY = new QName(NS_SCHEMA_XSD, "gMonthDay", PREFIX_XSD); static final QName TYPE_LITERAL_GYEAR = new QName(NS_SCHEMA_XSD, "gYear", PREFIX_XSD); static final QName TYPE_LITERAL_GYEARMONTH = new QName(NS_SCHEMA_XSD, "gYearMonth", PREFIX_XSD); static final QName TYPE_LITERAL_HEXBINARY = new QName(NS_SCHEMA_XSD, "hexBinary", PREFIX_XSD); static final QName TYPE_LITERAL_ID = new QName(NS_SCHEMA_XSD, "ID", PREFIX_XSD); static final QName TYPE_LITERAL_INT = new QName(NS_SCHEMA_XSD, "int", PREFIX_XSD); static final QName TYPE_LITERAL_INTEGER = new QName(NS_SCHEMA_XSD, "integer", PREFIX_XSD); static final QName TYPE_LITERAL_LANGUAGE = new QName(NS_SCHEMA_XSD, "language", PREFIX_XSD); static final QName TYPE_LITERAL_LONG = new QName(NS_SCHEMA_XSD, "long", PREFIX_XSD); static final QName TYPE_LITERAL_NAME = new QName(NS_SCHEMA_XSD, "Name", PREFIX_XSD); static final QName TYPE_LITERAL_NCNAME = new QName(NS_SCHEMA_XSD, "NCName", PREFIX_XSD); static final QName TYPE_LITERAL_NEGATIVEINTEGER = new QName(NS_SCHEMA_XSD, "negativeInteger", PREFIX_XSD); static final QName TYPE_LITERAL_NMTOKEN = new QName(NS_SCHEMA_XSD, "NMTOKEN", PREFIX_XSD); static final QName TYPE_LITERAL_NMTOKENS = new QName(NS_SCHEMA_XSD, "NMTOKENS", PREFIX_XSD); static final QName TYPE_LITERAL_NONNEGATIVEINTEGER = new QName(NS_SCHEMA_XSD, "nonNegativeInteger", PREFIX_XSD); static final QName TYPE_LITERAL_NONPOSITIVEINTEGER = new QName(NS_SCHEMA_XSD, "nonPositiveInteger", PREFIX_XSD); static final QName TYPE_LITERAL_NORMALIZEDSTRING = new QName(NS_SCHEMA_XSD, "normalizedString", PREFIX_XSD); static final QName TYPE_LITERAL_POSITIVEINTEGER = new QName(NS_SCHEMA_XSD, "positiveInteger", PREFIX_XSD); static final QName TYPE_LITERAL_QNAME = new QName(NS_SCHEMA_XSD, "QName", PREFIX_XSD); static final QName TYPE_LITERAL_SHORT = new QName(NS_SCHEMA_XSD, "short", PREFIX_XSD); static final QName TYPE_LITERAL_STRING = new QName(NS_SCHEMA_XSD, "string", PREFIX_XSD); static final QName TYPE_LITERAL_TIME = new QName(NS_SCHEMA_XSD, "time", PREFIX_XSD); static final QName TYPE_LITERAL_TOKEN = new QName(NS_SCHEMA_XSD, "token", PREFIX_XSD); static final QName TYPE_LITERAL_UNSIGNEDBYTE = new QName(NS_SCHEMA_XSD, "unsignedByte", PREFIX_XSD); static final QName TYPE_LITERAL_UNSIGNEDINT = new QName(NS_SCHEMA_XSD, "unsignedInt", PREFIX_XSD); static final QName TYPE_LITERAL_UNSIGNEDLONG = new QName(NS_SCHEMA_XSD, "unsignedLong", PREFIX_XSD); static final QName TYPE_LITERAL_UNSIGNEDSHORT = new QName(NS_SCHEMA_XSD, "unsignedShort", PREFIX_XSD); /** Standard SOAP-1.1 encoded XML types */ static final QName TYPE_SOAP11_ANYSIMPLETYPE = new QName(URI_SOAP11_ENC, "anySimpleType", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_ANYTYPE = new QName(URI_SOAP11_ENC, "anyType", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_ANYURI = new QName(URI_SOAP11_ENC, "anyURI", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_BASE64 = new QName(URI_SOAP11_ENC, "base64", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_BASE64BINARY = new QName(URI_SOAP11_ENC, "base64Binary", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_BOOLEAN = new QName(URI_SOAP11_ENC, "boolean", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_BYTE = new QName(URI_SOAP11_ENC, "byte", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_DATE = new QName(URI_SOAP11_ENC, "date", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_DATETIME = new QName(URI_SOAP11_ENC, "dateTime", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_DECIMAL = new QName(URI_SOAP11_ENC, "decimal", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_DOUBLE = new QName(URI_SOAP11_ENC, "double", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_DURATION = new QName(URI_SOAP11_ENC, "duration", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_FLOAT = new QName(URI_SOAP11_ENC, "float", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_GDAY = new QName(URI_SOAP11_ENC, "gDay", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_GMONTH = new QName(URI_SOAP11_ENC, "gMonth", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_GMONTHDAY = new QName(URI_SOAP11_ENC, "gMonthDay", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_GYEAR = new QName(URI_SOAP11_ENC, "gYear", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_GYEARMONTH = new QName(URI_SOAP11_ENC, "gYearMonth", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_HEXBINARY = new QName(URI_SOAP11_ENC, "hexBinary", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_ID = new QName(URI_SOAP11_ENC, "ID", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_INT = new QName(URI_SOAP11_ENC, "int", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_INTEGER = new QName(URI_SOAP11_ENC, "integer", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_LANGUAGE = new QName(URI_SOAP11_ENC, "language", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_LONG = new QName(URI_SOAP11_ENC, "long", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_NAME = new QName(URI_SOAP11_ENC, "Name", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_NCNAME = new QName(URI_SOAP11_ENC, "NCName", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_NEGATIVEINTEGER = new QName(URI_SOAP11_ENC, "negativeInteger", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_NMTOKEN = new QName(URI_SOAP11_ENC, "NMTOKEN", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_NMTOKENS = new QName(URI_SOAP11_ENC, "NMTOKENS", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_NONNEGATIVEINTEGER = new QName(URI_SOAP11_ENC, "nonNegativeInteger", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_NONPOSITIVEINTEGER = new QName(URI_SOAP11_ENC, "nonPositiveInteger", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_NORMALIZEDSTRING = new QName(URI_SOAP11_ENC, "normalizedString", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_POSITIVEINTEGER = new QName(URI_SOAP11_ENC, "positiveInteger", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_QNAME = new QName(URI_SOAP11_ENC, "QName", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_SHORT = new QName(URI_SOAP11_ENC, "short", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_STRING = new QName(URI_SOAP11_ENC, "string", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_TIME = new QName(URI_SOAP11_ENC, "time", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_TOKEN = new QName(URI_SOAP11_ENC, "token", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_UNSIGNEDBYTE = new QName(URI_SOAP11_ENC, "unsignedByte", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_UNSIGNEDINT = new QName(URI_SOAP11_ENC, "unsignedInt", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_UNSIGNEDLONG = new QName(URI_SOAP11_ENC, "unsignedLong", PREFIX_SOAP11_ENC); static final QName TYPE_SOAP11_UNSIGNEDSHORT = new QName(URI_SOAP11_ENC, "unsignedShort", PREFIX_SOAP11_ENC); /** Encoded mime type namespace for internall and DII use */ static final String NS_ATTACHMENT_MIME_TYPE = "http://www.jboss.org/jbossws/attachment/mimetype"; /** Attachment Types */ static final QName TYPE_MIME_APPLICATION_XML = new QName(NS_ATTACHMENT_MIME_TYPE, "application_xml"); static final QName TYPE_MIME_IMAGE_JPEG = new QName(NS_ATTACHMENT_MIME_TYPE, "image_jpeg"); static final QName TYPE_MIME_IMAGE_GIF = new QName(NS_ATTACHMENT_MIME_TYPE, "image_gif"); static final QName TYPE_MIME_MULTIPART_MIXED = new QName(NS_ATTACHMENT_MIME_TYPE, "multipart_mixed"); static final QName TYPE_MIME_TEXT_PLAIN = new QName(NS_ATTACHMENT_MIME_TYPE, "text_plain"); static final QName TYPE_MIME_TEXT_XML = new QName(NS_ATTACHMENT_MIME_TYPE, "text_xml"); static final QName TYPE_XMIME_DEFAULT = new QName(NS_XML_MIME, "base64Binary"); /** For out of bound transport (i.e. in headers); http://www.w3.org/2004/08/wsdl/feature/AD/data */ static final String WSDL_PROPERTY_APPLICATION_DATA = "http://www.w3.org/2004/08/wsdl/feature/AD/data"; /** The key to the original message part name */ static final String WSDL_PROPERTY_MESSAGE_NAME = "http://www.jboss.org/jbossws/messagename"; /** Key to the inbound message name */ static final String WSDL_PROPERTY_MESSAGE_NAME_IN = "http://www.jboss.org/jbossws/messagename/in"; /** Key to the outbound message name */ static final String WSDL_PROPERTY_MESSAGE_NAME_OUT = "http://www.jboss.org/jbossws/messagename/out"; /** Key to the inboudn wsa action */ static final String WSDL_PROPERTY_ACTION_IN = "http://www.jboss.org/jbossws/wsa/actionIn"; /** Key to the outbound wsa action */ static final String WSDL_PROPERTY_ACTION_OUT = "http://www.jboss.org/jbossws/wsa/actionOut"; static final String WSDL_PROPERTY_EVENTSOURCE = "http://www.jboss.org/jbossws/wse/isEventSource"; static final String WSDL_ELEMENT_POLICY = "http://www.jboss.org/jbossws/wsp/policy"; static final String WSDL_PROPERTY_POLICYURIS = "http://www.jboss.org/jbossws/wsp/policyURIs"; static final String WSDL_ELEMENT_POLICYREFERENCE = "http://www.jboss.org/jbossws/wsp/policyReference"; /** The key to the original message part name */ static final String WSDL_PROPERTY_PART_NAME = "http://www.jboss.org/jbossws/partname"; /** The key to the message part type in case a part does not reference an element; http://www.jboss.org/jbossws/part/xmltype */ static final String WSDL_PROPERTY_PART_XMLTYPE = "http://www.jboss.org/jbossws/part/xmltype"; /** Used as WSDL 2.0 property string to provide support for WSDL 1.1 mime types */ static final String WSDL_PROPERTY_WSDL11_MIME_TYPE = NS_ATTACHMENT_MIME_TYPE; /** Indicate that the operation has zero arguments */ static final String WSDL_PROPERTY_ZERO_ARGS = "http://www.jboss.org/jbossws/zero-args"; /** Indicate that the operation has a void return*/ static final String WSDL_PROPERTY_VOID_RETURN = "http://www.jboss.org/jbossws/void-return"; /** Indicates that an output is a return parameter */ static final String WSDL_PROPERTY_RETURN_PART = "http://www.jboss.org/jbossws/return-part"; static final QName WSDL_ATTRIBUTE_WSA_ACTION = new QName(URI_WS_ADDRESSING, "Action"); static final QName WSDL_ATTRIBUTE_WSE_EVENTSOURCE = new QName(URI_WS_EVENTING, "EventSource"); static final QName WSDL_ATTRIBUTE_WSP_POLICYURIS = new QName(URI_WS_POLICY, "PolicyURIs"); static final QName WSDL_ELEMENT_WSP_POLICYREFERENCE = new QName(URI_WS_POLICY, "PolicyReference"); /** WSDL-2.0 exchange patterns */ static final String WSDL20_PATTERN_IN_ONLY = "http://www.w3.org/2004/08/wsdl/in-only"; static final String WSDL20_PATTERN_ROUST_IN_ONLY = "http://www.w3.org/2004/08/wsdl/robust-in-only"; static final String WSDL20_PATTERN_IN_OUT = "http://www.w3.org/2004/08/wsdl/in-out"; static final String WSDL20_PATTERN_IN_OPTIONAL_OUT = "http://www.w3.org/2004/08/wsdl/in-opt-out"; static final String WSDL20_PATTERN_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/out-only"; static final String WSDL20_PATTERN_ROBUST_OUT_ONLY = "http://www.w3.org/2004/08/wsdl/robust-out-only"; static final String WSDL20_PATTERN_OUT_IN = "http://www.w3.org/2004/08/wsdl/out-in"; static final String WSDL20_PATTERN_OUT_OPT_IN = "http://www.w3.org/2004/08/wsdl/out-opt-in"; static final String ASYNC_METHOD_SUFFIX = "Async"; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/annotation/0000755000175000017500000000000010755000270025714 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/annotation/security/0000755000175000017500000000000010755000270027563 5ustar godgod././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/annotation/security/SecurityDomain.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/org/jboss/annotation/security/SecurityDom0000644000175000017500000000350110565334563031772 0ustar godgod/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file 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.annotation.security; // $Id: SecurityDomain.java 2385 2007-02-16 14:02:27Z thomas.diesler@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for specifying the JBoss security domain for an EJB * * @author Bill Burke **/ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface SecurityDomain { /** * The required name for the security domain. * * Do not use the JNDI name * * Good: "MyDomain" * Bad: "java:/jaas/MyDomain" */ String value(); /** * The name for the unauthenticated pricipal */ String unauthenticatedPrincipal() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/0000755000175000017500000000000010755000272022746 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/0000755000175000017500000000000010755000271023545 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/0000755000175000017500000000000010755000270024506 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPHeaderElement.java0000755000175000017500000001100210675675441030556 0ustar godgod/* * 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 javax.xml.soap; /** An object representing the contents in the SOAP header part of the SOAP * envelope. The immediate children of a SOAPHeader object can be represented * only as SOAPHeaderElement objects. * * A SOAPHeaderElement object can have other SOAPElement objects as its children. * @author Scott.Stark@jboss.org * @version $Revision: 4612 $ */ public interface SOAPHeaderElement extends SOAPElement { /** Returns the uri of the actor associated with this SOAPHeaderElement object. * * @return a String giving the URI of the actor */ public String getActor(); /** Returns whether the mustUnderstand attribute for this SOAPHeaderElement object is turned on. * * @return true if the mustUnderstand attribute of this SOAPHeaderElement object is turned on; false otherwise */ public boolean getMustUnderstand(); /** * Returns the boolean value of the relay attribute for this SOAPHeaderElement * @return true if the relay attribute is turned on; false otherwise * @throws UnsupportedOperationException - if this message does not support the SOAP 1.2 concept of Relay attribute. * @since SAAJ 1.3 */ public boolean getRelay(); /** * Sets the relay attribute for this SOAPHeaderElement to be either true or false. * * The SOAP relay attribute is set to true to indicate that the SOAP header block must be relayed by any node that is * targeted by the header block but not actually process it. This attribute is ignored on header blocks whose mustUnderstand * attribute is set to true or that are targeted at the ultimate reciever (which is the default). * The default value of this attribute is false. * @param relay the new value of the relay attribute * @throws SOAPException if there is a problem in setting the relay attribute. * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Relay attribute. * @since SAAJ 1.3 */ public void setRelay(boolean relay) throws SOAPException; /** * Returns the value of the Role attribute of this SOAPHeaderElement. * @return a String giving the URI of the Role * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Role. * @since SAAJ 1.3 */ public String getRole(); /** * Sets the Role associated with this SOAPHeaderElement object to the specified Role. * * @param roleURI the URI of the Role * @throws SOAPException if there is an error in setting the role * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Role * @since SAAJ 1.3 */ public void setRole(String roleURI) throws SOAPException; /** Sets the actor associated with this SOAPHeaderElement object to the specified actor. * The default value of an actor is: SOAPConstants.URI_SOAP_ACTOR_NEXT * * @param actorURI a String giving the URI of the actor to set */ public void setActor(String actorURI); /** Sets the mustUnderstand attribute for this SOAPHeaderElement object to be on or off. * * If the mustUnderstand attribute is on, the actor who receives the SOAPHeaderElement must process it correctly. * This ensures, for example, that if the SOAPHeaderElement object modifies the message, * that the message is being modified correctly. * * @param mustUnderstand true to set the mustUnderstand attribute on; false to turn if off */ public void setMustUnderstand(boolean mustUnderstand); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/MessageFactory.java0000755000175000017500000001552610673747600030317 0ustar godgod/* * 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 javax.xml.soap; import java.io.IOException; import java.io.InputStream; /** A factory for creating SOAPMessage objects. A SAAJ client can create a MessageFactory object using the method newInstance, as shown in the following lines of code. MessageFactory mf = MessageFactory.newInstance(); MessageFactory mf12 = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); All MessageFactory objects, regardless of how they are created, will produce SOAPMessage objects that have the following elements by default: * A SOAPPart object * A SOAPEnvelope object * A SOAPBody object * A SOAPHeader object In some cases, specialized MessageFactory objects may be obtained that produce messages prepopulated with additional entries in the SOAPHeader object and the SOAPBody object. The content of a new SOAPMessage object depends on which of the two MessageFactory methods is used to create it. * createMessage() This is the method clients would normally use to create a request message. * createMessage(MimeHeaders, java.io.InputStream) -- message has content from the InputStream object and headers from the MimeHeaders object This method can be used internally by a service implementation to create a message that is a response to a request. * * @author Scott.Stark@jboss.org * @version $Revision: 4583 $ */ public abstract class MessageFactory { /** * Creates a new MessageFactory object that is an instance of the default implementation (SOAP 1.1), * This method uses the following ordered lookup procedure to determine the MessageFactory implementation class to load: * * Use the javax.xml.soap.MessageFactory system property. * Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. * Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.soap.MessageFactory in jars available to the runtime. * Use the SAAJMetaFactory instance to locate the MessageFactory implementation class. * @throws SOAPException if there was an error in creating the default implementation of the MessageFactory. */ public static MessageFactory newInstance() throws SOAPException { MessageFactory factory = null; try { String propertyName = "javax.xml.soap.MessageFactory"; factory = (MessageFactory)SAAJFactoryLoader.loadFactory(propertyName, null); } catch (RuntimeException rte) { throw new SOAPException(rte); } // Use the SAAJMetaFactory instance to locate the MessageFactory implementation class. if (factory == null) { SAAJMetaFactory saajFactory = SAAJMetaFactory.getInstance(); factory = saajFactory.newMessageFactory(SOAPConstants.DEFAULT_SOAP_PROTOCOL); } if (factory == null) throw new SOAPException("Failed to to determine the MessageFactory implementation class"); return factory; } /** * Creates a new MessageFactory object that is an instance of the specified implementation. * May be a dynamic message factory, a SOAP 1.1 message factory, or a SOAP 1.2 message factory. * A dynamic message factory creates messages based on the MIME headers specified as arguments to the createMessage method. * This method uses the SAAJMetaFactory to locate the implementation class and create the MessageFactory instance. * * @param protocol a string constant representing the class of the specified message factory implementation. * May be either DYNAMIC_SOAP_PROTOCOL, DEFAULT_SOAP_PROTOCOL (which is the same as) SOAP_1_1_PROTOCOL, or SOAP_1_2_PROTOCOL. * @throws SOAPException if there was an error in creating the specified implementation of MessageFactory. * @since SAAJ 1.3 */ public static MessageFactory newInstance(String protocol) throws SOAPException { SAAJMetaFactory saajFactory = SAAJMetaFactory.getInstance(); MessageFactory factory = saajFactory.newMessageFactory(protocol); if (factory == null) throw new SOAPException("Failed to to determine the MessageFactory implementation class"); return factory; } /** * Creates a new SOAPMessage object with the default SOAPPart, SOAPEnvelope, SOAPBody, and SOAPHeader objects. * Profile-specific message factories can choose to prepopulate the SOAPMessage object with profile-specific headers. * * Content can be added to this message's SOAPPart object, and the message can be sent "as is" when a message * containing only a SOAP part is sufficient. Otherwise, the SOAPMessage object needs to create one or more * AttachmentPart objects and add them to itself. Any content that is not in XML format must be in an AttachmentPart object. * * @return a new SOAPMessage object * @throws SOAPException if a SOAP error occurs */ public abstract SOAPMessage createMessage() throws SOAPException; /** * Internalizes the contents of the given InputStream object into a new SOAPMessage object and returns the SOAPMessage object. * * @param headers the transport-specific headers passed to the message in a transport-independent fashion for creation of the message * @param in the InputStream object that contains the data for a message * @return a new SOAPMessage object containing the data from the given InputStream object * @throws IOException if there is a problem in reading data from the input stream * @throws SOAPException if the message is invalid */ public abstract SOAPMessage createMessage(MimeHeaders headers, InputStream in) throws IOException, SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPConstants.java0000755000175000017500000001112610630511747030024 0ustar godgod/* * 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 javax.xml.soap; import javax.xml.namespace.QName; /** The definition of constants pertaining to the SOAP protocol. * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org * @version $Revision: 3400 $ */ public interface SOAPConstants { /** Used to create MessageFactory instances that create SOAPMessages whose behavior supports the SOAP 1.1 specification */ String SOAP_1_1_PROTOCOL = "SOAP 1.1 Protocol"; /** The media type of the Content-Type MIME header in SOAP 1.2. */ String SOAP_1_2_CONTENT_TYPE = "application/soap+xml"; /** The default protocol: SOAP 1.1 for backwards compatibility. */ String DEFAULT_SOAP_PROTOCOL = SOAP_1_1_PROTOCOL; /** Used to create MessageFactory instances that create SOAPMessages whose concrete type is based on the Content-Type MIME header passed to the createMessage method. */ String DYNAMIC_SOAP_PROTOCOL = "Dynamic Protocol"; /** The media type of the Content-Type MIME header in SOAP 1.1. */ String SOAP_1_1_CONTENT_TYPE = "text/xml"; /** Used to create MessageFactory instances that create SOAPMessages whose behavior supports the SOAP 1.2 specification */ String SOAP_1_2_PROTOCOL = "SOAP 1.2 Protocol"; /** The default namespace prefix for http://www.w3.org/2003/05/soap-envelope */ String SOAP_ENV_PREFIX = "env"; /** The namespace identifier for the SOAP 1.1 envelope. */ String URI_NS_SOAP_1_1_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/"; /** The namespace identifier for the SOAP 1.2 encoding. */ String URI_NS_SOAP_1_2_ENCODING = "http://www.w3.org/2003/05/soap-encoding"; /** The namespace identifier for the SOAP 1.2 envelope. */ String URI_NS_SOAP_1_2_ENVELOPE = "http://www.w3.org/2003/05/soap-envelope"; /** The namespace identifier for the SOAP 1.1 encoding. */ String URI_NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; /** The namespace identifier for the SOAP 1.1 envelope, All SOAPElements in this namespace are defined by the SOAP 1.1 specification. */ String URI_NS_SOAP_ENVELOPE = URI_NS_SOAP_1_1_ENVELOPE; /** The URI identifying the next application processing a SOAP request as the intended role for a SOAP 1.2 header entry (see section 2.2 of part 1 of the SOAP 1.2 specification). */ String URI_SOAP_1_2_ROLE_NEXT = "http://www.w3.org/2003/05/soap-envelope/role/next"; /** The URI specifying the role None in SOAP 1.2. */ String URI_SOAP_1_2_ROLE_NONE = "http://www.w3.org/2003/05/soap-envelope/role/none"; /** The URI identifying the ultimate receiver of the SOAP 1.2 message. */ String URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER = "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"; /** The URI identifying the next application processing a SOAP request as the intended actor for a SOAP 1.1 header entry (see section 4.2.2 of the SOAP 1.1 specification). */ String URI_SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next"; /** SOAP 1.2 VersionMismatch Fault */ QName SOAP_VERSIONMISMATCH_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "VersionMismatch", SOAP_ENV_PREFIX); /** SOAP 1.2 MustUnderstand Fault */ QName SOAP_MUSTUNDERSTAND_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "MustUnderstand", SOAP_ENV_PREFIX); /** SOAP 1.2 DataEncodingUnknown Fault */ QName SOAP_DATAENCODINGUNKNOWN_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "DataEncodingUnknown", SOAP_ENV_PREFIX); /** SOAP 1.2 Sender Fault */ QName SOAP_SENDER_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "Sender", SOAP_ENV_PREFIX); /** SOAP 1.2 Receiver Fault */ QName SOAP_RECEIVER_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "Receiver", SOAP_ENV_PREFIX); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/MimeHeader.java0000755000175000017500000000356410613047074027372 0ustar godgod/* * 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 javax.xml.soap; /** An object that stores a MIME header name and its value. One or more * MimeHeader objects may be contained in a MimeHeaders object. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public class MimeHeader { private String name; private String value; public MimeHeader(String name, String value) { this.name = name; this.value = value; } public String getName() { return name; } public String getValue() { return value; } public int hashCode() { return toString().hashCode(); } public boolean equals(Object obj) { if (!(obj instanceof MimeHeader)) return false; MimeHeader other = (MimeHeader)obj; return toString().equals(other.toString()); } public String toString() { return "[" + name + "=" + value + "]"; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPEnvelope.java0000755000175000017500000001044410613047074027625 0ustar godgod/* * 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 javax.xml.soap; /** The container for the SOAPHeader and SOAPBody portions of a SOAPPart object. * By default, a SOAPMessage object is created with a SOAPPart object that has a SOAPEnvelope object. * The SOAPEnvelope object by default has an empty SOAPBody object and an empty SOAPHeader object.

      * The SOAPBody object is required, and the SOAPHeader object, though optional, * is used in the majority of cases. If the SOAPHeader object is not needed, it can be deleted, which is shown later.

      * A client can access the SOAPHeader and SOAPBody objects by calling the methods SOAPEnvelope.getHeader and SOAPEnvelope.getBody. * The following lines of code use these two methods after starting with the SOAPMessage object message to get the SOAPPart object * sp, which is then used to get the SOAPEnvelope object se.

      * * * SOAPPart sp = message.getSOAPPart();
      * SOAPEnvelope se = sp.getEnvelope();
      * SOAPHeader sh = se.getHeader();
      * SOAPBody sb = se.getBody();
      *
      *

      * It is possible to change the body or header of a SOAPEnvelope object by retrieving the current one, * deleting it, and then adding a new body or header. * The javax.xml.soap.Node method deleteNode deletes the XML element (node) on which it is called. * For example, the following line of code deletes the SOAPBody object that is retrieved by the method getBody. *

      * se.getBody().detachNode(); *

      * To create a SOAPHeader object to replace the one that was removed, * a client uses the method SOAPEnvelope.addHeader, which creates a new header and adds it to the SOAPEnvelope object. * Similarly, the method addBody creates a new SOAPBody object and adds it to the SOAPEnvelope object. * The following code fragment retrieves the current header, removes it, and adds a new one. * Then it retrieves the current body, removes it, and adds a new one. *

      * * SOAPPart sp = message.getSOAPPart();
      * SOAPEnvelope se = sp.getEnvelope();
      * se.getHeader().detachNode();
      * SOAPHeader sh = se.addHeader();
      * se.getBody().detachNode();
      * SOAPBody sb = se.addBody();
      *
      *

      * It is an error to add a SOAPBody or SOAPHeader object if one already exists. * The SOAPEnvelope interface provides three methods for creating Name objects. * One method creates Name objects with a local name, a namespace prefix, and a namesapce URI. * The second method creates Name objects with a local name and a namespace prefix, * and the third creates Name objects with just a local name. *

      * The following line of code, in which se is a SOAPEnvelope object, creates a new Name object with all three. * * Name name = se.createName("GetLastTradePrice", "WOMBAT", "http://www.wombat.org/trader"); * * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface SOAPEnvelope extends SOAPElement { public abstract SOAPBody addBody() throws SOAPException; public abstract SOAPHeader addHeader() throws SOAPException; public abstract Name createName(String localName) throws SOAPException; public abstract Name createName(String localName, String prefix, String uri) throws SOAPException; public abstract SOAPBody getBody() throws SOAPException; public abstract SOAPHeader getHeader() throws SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/Detail.java0000755000175000017500000000643010613047074026567 0ustar godgod/* * 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 javax.xml.soap; import java.util.Iterator; import javax.xml.namespace.QName; /** A container for DetailEntry objects. DetailEntry objects give detailed error information that is application-specific and related to the SOAPBody object that contains it. A Detail object, which is part of a SOAPFault object, can be retrieved using the method SOAPFault.getDetail. The Detail interface provides two methods. One creates a new DetailEntry object and also automatically adds it to the Detail object. The second method gets a list of the DetailEntry objects contained in a Detail object. The following code fragment, in which sf is a SOAPFault object, gets its Detail object (d), adds a new DetailEntry object to d, and then gets a list of all the DetailEntry objects in d. The code also creates a Name object to pass to the method addDetailEntry. The variable se, used to create the Name object, is a SOAPEnvelope object. Detail d = sf.getDetail(); Name name = se.createName(“GetLastTradePrice”, “WOMBAT”, “http://www.wombat.org/trader”); d.addDetailEntry(name); Iterator it = d.getDetailEntries(); * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface Detail extends SOAPFaultElement { /** * Creates a new DetailEntry object with the given name and adds it to this Detail object. * @param name a Name object identifying the new DetailEntry object * @throws SOAPException thrown when there is a problem in adding a DetailEntry object to this Detail object. */ public DetailEntry addDetailEntry(Name name) throws SOAPException; /** * Creates a new DetailEntry object with the given QName and adds it to this Detail object. * This method is the preferred over the one using Name. * * @param qname a QName object identifying the new DetailEntry object * @throws SOAPException thrown when there is a problem in adding a DetailEntry object to this Detail object. * @since SAAJ 1.3 */ public DetailEntry addDetailEntry(QName qname) throws SOAPException; /** * Gets an Iterator over all of the DetailEntrys in this Detail object. * @return an Iterator object over the DetailEntry objects in this Detail object */ public Iterator getDetailEntries(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPMessage.java0000755000175000017500000003641710613047074027444 0ustar godgod/* * 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 javax.xml.soap; import java.io.IOException; import java.io.OutputStream; import java.util.HashMap; import java.util.Iterator; import javax.activation.DataHandler; /** The root class for all SOAP messages. As transmitted on the "wire", a SOAP message is an XML document or a * MIME message whose first body part is an XML/SOAP document. * * A SOAPMessage object consists of a SOAP part and optionally one or more attachment parts. * The SOAP part for a SOAPMessage object is a SOAPPart object, which contains information used for message routing and * identification, and which can contain application-specific content. All data in the SOAP Part of a message must be in XML format. * * A new SOAPMessage object contains the following by default: * * A SOAPPart object * A SOAPEnvelope object * A SOAPBody object * A SOAPHeader object * * The SOAP part of a message can be retrieved by calling the method SOAPMessage.getSOAPPart(). * The SOAPEnvelope object is retrieved from the SOAPPart object, and the SOAPEnvelope object is used to retrieve the * SOAPBody and SOAPHeader objects. * * SOAPPart sp = message.getSOAPPart(); * SOAPEnvelope se = sp.getEnvelope(); * SOAPBody sb = se.getBody(); * SOAPHeader sh = se.getHeader(); * * In addition to the mandatory SOAPPart object, a SOAPMessage object may contain zero or more AttachmentPart objects, * each of which contains application-specific data. The SOAPMessage interface provides methods for creating AttachmentPart * objects and also for adding them to a SOAPMessage object. A party that has received a SOAPMessage object can examine * its contents by retrieving individual attachment parts. * * Unlike the rest of a SOAP message, an attachment is not required to be in XML format and can therefore be anything from * simple text to an image file. Consequently, any message content that is not in XML format must be in an AttachmentPart object. * * A MessageFactory object may create SOAPMessage objects with behavior that is specialized to a particular * implementation or application of SAAJ. For instance, a MessageFactory object may produce SOAPMessage objects that * conform to a particular Profile such as ebXML. In this case a MessageFactory object might produce SOAPMessage * objects that are initialized with ebXML headers. * * In order to ensure backward source compatibility, methods that are added to this class after version 1.1 of the SAAJ * specification are all concrete instead of abstract and they all have default implementations. * Unless otherwise noted in the JavaDocs for those methods the default implementations simply throw an * UnsupportedOperationException and the SAAJ implementation code must override them with methods that provide * the specified behavior. Legacy client code does not have this restriction, however, so long as there is no claim * made that it conforms to some later version of the specification than it was originally written for. * A legacy class that extends the SOAPMessage class can be compiled and/or run against succeeding versions of * the SAAJ API without modification. If such a class was correctly implemented then it will continue to behave * correctly relative the the version of the specification against which it was written. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public abstract class SOAPMessage { private HashMap properties = new HashMap(); /** Specifies the character type encoding for the SOAP Message. Valid values include "utf-8" and "utf-16". The default is "utf-8". */ public static final String CHARACTER_SET_ENCODING = "javax.xml.soap.character-set-encoding"; /** Specifies whether the SOAP Message will contain an XML declaration when it is sent. The default is "false". */ public static final String WRITE_XML_DECLARATION = "javax.xml.soap.write-xml-declaration"; /** * Adds the given AttachmentPart object to this SOAPMessage object. * An AttachmentPart object must be created before it can be added to a message. * @param attachmentpart an AttachmentPart object that is to become part of this SOAPMessage object */ public abstract void addAttachmentPart(AttachmentPart attachmentpart); /** * Creates a new empty AttachmentPart object. Note that the method addAttachmentPart must be called with this new * AttachmentPart object as the parameter in order for it to become an attachment to this SOAPMessage object. * @return a new AttachmentPart object that can be populated and added to this SOAPMessage object */ public abstract AttachmentPart createAttachmentPart(); /** * Creates an AttachmentPart object and populates it using the given DataHandler object. * @param datahandler the javax.activation.DataHandler object that will generate the content for this SOAPMessage object * @return a new AttachmentPart object that contains data generated by the given DataHandler object */ public AttachmentPart createAttachmentPart(DataHandler datahandler) { AttachmentPart part = createAttachmentPart(); part.setDataHandler(datahandler); return part; } /** * Creates an AttachmentPart object and populates it with the specified data of the specified content type. * @param content an Object containing the content for this SOAPMessage object * @param contentType a String object giving the type of content; examples are "text/xml", "text/plain", and "image/jpeg" * @return a new AttachmentPart object that contains the given data */ public AttachmentPart createAttachmentPart(Object content, String contentType) { AttachmentPart part = createAttachmentPart(); part.setContent(content, contentType); return part; } /** * Retrieves value of the specified property. * @param property the name of the property to retrieve * @return the value associated with the named property or null if no such property exists. * @throws SOAPException if the property name is not recognized. */ public Object getProperty(String property) throws SOAPException { return properties.get(property); } /** * Associates the specified value with the specified property. If there was already a value associated with this * property, the old value is replaced. * * The valid property names include WRITE_XML_DECLARATION and CHARACTER_SET_ENCODING. * All of these standard SAAJ properties are prefixed by "javax.xml.soap". * Vendors may also add implementation specific properties. * These properties must be prefixed with package names that are unique to the vendor. * * Setting the property WRITE_XML_DECLARATION to "true" will cause an XML Declaration to be written out at the start * of the SOAP message. The default value of "false" suppresses this declaration. * * The property CHARACTER_SET_ENCODING defaults to the value "utf-8" which causes the SOAP message to be * encoded using UTF-8. Setting CHARACTER_SET_ENCODING to "utf-16" causes the SOAP message to be encoded using UTF-16. * * Some implementations may allow encodings in addition to UTF-8 and UTF-16. Refer to your vendor's documentation for details. * * @param property the property with which the specified value is to be associated. * @param value the value to be associated with the specified property * @throws SOAPException if the property name is not recognized */ public void setProperty(String property, Object value) throws SOAPException { properties.put(property, value); } /** * Gets the SOAP Body contained in this SOAPMessage object. * @return the SOAPBody object contained by this SOAPMessage object * @throws SOAPException if the SOAP Body does not exist or cannot be retrieved */ public SOAPBody getSOAPBody() throws SOAPException { SOAPPart soapPart = getSOAPPart(); if (soapPart != null) { SOAPEnvelope soapEnvelope = soapPart.getEnvelope(); if (soapEnvelope != null) { SOAPBody soapBody = soapEnvelope.getBody(); return soapBody; } } throw new SOAPException("Cannot obtain SOAPBody from SOAPMessage"); } /** * Gets the SOAP Header contained in this SOAPMessage object. * @return the SOAPHeader object contained by this SOAPMessage object * @throws SOAPException if the SOAP Header does not exist or cannot be retrieved */ public SOAPHeader getSOAPHeader() throws SOAPException { SOAPPart soapPart = getSOAPPart(); if (soapPart != null) { SOAPEnvelope soapEnvelope = soapPart.getEnvelope(); if (soapEnvelope != null) { SOAPHeader soapHeader = soapEnvelope.getHeader(); return soapHeader; } } throw new SOAPException("Cannot obtain SOAPHeader from SOAPMessage"); } /** * Retrieves a description of this SOAPMessage object's content. * @return a String describing the content of this message or null if no description has been set */ public abstract String getContentDescription(); /** * Sets the description of this SOAPMessage object's content with the given description. * @param description a String describing the content of this message */ public abstract void setContentDescription(String description); /** * Returns all the transport-specific MIME headers for this SOAPMessage object in a transport-independent fashion. * @return a MimeHeaders object containing the MimeHeader objects */ public abstract MimeHeaders getMimeHeaders(); /** * Gets the SOAP part of this SOAPMessage object. * * SOAPMessage object contains one or more attachments, the SOAP Part must be the first MIME body part in the message. * * @return the SOAPPart object for this SOAPMessage object */ public abstract SOAPPart getSOAPPart(); /** * Removes all AttachmentPart objects that have been added to this SOAPMessage object. * * This method does not touch the SOAP part. */ public abstract void removeAllAttachments(); /** * Removes all the AttachmentPart objects that have header entries that match the specified headers. * Note that the removed attachment could have headers in addition to those specified. * @param headers a MimeHeaders object containing the MIME headers for which to search * @since SAAJ 1.3 */ public abstract void removeAttachments(MimeHeaders headers); /** * Gets a count of the number of attachments in this message. This count does not include the SOAP part. * @return the number of AttachmentPart objects that are part of this SOAPMessage object */ public abstract int countAttachments(); /** * Retrieves all the AttachmentPart objects that are part of this SOAPMessage object. * @return an iterator over all the attachments in this message */ public abstract Iterator getAttachments(); /** * Returns an AttachmentPart object that is associated with an attachment that is referenced by this SOAPElement or null * if no such attachment exists. References can be made via an href attribute as described in SOAP Messages with Attachments, * or via a single Text child node containing a URI as described in the WS-I Attachments Profile 1.0 for elements of * schema type ref:swaRef(ref:swaRef). These two mechanisms must be supported. * The support for references via href attribute also implies that this method should also be supported on an element that * is an xop:Include element ( XOP). other reference mechanisms may be supported by individual implementations of this standard. * Contact your vendor for details. * @param element The SOAPElement containing the reference to an Attachment * @return the referenced AttachmentPart or null if no such AttachmentPart exists or no reference can be found in this SOAPElement. * @throws SOAPException if there is an error in the attempt to access the attachment * @since SAAJ 1.3 */ public abstract AttachmentPart getAttachment(SOAPElement element) throws SOAPException; /** * Retrieves all the AttachmentPart objects that have header entries that match the specified headers. * Note that a returned attachment could have headers in addition to those specified. * @param mimeheaders a MimeHeaders object containing the MIME headers for which to search * @return an iterator over all attachments that have a header that matches one of the given headers */ public abstract Iterator getAttachments(MimeHeaders mimeheaders); /** * Updates this SOAPMessage object with all the changes that have been made to it. * This method is called automatically when writeTo(OutputStream) is called. * However, if changes are made to a message that was received or to one that has already been sent, the method * saveChanges needs to be called explicitly in order to save the changes. * The method saveChanges also generates any changes that can be read back (for example, * a MessageId in profiles that support a message id). All MIME headers in a message that is created for sending * purposes are guaranteed to have valid values only after saveChanges has been called. * * In addition, this method marks the point at which the data from all constituent AttachmentPart objects are pulled into the message. * * @throws SOAPException if there was a problem saving changes to this message. */ public abstract void saveChanges() throws SOAPException; /** * Indicates whether this SOAPMessage object needs to have the method saveChanges called on it. * @return true if saveChanges needs to be called; false otherwise. */ public abstract boolean saveRequired(); /** * Writes this SOAPMessage object to the given output stream. The externalization format is as defined by the * SOAP 1.1 with Attachments specification. * * If there are no attachments, just an XML stream is written out. For those messages that have attachments, * writeTo writes a MIME-encoded byte stream. * * @param outputstream the OutputStream object to which this SOAPMessage object will be written * @throws SOAPException if there was a problem in externalizing this SOAP message * @throws IOException if an I/O error occurs */ public abstract void writeTo(OutputStream outputstream) throws SOAPException, IOException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPElementFactory.java0000755000175000017500000000550610613047074030774 0ustar godgod/* * 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 javax.xml.soap; /** SOAPElementFactory is a factory for XML fragments that will eventually end * up in the SOAP part. These fragments can be inserted as children of the * SOAPHeader or SOAPBody or SOAPEnvelope. * * Elements created using this factory do not have the properties of an element * that lives inside a SOAP header document. These elements are copied into the * XML document tree when they are inserted. * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public class SOAPElementFactory { private SOAPFactory soapFactory; /** * * @return * @throws SOAPException */ public static SOAPElementFactory newInstance() throws SOAPException { SOAPFactory factory = SOAPFactory.newInstance(); return new SOAPElementFactory(factory); } /** * @deprecated Use javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name) * @return * @throws SOAPException */ public SOAPElement create(String localName) throws SOAPException { return soapFactory.createElement(localName); } /** * @deprecated Use javax.xml.soap.SOAPFactory.createElement(String localName, String prefix, String uri) instead * @param localName * @param prefix * @param uri * @return * @throws SOAPException */ public SOAPElement create(String localName, String prefix, String uri) throws SOAPException { return soapFactory.createElement(localName, prefix, uri); } /** * @deprecated Use javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name) * @param name * @return * @throws SOAPException */ public SOAPElement create(Name name) throws SOAPException { return soapFactory.createElement(name); } private SOAPElementFactory(SOAPFactory soapFactory) { this.soapFactory = soapFactory; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPConnectionFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPConnectionFactory.java0000755000175000017500000001033010634204450031465 0ustar godgod/* * 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 javax.xml.soap; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.logging.Logger; /** A factory for creating SOAPConnection objects. Implementation of this class * is optional. If SOAPConnectionFactory.newInstance() throws an * UnsupportedOperationException then the implementation does not support the * SAAJ communication infrastructure. Otherwise SOAPConnection objects can be * created by calling createConnection() on the newly created * SOAPConnectionFactory object. * * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org * @version $Revision: 3576 $ */ public abstract class SOAPConnectionFactory { // provide logging private static Logger log = Logger.getLogger(SOAPConnectionFactory.class.getName()); private static final String DEFAULT_SOAP_CONNECTION_FACTORY = "org.jboss.ws.core.soap.SOAPConnectionFactoryImpl"; private static final String[] alternativeFactories = new String[] { "org.jboss.webservice.soap.SOAPConnectionFactoryImpl", "org.jboss.axis.soap.SOAPConnectionFactoryImpl" }; /** Creates an instance of the default SOAPConnectionFactory object. * * @return * @throws SOAPException * @throws UnsupportedOperationException */ public static SOAPConnectionFactory newInstance() throws SOAPException, UnsupportedOperationException { PrivilegedAction action = new PropertyAccessAction(SOAPConnectionFactory.class.getName(), DEFAULT_SOAP_CONNECTION_FACTORY); String factoryName = (String)AccessController.doPrivileged(action); ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { try { Class factoryClass = loader.loadClass(factoryName); return (SOAPConnectionFactory)factoryClass.newInstance(); } catch (ClassNotFoundException e) { // Throw the exception if the user asked for a specific factory if (factoryName.equals(DEFAULT_SOAP_CONNECTION_FACTORY) == false) throw e; for (int i = 0; i < alternativeFactories.length; i++) { factoryName = alternativeFactories[i]; try { Class factoryClass = loader.loadClass(factoryName); return (SOAPConnectionFactory)factoryClass.newInstance(); } catch (ClassNotFoundException e1) { log.severe("Cannot load factory: " + factoryName); } } } } catch (Throwable t) { throw new SOAPException("Failed to create SOAPConnectionFactory: " + factoryName, t); } throw new SOAPException("Cannot find SOAPConnectionFactory implementation"); } public abstract SOAPConnection createConnection() throws SOAPException; private static class PropertyAccessAction implements PrivilegedAction { private String name; private String defaultValue; PropertyAccessAction(String name, String defaultValue) { this.name = name; this.defaultValue = defaultValue; } public Object run() { return System.getProperty(name, defaultValue); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPFaultElement.java0000755000175000017500000000252710613047074030440 0ustar godgod/* * 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 javax.xml.soap; /** A representation of the contents in a SOAPFault object. The Detail * interface is a SOAPFaultElement. * * Content is added to a SOAPFaultElement using the SOAPElement method * addTextNode. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface SOAPFaultElement extends SOAPElement { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPHeader.java0000755000175000017500000002036710613047074027245 0ustar godgod/* * 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 javax.xml.soap; import java.util.Iterator; import javax.xml.namespace.QName; /** * A representation of the SOAP header element. A SOAP header element consists * of XML data that affects the way the application-specific content is * processed by the message provider. For example, transaction semantics, * authentication information, and so on, can be specified as the content of a * SOAPHeader object. * * A SOAPEnvelope object contains an empty SOAPHeader object by default. If the * SOAPHeader object, which is optional, is not needed, it can be retrieved and * deleted with the following line of code. The variable se is a SOAPEnvelope * object. * * se.getHeader().detachNode(); * * A SOAPHeader object is created with the SOAPEnvelope method addHeader. * This method, which creates a new header and adds it to the envelope, may be * called only after the existing header has been removed. * * se.getHeader().detachNode(); * SOAPHeader sh = se.addHeader(); * * A SOAPHeader object can have only SOAPHeaderElement objects as its * immediate children. The method addHeaderElement creates a new HeaderElement * object and adds it to the SOAPHeader object. In the following line of code, * the argument to the method addHeaderElement is a Name object that is the * name for the new HeaderElement object. * * SOAPHeaderElement shElement = sh.addHeaderElement(name); * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface SOAPHeader extends SOAPElement { /** * Creates a new SOAPHeaderElement object initialized with the specified name and adds it to this SOAPHeader object. * * @param name a Name object with the name of the new SOAPHeaderElement object * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object * @throws SOAPException if a SOAP error occurs */ public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException; /** * Creates a new SOAPHeaderElement object initialized with the specified qname and adds it to this SOAPHeader object. * @param qname a QName object with the qname of the new SOAPHeaderElement object * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object * @throws SOAPException if a SOAP error occurs * @since SAAJ 1.3 */ public SOAPHeaderElement addHeaderElement(QName qname) throws SOAPException; /** * Creates a new NotUnderstood SOAPHeaderElement object initialized with the specified name and adds it to this SOAPHeader object. * This operation is supported only by SOAP 1.2. * * @param qname a QName object with the name of the SOAPHeaderElement object that was not understood. * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object * @throws SOAPException if a SOAP error occurs. * @throws UnsupportedOperationException if this is a SOAP 1.1 Header. * @since SAAJ 1.3 */ public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws SOAPException; /** * Creates a new Upgrade SOAPHeaderElement object initialized with the specified List of supported SOAP URIs * and adds it to this SOAPHeader object. This operation is supported on both SOAP 1.1 and SOAP 1.2 header. * * @param soapURIs an Iterator object with the URIs of SOAP versions supported. * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object * @throws SOAPException if a SOAP error occurs. * @since SAAJ 1.3 */ public SOAPHeaderElement addUpgradeHeaderElement(Iterator soapURIs) throws SOAPException; /** * Creates a new Upgrade SOAPHeaderElement object initialized with the specified array of supported SOAP URIs * and adds it to this SOAPHeader object. This operation is supported on both SOAP 1.1 and SOAP 1.2 header. * * @param soapURIs an array of the URIs of SOAP versions supported. * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object * @throws SOAPException if a SOAP error occurs. * @since SAAJ 1.3 */ public SOAPHeaderElement addUpgradeHeaderElement(String[] soapURIs) throws SOAPException; /** * Creates a new Upgrade SOAPHeaderElement object initialized with the specified supported SOAP URI and adds it to this SOAPHeader object. * This operation is supported on both SOAP 1.1 and SOAP 1.2 header. * * @param soapURI the URI of SOAP the version that is supported. * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object * @throws SOAPException if a SOAP error occurs. * @since SAAJ 1.3 */ public SOAPHeaderElement addUpgradeHeaderElement(String soapURI) throws SOAPException; /** * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object. * * @return an Iterator object over all the SOAPHeaderElement objects contained by this SOAPHeader */ public Iterator examineAllHeaderElements(); /** * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified actor. * An actor is a global attribute that indicates the intermediate parties that should process a message before it * reaches its ultimate receiver. An actor receives the message and processes it before sending it on to the next actor. * The default actor is the ultimate intended recipient for the message, so if no actor attribute is included in a * SOAPHeader object, it is sent to the ultimate receiver along with the message body. * * @param actor a String giving the URI of the actor for which to search * @return an Iterator object over all the SOAPHeaderElement objects that contain the specified actor and are marked as MustUnderstand */ public Iterator examineHeaderElements(String actor); /** * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified * actor and that have a MustUnderstand attribute whose value is equivalent to true. * * @param actor a String giving the URI of the actor for which to search * @return an Iterator object over all the SOAPHeaderElement objects that contain the specified actor and are marked as MustUnderstand */ public Iterator examineMustUnderstandHeaderElements(String actor); /** * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object and detaches * them from this SOAPHeader object. * * @return an Iterator object over all the SOAPHeaderElement objects contained by this SOAPHeader */ public Iterator extractAllHeaderElements(); /** * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified actor * and detaches them from this SOAPHeader object. * * This method allows an actor to process the parts of the SOAPHeader object that apply to it and to remove them * before passing the message on to the next actor. * * @param actor a String giving the URI of the actor for which to search * @return an Iterator object over all the SOAPHeaderElement objects that contain the specified actor and are marked as MustUnderstand */ public Iterator extractHeaderElements(String actor); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SAAJMetaFactory.java0000644000175000017500000001050110673747600030241 0ustar godgod/* * 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 javax.xml.soap; // $Id: SAAJMetaFactory.java 4583 2007-09-18 13:15:44Z thomas.diesler@jboss.com $ /** * The access point for the implementation classes of the factories defined in the SAAJ API. * All of the newInstance methods defined on factories in SAAJ 1.3 defer to instances of this class to do the actual object creation. * The implementations of newInstance() methods (in SOAPFactory and MessageFactory) that existed in SAAJ 1.2 * have been updated to also delegate to the SAAJMetaFactory when the SAAJ 1.2 defined lookup fails to locate the Factory implementation class name. * * SAAJMetaFactory is a service provider interface. There are no public methods on this class. * * @since SAAJ 1.3 */ public abstract class SAAJMetaFactory { protected SAAJMetaFactory() { } /** * Creates a new instance of a concrete SAAJMetaFactory object. The SAAJMetaFactory is an SPI, * it pulls the creation of the other factories together into a single place. Changing out the SAAJMetaFactory * has the effect of changing out the entire SAAJ implementation. Service providers provide the name of their SAAJMetaFactory * implementation. This method uses the following ordered lookup procedure to determine the SAAJMetaFactory implementation class to load: * * - Use the javax.xml.soap.MetaFactory system property. * - Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. * - Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.soap.MetaFactory in jars available to the runtime. * - Default to com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl. * * @return a concrete SAAJMetaFactory object * @throws SOAPException if there is an error in creating the SAAJMetaFactory */ static SAAJMetaFactory getInstance() throws SOAPException { String propertyName = "javax.xml.soap.MetaFactory"; String defaultImpl = "org.jboss.ws.core.soap.SAAJMetaFactoryImpl"; SAAJMetaFactory factory = (SAAJMetaFactory)SAAJFactoryLoader.loadFactory(propertyName, defaultImpl); if (factory == null) throw new SOAPException("Failed to to determine the implementation class for: " + propertyName); return factory; } /** * Creates a MessageFactory object for the given String protocol. * @param protocol a String indicating the protocol (SOAPConstants.SOAP_1_1_PROTOCOL, SOAPConstants.SOAP_1_2_PROTOCOL, SOAPConstants.DYNAMIC_SOAP_PROTOCOL) * @throws SOAPException if there is an error in creating the MessageFactory */ protected abstract MessageFactory newMessageFactory(String protocol) throws SOAPException; /** * Creates a SOAPFactory object for the given String protocol. * @param protocol a String indicating the protocol (SOAPConstants.SOAP_1_1_PROTOCOL, SOAPConstants.SOAP_1_2_PROTOCOL, SOAPConstants.DYNAMIC_SOAP_PROTOCOL) * @throws SOAPException if there is an error in creating the SOAPFactory */ protected abstract SOAPFactory newSOAPFactory(String protocol) throws SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPElement.java0000755000175000017500000003766310613047074027455 0ustar godgod/* * 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 javax.xml.soap; import java.util.Iterator; import javax.xml.namespace.QName; import org.w3c.dom.Element; /** An object representing an element of a SOAP message that is allowed but not * specifically prescribed by a SOAP specification. This interface serves as the * base interface for those objects that are specifically prescribed by a SOAP * specification. * * Methods in this interface that are required to return SAAJ specific objects * may "silently" replace nodes in the tree as required to successfully return * objects of the correct type. See getChildElements() and javax.xml.soap for * details. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface SOAPElement extends Node, Element { /** Adds an attribute with the specified name and value to this SOAPElement object. * * @param name a Name object with the name of the attribute * @param value a String giving the value of the attribute * @return the SOAPElement object into which the attribute was inserted * @throws SOAPException if there is an error in creating the Attribute */ SOAPElement addAttribute(Name name, String value) throws SOAPException; /** * Adds an attribute with the specified name and value to this SOAPElement object. * @param qname a QName object with the name of the attribute * @param value a String giving the value of the attribute * @return the SOAPElement object into which the attribute was inserted * @throws SOAPException if there is an error in creating the Attribute, or it is invalid to set an attribute with QName qname on this SOAPElement. * @since SAAJ 1.3 */ SOAPElement addAttribute(QName qname, String value) throws SOAPException; /** Creates a new SOAPElement object initialized with the specified local name and adds the new element to this SOAPElement object. * * @param name a String giving the local name for the element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object */ SOAPElement addChildElement(String name) throws SOAPException; /** * Creates a new SOAPElement object initialized with the given QName object and adds the new element to this SOAPElement object. * The namespace, localname and prefix of the new SOAPElement are all taken from the qname argument. * @param qname a QName object with the XML name for the new element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object * @since SAAJ 1.3 */ SOAPElement addChildElement(QName qname) throws SOAPException; /** Creates a new SOAPElement object initialized with the specified local name and prefix and adds the new element to this SOAPElement object. * * @param localName a String giving the local name for the new element * @param prefix a String giving the namespace prefix for the new element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object */ SOAPElement addChildElement(String localName, String prefix) throws SOAPException; /** Creates a new SOAPElement object initialized with the specified local name, prefix, and URI and adds the new element to this SOAPElement object. * * @param localName a String giving the local name for the new element * @param prefix a String giving the namespace prefix for the new element * @param uri a String giving the URI of the namespace to which the new element belongs * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object */ SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException; /** Creates a new SOAPElement object initialized with the given Name object and adds the new element to this SOAPElement object. * * @param name a Name object with the XML name for the new element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object */ SOAPElement addChildElement(Name name) throws SOAPException; /** Add a SOAPElement as a child of this SOAPElement instance. The SOAPElement is expected to be created by a SOAPElementFactory. * * Callers should not rely on the element instance being added as is into the XML tree. * Implementations could end up copying the content of the SOAPElement passed into an instance of a different SOAPElement * implementation. For instance if addChildElement() is called on a SOAPHeader, element will be copied into an instance of a SOAPHeaderElement. * * The fragment rooted in element is either added as a whole or not at all, if there was an error. * * The fragment rooted in element cannot contain elements named "Envelope", "Header" or "Body" and in the SOAP namespace. * Any namespace prefixes present in the fragment should be fully resolved using appropriate namespace declarations within the fragment itself. * * @param child the SOAPElement to be added as a new child * @return an instance representing the new SOAP element that was actually added to the tree. * @throws SOAPException if there was an error in adding this element as a child */ SOAPElement addChildElement(SOAPElement child) throws SOAPException; /** Adds a namespace declaration with the specified prefix and URI to this SOAPElement object. * * @param prefix a String giving the prefix of the namespace * @param uri a String giving the uri of the namespace * @return the SOAPElement object into which this namespace declaration was inserted. * @throws SOAPException if there is an error in creating the namespace */ SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException; /** Creates a new Text object initialized with the given String and adds it to this SOAPElement object. * * @param text a String object with the textual content to be added * @return the SOAPElement object into which the new Text object was inserted * @throws SOAPException if there is an error in creating the new Text object */ SOAPElement addTextNode(String text) throws SOAPException; /** * Creates a QName whose namespace URI is the one associated with the parameter, prefix, in the context of this SOAPElement. * The remaining elements of the new QName are taken directly from the parameters, localName and prefix. * @param localName a String containing the local part of the name. * @param prefix a String containing the prefix for the name. * @return a QName with the specified localName and prefix, and with a namespace that is associated with the prefix in the context of this SOAPElement. * This namespace will be the same as the one that would be returned by getNamespaceURI(String) if it were given prefix as it's parameter. * @throws SOAPException if the QName cannot be created. * @since SAAJ 1.3 */ QName createQName(String localName, String prefix) throws SOAPException; /** Returns an Iterator over all of the attribute Name objects in this SOAPElement object. * * The iterator can be used to get the attribute names, which can then be passed to the method getAttributeValue to * retrieve the value of each attribute. * * @return an iterator over the names of the attributes */ Iterator getAllAttributes(); /** * Returns an Iterator over all of the attributes in this SOAPElement as QName objects. * The iterator can be used to get the attribute QName, which can then be passed to the method getAttributeValue to retrieve the value of each attribute. * @return an iterator over the QNames of the attributes * @since SAAJ 1.3 */ Iterator getAllAttributesAsQNames(); /** Returns the value of the attribute with the specified name. * * @param name a Name object with the name of the attribute * @return a String giving the value of the specified attribute */ String getAttributeValue(Name name); /** * Returns the value of the attribute with the specified qname. * @param qname a QName object with the qname of the attribute * @return a String giving the value of the specified attribute, Null if there is no such attribute * @since SAAJ 1.3 */ String getAttributeValue(QName qname); /** Returns an Iterator over all the immediate child Nodes of this element. * * This includes javax.xml.soap.Text objects as well as SOAPElement objects. * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes to be replaced by SOAPElement, * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for the type of this parent node. * As a result the calling application must treat any existing references to these child nodes that have been obtained * through DOM APIs as invalid and either discard them or refresh them with the values returned by this Iterator. * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details. * * @return an iterator with the content of this SOAPElement object */ Iterator getChildElements(); /** Returns an Iterator over all the immediate child Nodes of this element with the specified name. * * All of these children will be SOAPElement nodes. * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes to be replaced by SOAPElement, * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for the type of this parent node. * As a result the calling application must treat any existing references to these child nodes that have been obtained * through DOM APIs as invalid and either discard them or refresh them with the values returned by this Iterator. * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details. * * @param name a Name object with the name of the child elements to be returned * @return an Iterator object over all the elements in this SOAPElement object with the specified name */ Iterator getChildElements(Name name); /** * Returns an Iterator over all the immediate child Nodes of this element with the specified qname. * All of these children will be SOAPElement nodes. * * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes to be replaced by * SOAPElement, SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for the type of this parent node. * As a result the calling application must treat any existing references to these child nodes that have been obtained through * DOM APIs as invalid and either discard them or refresh them with the values returned by this Iterator. * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details. * @param qname a QName object with the qname of the child elements to be returned * @return an Iterator object over all the elements in this SOAPElement object with the specified qname * @since SAAJ 1.3 */ Iterator getChildElements(QName qname); /** Returns the name of this SOAPElement object. * * @return a Name object with the name of this SOAPElement object */ Name getElementName(); /** * Returns the qname of this SOAPElement object. * @return a QName object with the qname of this SOAPElement object * @since SAAJ 1.3 */ QName getElementQName(); /** * Changes the name of this Element to newName if possible. SOAP Defined elements such as SOAPEnvelope, SOAPHeader, SOAPBody etc. cannot * have their names changed using this method. Any attempt to do so will result in a SOAPException being thrown. * * Callers should not rely on the element instance being renamed as is. * Implementations could end up copying the content of the SOAPElement to a renamed instance. * @param qname the new name for the Element. * @return The renamed Node * @throws SOAPException if changing the name of this Element is not allowed. * @since SAAJ 1.3 */ SOAPElement setElementQName(QName qname) throws SOAPException; /** Returns the encoding style for this SOAPElement object. * * @return a String giving the encoding style */ String getEncodingStyle(); /** Returns an Iterator over the namespace prefix Strings declared by this element. * * The prefixes returned by this iterator can be passed to the method getNamespaceURI to retrieve the URI of each namespace. * * @return an iterator over the namespace prefixes in this SOAPElement object */ Iterator getNamespacePrefixes(); /** Returns the URI of the namespace that has the given prefix. * * @param prefix a String giving the prefix of the namespace for which to search * @return a String with the uri of the namespace that has the given prefix */ String getNamespaceURI(String prefix); /** Returns an Iterator over the namespace prefix Strings visible to this element. * * The prefixes returned by this iterator can be passed to the method getNamespaceURI to retrieve the URI of each namespace. * * @return an iterator over the namespace prefixes are within scope of this SOAPElement object */ Iterator getVisibleNamespacePrefixes(); /** Removes the attribute with the specified name. * * @param name the Name object with the name of the attribute to be removed * @return true if the attribute was removed successfully; false if it was not */ boolean removeAttribute(Name name); /** * Removes the attribute with the specified qname. * @param qname the QName object with the qname of the attribute to be removed * @return true if the attribute was removed successfully; false if it was not * @since SAAJ 1.3 */ boolean removeAttribute(QName qname); /** Detaches all children of this SOAPElement. * * This method is useful for rolling back the construction of partially completed SOAPHeaders and SOAPBodys in * preparation for sending a fault when an error condition is detected. * It is also useful for recycling portions of a document within a SOAP message. */ void removeContents(); /** Removes the namespace declaration corresponding to the given prefix. * * @param prefix a String giving the prefix for which to search * @return true if the namespace declaration was removed successfully; false if it was not */ boolean removeNamespaceDeclaration(String prefix); /** Sets the encoding style for this SOAPElement object to one specified. * * @param encodingStyle a String giving the encoding style * @throws SOAPException if there was a problem in the encoding style being set. */ void setEncodingStyle(String encodingStyle) throws SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SAAJResult.java0000644000175000017500000001242510613047074027300 0ustar godgod/* * 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 javax.xml.soap; // $Id: SAAJResult.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.transform.dom.DOMResult; import org.w3c.dom.Element; /** * Acts as a holder for the results of a JAXP transformation or a JAXB marshalling, in the form of a SAAJ tree. * These results should be accessed by using the getResult() method. The DOMResult.getNode() method should be avoided in almost all cases. * * @author Thomas.Diesler@jboss.org * @since SAAJ 1.3 */ public class SAAJResult extends DOMResult { private SOAPElement rootElement; /** * Creates a SAAJResult that will present results in the form of a SAAJ tree that supports the default (SOAP 1.1) protocol. * * This kind of SAAJResult is meant for use in situations where the results will be used as a parameter to a method that * takes a parameter whose type, such as SOAPElement, is drawn from the SAAJ API. When used in a transformation, * the results are populated into the SOAPPart of a SOAPMessage that is created internally. * The SOAPPart returned by DOMResult.getNode() is not guaranteed to be well-formed. * * @throws SOAPException if there is a problem creating a SOAPMessage * @since SAAJ 1.3 */ public SAAJResult() throws SOAPException { } /** * Creates a SAAJResult that will present results in the form of a SAAJ tree that supports the specified protocol. * The DYNAMIC_SOAP_PROTOCOL is ambiguous in this context and will cause this constructor to throw an UnsupportedOperationException. * * This kind of SAAJResult is meant for use in situations where the results will be used as a parameter to a method that takes a parameter whose type, such as SOAPElement, is drawn from the SAAJ API. When used in a transformation the results are populated into the SOAPPart of a SOAPMessage that is created internally. The SOAPPart returned by DOMResult.getNode() is not guaranteed to be well-formed. * * @param protocol the name of the SOAP protocol that the resulting SAAJ tree should support * @throws SOAPException if a SOAPMessage supporting the specified protocol cannot be created * @since SAAJ 1.3 */ public SAAJResult(String protocol) throws SOAPException { } /** * Creates a SAAJResult that will write the results into the SOAPPart of the supplied SOAPMessage. * In the normal case these results will be written using DOM APIs and, as a result, the finished SOAPPart * will not be guaranteed to be well-formed unless the data used to create it is also well formed. When used in a * transformation the validity of the SOAPMessage after the transformation can be guaranteed only by means outside SAAJ specification. * * @param message the message whose SOAPPart will be populated as a result of some transformation or marshalling operation * @since SAAJ 1.3 */ public SAAJResult(SOAPMessage message) { try { rootElement = message.getSOAPPart().getEnvelope(); } catch (SOAPException ex) { throw new IllegalArgumentException("Cannot create SAAJ result", ex); } } /** * Creates a SAAJResult that will write the results as a child node of the SOAPElement specified. * In the normal case these results will be written using DOM APIs and as a result may invalidate the structure of the SAAJ tree. * This kind of SAAJResult should only be used when the validity of the incoming data can be guaranteed by means outside of the SAAJ specification. * * @param rootNode the root to which the results will be appended * @since SAAJ 1.3 */ public SAAJResult(SOAPElement rootNode) { rootElement = rootNode; } /** * @return the resulting Tree that was created under the specified root Node. * @since SAAJ 1.3 */ public Node getResult() { return rootElement; } public void setNode(org.w3c.dom.Node node) { rootElement = null; if (node instanceof Element) { try { SOAPFactory factory = SOAPFactory.newInstance(); rootElement = factory.createElement((Element)node); } catch (SOAPException ex) { throw new IllegalArgumentException("Cannot set node: " + node, ex); } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/AttachmentPart.java0000755000175000017500000004013610613047074030305 0ustar godgod/* * 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 javax.xml.soap; import java.io.InputStream; import java.util.Iterator; import javax.activation.DataHandler; /** A single attachment to a SOAPMessage object. A SOAPMessage object may contain zero, one, or many AttachmentPart objects. Each AttachmentPart object consists of two parts, applicationspecific content and associated MIME headers. The MIME headers consists of name/value pairs that can be used to identify and describe the content. An AttachmentPart object must conform to certain standards. 1. It must conform to MIME [RFC2045] standards (http://www.ietf.org/rfc/rfc2045.txt) 2. It MUST contain content 3. The header portion MUST include the following header: Content-Type This header identifies the type of data in the content of an AttachmentPart object and MUST conform to [RFC2045]. The following is an example of a Content-Type header: Content-Type: application/xml The following line of code, in which ap is an AttachmentPart object, sets the header shown in the previous example. ap.setMimeHeader(“Content-Type”, “application/xml”); There are no restrictions on the content portion of an AttachmentPart object. The content may be anything from a simple plain text object to a complex XML document or image file. An AttachmentPart object is created with the method SOAPMessage.createAttachmentPart. After setting its MIME headers, the AttachmentPart object is added to the message that created it with the method SOAPMessage.addAttachmentPart. The following code fragment, in which m is a SOAPMessage object and contentStringl is a String, creates an instance of AttachmentPart, sets the AttachmentPart object with some content and header information, and adds the AttachmentPart object to the SOAPMessage object. AttachmentPart ap1 = m.createAttachmentPart(); ap1.setContent(contentString1, “text/plain”); m.addAttachmentPart(ap1); The following code fragment creates and adds a second AttachmentPart instance to the same message. jpegData is a binary byte buffer representing the jpeg file. AttachmentPart ap2 = m.createAttachmentPart(); byte[] jpegData = ...; ap2.setContent(new ByteArrayInputStream(jpegData), “image/jpeg”); m.addAttachmentPart(ap2); The getContent method retrieves the contents and header from an AttachmentPart object. Depending on the DataContentHandler objects present, the returned Object can either be a typed Java object corresponding to the MIME type or an InputStream object that contains the content as bytes. String content1 = ap1.getContent(); java.io.InputStream content2 = ap2.getContent(); The method clearContent removes all the content from an AttachmentPart object but does not affect its header information. ap1.clearContent(); * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public abstract class AttachmentPart { private String contentId; private String contentLocation; private String contentType; /** * Adds a MIME header with the specified name and value to this AttachmentPart object. * * Note that RFC822 headers can contain only US-ASCII characters. * @param name a String giving the name of the header to be added * @param value a String giving the value of the header to be added */ public abstract void addMimeHeader(String name, String value); /** * Clears out the content of this AttachmentPart object. The MIME header portion is left untouched. */ public abstract void clearContent(); /** * Retrieves all the headers for this AttachmentPart object as an iterator over the MimeHeader objects. * @return an Iterator object with all of the Mime headers for this AttachmentPart object */ public abstract Iterator getAllMimeHeaders(); /** * Gets the content of this AttachmentPart object as a Java object. * The type of the returned Java object depends on * (1) the DataContentHandler object that is used to interpret the bytes and * (2) the Content-Type given in the header. * * For the MIME content types "text/plain", "text/html" and "text/xml", the DataContentHandler object does the * conversions to and from the Java types corresponding to the MIME types. * * For other MIME types,the DataContentHandler object can return an InputStream object that contains the content * data as raw bytes. * * A SAAJ-compliant implementation must, as a minimum, return a java.lang.String object corresponding to any * content stream with a Content-Type value of text/plain, a javax.xml.transform.stream.StreamSource object * corresponding to a content stream with a Content-Type value of text/xml, * a java.awt.Image object corresponding to a content stream with a Content-Type value of image/gif or image/jpeg. * * For those content types that an installed DataContentHandler object does not understand, the DataContentHandler * object is required to return a java.io.InputStream object with the raw bytes. * * @return a Java object with the content of this AttachmentPart object * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error */ public abstract Object getContent() throws SOAPException; /** * Returns an InputStream which can be used to obtain the content of AttachmentPart as Base64 encoded character data, * this method would base64 encode the raw bytes of the attachment and return. * * @return an InputStream from which the Base64 encoded AttachmentPart can be read. * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error. * @since SAAJ 1.3 */ public abstract InputStream getBase64Content() throws SOAPException; /** * Gets the content of this AttachmentPart object as an InputStream as if a call had been made to getContent and no DataContentHandler * had been registered for the content-type of this AttachmentPart. * * Note that reading from the returned InputStream would result in consuming the data in the stream. * It is the responsibility of the caller to reset the InputStream appropriately before calling a Subsequent API. * If a copy of the raw attachment content is required then the getRawContentBytes() API should be used instead. * * @return an InputStream from which the raw data contained by the AttachmentPart can be accessed. * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error. * @since SAAJ 1.3 */ public abstract java.io.InputStream getRawContent() throws SOAPException; /** * Gets the content of this AttachmentPart object as a byte[] array as if a call had been * made to getContent and no DataContentHandler had been registered for the content-type of this AttachmentPart. * * @return a byte[] array containing the raw data of the AttachmentPart. * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error. * @since SAAJ 1.3 */ public abstract byte[] getRawContentBytes() throws SOAPException; /** * Gets the DataHandler object for this AttachmentPart object. * @return object associated with this AttachmentPart object * @throws SOAPException if there is no data in this AttachmentPart object */ public abstract DataHandler getDataHandler() throws SOAPException; /** * Retrieves all MimeHeader objects that match a name in the given array. * @param names a String array with the name(s) of the MIME headers to be returned * @return all of the MIME headers that match one of the names in the given array as an Iterator object */ public abstract Iterator getMatchingMimeHeaders(String[] names); /** * Gets all the values of the header identified by the given String. * @param name the name of the header; example: "Content-Type" * @return a String array giving the value for the specified header */ public abstract String[] getMimeHeader(String name); /** * Retrieves all MimeHeader objects whose name does not match a name in the given array. * @param names a String array with the name(s) of the MIME headers not to be returned * @return all of the MIME headers in this AttachmentPart object except those that match one of the names * in the given array. The nonmatching MIME headers are returned as an Iterator object. */ public abstract Iterator getNonMatchingMimeHeaders(String[] names); /** * Returns the number of bytes in this AttachmentPart object. * @return the size of this AttachmentPart object in bytes or -1 if the size cannot be determined * @throws SOAPException if the content of this attachment is corrupted of if there was an exception while trying to determine the size. */ public abstract int getSize() throws SOAPException; /** * Removes all the MIME header entries. */ public abstract void removeAllMimeHeaders(); /** * Removes all MIME headers that match the given name. * @param name the string name of the MIME header/s to be removed */ public abstract void removeMimeHeader(String name); /** * Sets the content of this attachment part to that of the given Object and sets the value of the Content-Type header * to the given type. The type of the Object should correspond to the value given for the Content-Type. * This depends on the particular set of DataContentHandler objects in use. * * @param object the Java object that makes up the content for this attachment part * @param contentType the MIME string that specifies the type of the content * @throws IllegalArgumentException if the contentType does not match the type of the content object, * or if there was no DataContentHandler object for this content object */ public abstract void setContent(Object object, String contentType); /** * Sets the content of this attachment part to that contained by the InputStream content and sets the value of the Content-Type header to the value contained in contentType. * * A subsequent call to getSize() may not be an exact measure of the content size. * * @param content the raw data to add to the attachment part * @param contentType the value to set into the Content-Type header * @throws SOAPException if an there is an error in setting the content * @throws NullPointerException if content is null * @since SAAJ 1.3 */ public abstract void setRawContent(InputStream content, String contentType) throws SOAPException; /** * Sets the content of this attachment part to that contained by the byte[] array content and sets the value of the Content-Type * header to the value contained in contentType. * * @param content the raw data to add to the attachment part * @param contentType the value to set into the Content-Type header * @param offset the offset in the byte array of the content * @param len the number of bytes that form the content * @throws SOAPException if an there is an error in setting the content or content is null * @since SAAJ 1.3 */ public abstract void setRawContentBytes(byte[] content, int offset, int len, String contentType) throws SOAPException; /** * Sets the content of this attachment part from the Base64 source InputStream and sets the value of the Content-Type header * to the value contained in contentType, This method would first decode the base64 input and write the resulting raw bytes to the attachment. * * A subsequent call to getSize() may not be an exact measure of the content size. * * @param content the base64 encoded data to add to the attachment part * @param contentType the value to set into the Content-Type header * @throws SOAPException if an there is an error in setting the content * @throws NullPointerException if content is null * @since SAAJ 1.3 */ public abstract void setBase64Content(InputStream content, String contentType) throws SOAPException; /** * Sets the given DataHandler object as the data handler for this AttachmentPart object. * Typically, on an incoming message, the data handler is automatically set. * When a message is being created and populated with content, the setDataHandler method can be used to get data * from various data sources into the message. * @param dataHandler the DataHandler object to be set * @throws IllegalArgumentException if there was a problem with the specified DataHandler object */ public abstract void setDataHandler(DataHandler dataHandler); /** * Changes the first header entry that matches the given name to the given value, adding a new header if no existing * header matches. This method also removes all matching headers but the first. * * Note that RFC822 headers can only contain US-ASCII characters. * @param name a String giving the name of the header for which to search * @param value a String giving the value to be set for the header whose name matches the given name * @throws IllegalArgumentException if there was a problem with the specified mime header name or value */ public abstract void setMimeHeader(String name, String value); /** * Gets the value of the MIME header whose name is "Content-Id". * @return a String giving the value of the "Content-Id" header or null if there is none */ public String getContentId() { return contentId; } /** * Sets the MIME header whose name is "Content-Id" with the given value. * @param contentId a String giving the value of the "Content-Id" header * @throws IllegalArgumentException if there was a problem with the specified contentId value */ public void setContentId(String contentId) { this.contentId = contentId; } /** * Gets the value of the MIME header whose name is "Content-Location". * @return a String giving the value of the "Content-Location" header or null if there is none */ public String getContentLocation() { return contentLocation; } /** * Sets the MIME header whose name is "Content-Location" with the given value. * @throws IllegalArgumentException if there was a problem with the specified content location */ public void setContentLocation(String contentLocation) { this.contentLocation = contentLocation; } /** * Gets the value of the MIME header whose name is "Content-Type". * @return a String giving the value of the "Content-Type" header or null if there is none */ public String getContentType() { return contentType; } /** * Sets the MIME header whose name is "Content-Type" with the given value. * @param contentType a String giving the value of the "Content-Type" header * @throws IllegalArgumentException if there was a problem with the specified content type */ public void setContentType(String contentType) { this.contentType = contentType; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPBody.java0000755000175000017500000002027010613047074026743 0ustar godgod/* * 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 javax.xml.soap; import java.util.Locale; import javax.xml.namespace.QName; import org.w3c.dom.Document; /** An object that represents the contents of the SOAP body element in a SOAP * message. A SOAP body element consists of XML data that affects the way the * application-specific content is processed. * * A SOAPBody object contains SOAPBodyElement objects, which have the content * for the SOAP body. A SOAPFault object, which carries status and/or error * information, is an example of a SOAPBodyElement object. * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface SOAPBody extends SOAPElement { /** Creates a new SOAPBodyElement object with the specified name and adds it to this SOAPBody object. * * @param name a Name object with the name for the new SOAPBodyElement object * @return the new SOAPBodyElement object * @throws SOAPException if a SOAP error occurs */ public abstract SOAPBodyElement addBodyElement(Name name) throws SOAPException; /** * Creates a new SOAPBodyElement object with the specified QName and adds it to this SOAPBody object. * @param qname a QName object with the qname for the new SOAPBodyElement object * @return the new SOAPBodyElement object * @throws SOAPException if a SOAP error occurs * @since SAAJ 1.3 */ public abstract SOAPBodyElement addBodyElement(QName qname) throws SOAPException; /** Adds the root node of the DOM Document to this SOAPBody object. * * Calling this method invalidates the document parameter. * The client application should discard all references to this Document and its contents upon calling addDocument. * The behavior of an application that continues to use such references is undefined. * * @param doc the Document object whose root node will be added to this SOAPBody. * @return the SOAPBodyElement that represents the root node that was added. * @throws SOAPException if the Document cannot be added */ public abstract SOAPBodyElement addDocument(Document doc) throws SOAPException; /** Creates a new SOAPFault object and adds it to this SOAPBody object. * * The new SOAPFault will have default values set for the mandatory child elements faultcode and faultstring. * A SOAPBody may contain at most one SOAPFault child element * * @return the new SOAPFault object * @throws SOAPException if there is a SOAP error */ public abstract SOAPFault addFault() throws SOAPException; /** Creates a new SOAPFault object and adds it to this SOAPBody object. * * The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring * set to faultString. * * A SOAPBody may contain at most one SOAPFault child element * * @param faultCode a Name object giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification and of type QName * @param faultString a String giving an explanation of the fault * @return the new SOAPFault object * @throws SOAPException if there is a SOAP error */ public abstract SOAPFault addFault(Name faultCode, String faultString) throws SOAPException; /** * Creates a new SOAPFault object and adds it to this SOAPBody object. The type of the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 SOAPFault * depending on the protocol specified while creating the MessageFactory instance. * * For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element and the faultString parameter is the value * of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value of the faultcode element and the * faultString parameter is the value of the faultstring element. * * In case of a SOAP 1.2 fault, the default value for the mandatory xml:lang attribute on the Fault/Reason/Text element will be * set to java.util.Locale.getDefault() * * A SOAPBody may contain at most one SOAPFault child element * * @param faultCode a QName object giving the fault code to be set; must be one of the fault codes defined in the version of SOAP specification in use * @param faultString a String giving an explanation of the fault * @throws SOAPException if there is a SOAP error * @since SAAJ 1.3 */ public abstract SOAPFault addFault(QName faultCode, String faultString) throws SOAPException; /** Creates a new SOAPFault object and adds it to this SOAPBody object. * * The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring * set to faultString and localized to locale. * * A SOAPBody may contain at most one SOAPFault child element * * @param faultCode a Name object giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification and of type QName * @param faultString a String giving an explanation of the fault * @param locale a Locale object indicating the native language of the faultString * @return the new SOAPFault object * @throws SOAPException if there is a SOAP error */ public abstract SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException; /** * Creates a new SOAPFault object and adds it to this SOAPBody object. The type of the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 * SOAPFault depending on the protocol specified while creating the MessageFactory instance. * * For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element and the faultString parameter is * the value of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value of the faultcode element * and the faultString parameter is the value of the faultstring element. * * A SOAPBody may contain at most one SOAPFault child element. * * @param faultCode a QName object giving the fault code to be set; must be one of the fault codes defined in the version of SOAP specification in use * @param faultString a String giving an explanation of the fault * @param locale a Locale object indicating the native language of the faultString * @return the new SOAPFault object * @throws SOAPException if there is a SOAP error * @since SAAJ 1.3 */ public abstract SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException; /** Returns the SOAPFault object in this SOAPBody object. * * @return the SOAPFault object in this SOAPBody object */ public abstract SOAPFault getFault(); /** Indicates whether a SOAPFault object exists in this SOAPBody object. * * @return true if a SOAPFault object exists in this SOAPBody object; false otherwise */ public abstract boolean hasFault(); /** * Creates a new DOM Document and sets the first child of this SOAPBody as it's document element. * The child SOAPElement is removed as part of the process. * @return the Document representation of the SOAPBody content. * @throws SOAPException if there is not exactly one child SOAPElement of the SOAPBody. * @since SAAJ 1.3 */ public Document extractContentAsDocument() throws SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/Name.java0000755000175000017500000000660410613047074026250 0ustar godgod/* * 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 javax.xml.soap; /** A representation of an XML name. This interface provides methods for getting the local and namespace-qualified names and also for getting the prefix associated with the namespace for the name. It is also possible to get the URI of the namespace. The following is an example of a namespace declaration in an element. ("xmlns" stands for "XML namespace".) The following shows what the methods in the Name interface will return. getQualifiedName will return "prefix:LocalName" = "WOMBAT:GetLastTradePrice" getURI will return "http://www.wombat.org/trader" getLocalName will return "GetLastTracePrice" getPrefix will return "WOMBAT" XML namespaces are used to disambiguate SOAP identifiers from application-specific identifiers. Name objects are created using the method SOAPEnvelope.createName, which has two versions. One method creates Name objects with a local name, a namespace prefix, and a namespace URI. and the second creates Name objects with just a local name. The following line of code, in which se is a SOAPEnvelope object, creates a new Name object with all three. Name name = se.createName("GetLastTradePrice", "WOMBAT", "http://www.wombat.org/trader"); The following line of code gives an example of how a Name object can be used. The variable element is a SOAPElement object. This code creates a new SOAPElement object with the given name and adds it to element. element.addChildElement(name); @author Scott.Stark@jboss.org @version $Revision: 2897 $ */ public interface Name { /** Gets the local name part of the XML name that this Name object represents. * * @return a string giving the local name */ public String getLocalName(); /** Returns the prefix that was specified when this Name object was initialized. * This prefix is associated with the namespace for the XML name that this Name object represents. * * @return the prefix as a string */ public String getPrefix(); /** Gets the namespace-qualified name of the XML name that this Name object represents. * * @return the namespace-qualified name as a string */ public String getQualifiedName(); /** Returns the URI of the namespace for the XML name that this Name object represents. * * @return the URI as a string */ public String getURI(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPException.java0000755000175000017500000000274510706573414030020 0ustar godgod/* * 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 javax.xml.soap; /** * @author Scott.Stark@jboss.org * @version $Revision: 4839 $ */ public class SOAPException extends Exception { private static final long serialVersionUID = 5083961510786058130L; public SOAPException() { } public SOAPException(String message) { super(message); } public SOAPException(String message, Throwable cause) { super(message, cause); } public SOAPException(Throwable cause) { super(cause); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPConnection.java0000755000175000017500000000647210676150634030163 0ustar godgod/* * 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 javax.xml.soap; /** A point-to-point connection that a client can use for sending messages directly to a remote * party (represented by a URL, for instance). * * The SOAPConnection class is optional. Some implementations may not implement this interface in which case the call * to SOAPConnectionFactory.newInstance() (see below) will throw an UnsupportedOperationException. * * A client can obtain a SOAPConnection object using a SOAPConnectionFactory object as in the following example: * * SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance(); * SOAPConnection con = factory.createConnection(); * * A SOAPConnection object can be used to send messages directly to a URL following the request/response paradigm. * That is, messages are sent using the method call, which sends the message and then waits until it gets a reply. * * @author Scott.Stark@jboss.org * @version $Revision: 4618 $ */ public abstract class SOAPConnection { public SOAPConnection() { } /** Sends the given message to the specified endpoint and blocks until it has returned the response. * * @param request the SOAPMessage object to be sent * @param to an Object that identifies where the message should be sent. * It is required to support Objects of type java.lang.String, java.net.URL, and when JAXM is present javax.xml.messaging.URLEndpoint * @return the SOAPMessage object that is the response to the message that was sent * @throws SOAPException if there is a SOAP error */ public abstract SOAPMessage call(SOAPMessage request, Object to) throws SOAPException; /** * Gets a message from a specific endpoint and blocks until it receives, * @param to an Object that identifies where the request should be sent. Objects of type java.lang.String and java.net.URL must be supported. * @return the SOAPMessage object that is the response to the get message request * @throws SOAPException if there is a SOAP error * @since SAAJ 1.3 */ public SOAPMessage get(Object to) throws SOAPException { throw new IllegalStateException("Should be implemented by concrete implementation of this class"); } /** Closes this SOAPConnection object. * * @throws SOAPException if there is a SOAP error */ public abstract void close() throws SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/MimeHeaders.java0000755000175000017500000001647610613047074027563 0ustar godgod/* * 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 javax.xml.soap; // $Id: MimeHeaders.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; /** A container for MimeHeader objects, which represent the MIME headers present * in a MIME part of a message. * * This class is used primarily when an application wants to retrieve specific * attachments based on certain MIME headers and values. This class will most * likely be used by implementations of AttachmentPart and other MIME dependent * parts of the SAAJ API. * * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org */ public class MimeHeaders { private LinkedList headers = new LinkedList(); /** * Adds a MimeHeader object with the specified name and value to this MimeHeaders object's list of headers. * * Note that RFC822 headers can contain only US-ASCII characters. * * @param name a String with the name of the header to be added * @param value a String with the value of the header to be added * @throws IllegalArgumentException - if there was a problem in the mime header name or value being added */ public void addHeader(String name, String value) throws IllegalArgumentException { if (name == null || name.length() == 0) throw new IllegalArgumentException("Invalid null or empty header name"); MimeHeader header = new MimeHeader(name, value); headers.add(header); } /** * Returns all the MimeHeaders in this MimeHeaders object. * @return an Iterator object over this MimeHeaders object's list of MimeHeader objects */ public Iterator getAllHeaders() { return headers.iterator(); } /** * Returns all of the values for the specified header as an array of String objects. * * @param name the name of the header for which values will be returned * @return a String array with all of the values for the specified header */ public String[] getHeader(String name) { ArrayList tmp = new ArrayList(); for (int n = 0; n < headers.size(); n++) { MimeHeader mh = (MimeHeader)headers.get(n); if (mh.getName().equalsIgnoreCase(name)) tmp.add(mh.getValue()); } String[] values = null; if (tmp.size() > 0) { values = new String[tmp.size()]; tmp.toArray(values); } return values; } /** * Returns all the MimeHeader objects whose name matches a name in the given array of names. * @param names an array of String objects with the names for which to search * @return an Iterator object over the MimeHeader objects whose name matches one of the names in the given list */ public Iterator getMatchingHeaders(String[] names) { MatchingIterator iter = new MatchingIterator(headers, names, true); return iter; } /** * Returns all of the MimeHeader objects whose name does not match a name in the given array of names. * @param names an array of String objects with the names for which to search * @return an Iterator object over the MimeHeader objects whose name does not match one of the names in the given list */ public Iterator getNonMatchingHeaders(String[] names) { MatchingIterator iter = new MatchingIterator(headers, names, false); return iter; } /** * Removes all the header entries from this MimeHeaders object. */ public void removeAllHeaders() { headers.clear(); } /** * Remove all MimeHeader objects whose name matches the given name. * @param name a String with the name of the header for which to search */ public void removeHeader(String name) { Iterator iter = headers.iterator(); while (iter.hasNext()) { MimeHeader mh = (MimeHeader)iter.next(); if (mh.getName().equalsIgnoreCase(name)) iter.remove(); } } /** * Replaces the current value of the first header entry whose name matches * the given name with the given value, adding a new header if no existing * header name matches. This method also removes all matching headers after * the first one. * * Note that RFC822 headers can contain only US-ASCII characters. * * @param name a String with the name of the header for which to search * @param value a String with the value that will replace the current value of the specified header * @throws IllegalArgumentException if there was a problem in the mime header name or the value being set */ public void setHeader(String name, String value) { boolean didSet = false; for (int n = 0; n < headers.size(); n++) { MimeHeader mh = (MimeHeader)headers.get(n); if (mh.getName().equalsIgnoreCase(name)) { if (didSet == true) { headers.remove(n); n--; } else { mh = new MimeHeader(name, value); headers.set(n, mh); didSet = true; } } } if (didSet == false) { this.addHeader(name, value); } } public String toString() { return "[MimeHeaders=" + headers + "]"; } private static class MatchingIterator implements Iterator { private LinkedList headers; private HashSet names; private boolean match; private int index; private MimeHeader mh; MatchingIterator(LinkedList headers, String[] names, boolean match) { this.headers = headers; this.index = 0; this.names = new HashSet(); for (int n = 0; n < names.length; n++) this.names.add(names[n].toLowerCase()); this.match = match; } public boolean hasNext() { boolean hasNext = index < headers.size(); while (hasNext == true) { mh = (MimeHeader)headers.get(index); index++; String name = mh.getName().toLowerCase(); if (names.contains(name) == match) break; hasNext = index < headers.size(); } return hasNext; } public Object next() { return mh; } public void remove() { headers.remove(index - 1); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/DetailEntry.java0000755000175000017500000000254410613047074027613 0ustar godgod/* * 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 javax.xml.soap; /** The content for a Detail object, giving details for a SOAPFault object. A * DetailEntry object, which carries information about errors related to the * SOAPBody object that contains it, is application-specific. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface DetailEntry extends SOAPElement { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/Text.java0000755000175000017500000000272410613047074026313 0ustar godgod/* * 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 javax.xml.soap; /** A representation of a node whose value is text. A Text object may represent * text that is content or text that is a comment. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface Text extends javax.xml.soap.Node, org.w3c.dom.Text { /** Retrieves whether this Text object represents a comment. * * @return true if this Text object is a comment; false otherwise */ public boolean isComment(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/Node.java0000755000175000017500000000720310613047074026251 0ustar godgod/* * 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 javax.xml.soap; /** A representation of a node (element) in an XML document. This interface * extnends the standard DOM Node interface with methods for getting and setting * the value of a node, for getting and setting the parent of a node, and for * removing a node * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface Node extends org.w3c.dom.Node { /** * Removes this Node object from the tree. */ public void detachNode(); /** * Returns the parent element of this Node object. * This method can throw an UnsupportedOperationException if the tree is not kept in memory. * @return the SOAPElement object that is the parent of this Node object or null if this Node object is root */ public SOAPElement getParentElement(); /** * Sets the parent of this Node object to the given SOAPElement object. * @param parent the SOAPElement object to be set as the parent of this Node object * @throws SOAPException if there is a problem in setting the parent to the given element */ public void setParentElement(SOAPElement parent) throws SOAPException; /** * Returns the value of this node if this is a Text node or the value of the immediate child of this node otherwise. * If there is an immediate child of this Node that it is a Text node then it's value will be returned. * If there is more than one Text node then the value of the first Text Node will be returned. * Otherwise null is returned. * @return a String with the text of this node if this is a Text node or the text contained by the first immediate * child of this Node object that is a Text object if such a child exists; null otherwise. */ public String getValue(); /** * If this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) * child of this node. The value of the immediate child of this node can be set only if, there is one child node and * that node is a Text node, or if there are no children in which case a child Text node will be created. * @param value A value string * @throws IllegalStateException if the node is not a Text node and either has more than one child node or has a child node that is not a Text node. */ public void setValue(String value); /** * Notifies the implementation that this Node object is no longer being used by the application and that the * implementation is free to reuse this object for nodes that may be created later. * Calling the method recycleNode implies that the method detachNode has been called previously. */ public void recycleNode(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPBodyElement.java0000755000175000017500000000306010613047074030253 0ustar godgod/* * 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 javax.xml.soap; /** A SOAPBodyElement object represents the contents in a SOAPBody object. * The SOAPFault interface is a SOAPBodyElement object that has been defined. * * A new SOAPBodyElement object can be created and added to a SOAPBody object * with the SOAPBody method addBodyElement. In the following line of code, sb * is a SOAPBody object, and myName is a Name object. SOAPBodyElement sbe = sb.addBodyElement(myName); * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface SOAPBodyElement extends SOAPElement { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPPart.java0000755000175000017500000001137510613047074026762 0ustar godgod/* * 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 javax.xml.soap; import java.util.Iterator; import javax.xml.transform.Source; import org.w3c.dom.Document; /** * The container for the SOAP-specific portion of a SOAPMessage object. * * All messages are required to have a SOAP part, so when a SOAPMessage object is created, * it will automatically have a SOAPPart object. * * A SOAPPart object is a MIME part and has the MIME headers Content-Id, Content-Location, and Content-Type. * Because the value of Content-Type must be "text/xml", a SOAPPart object automatically has a MIME header of * Content-Type with its value set to "text/xml". * * The value must be "text/xml" because content in the SOAP part of a message must be in XML format. * Content that is not of type "text/xml" must be in an AttachmentPart object rather than in the SOAPPart object. * * When a message is sent, its SOAP part must have the MIME header Content-Type set to "text/xml". * Or, from the other perspective, the SOAP part of any message that is received must have the MIME header * Content-Type with a value of "text/xml". * * A client can access the SOAPPart object of a SOAPMessage object by calling the method SOAPMessage.getSOAPPart. * The following line of code, in which message is a SOAPMessage object, retrieves the SOAP part of a message. * * SOAPPart soapPart = message.getSOAPPart(); * * A SOAPPart object contains a SOAPEnvelope object, which in turn contains a SOAPBody object and a SOAPHeader object. * The SOAPPart method getEnvelope can be used to retrieve the SOAPEnvelope object. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public abstract class SOAPPart implements Document, Node { public SOAPPart() { } public abstract SOAPEnvelope getEnvelope() throws SOAPException; public String getContentId() { String id = null; String[] header = getMimeHeader("Content-Id"); if (header != null && header.length > 0) { id = header[0]; } return id; } public void setContentId(String contentId) { setMimeHeader("Content-Id", contentId); } public String getContentLocation() { String location = null; String[] header = getMimeHeader("Content-Location"); if (header != null && header.length > 0) { location = header[0]; } return location; } public void setContentLocation(String contentLocation) { setMimeHeader("Content-Location", contentLocation); } public abstract void removeMimeHeader(String s); public abstract void removeAllMimeHeaders(); public abstract String[] getMimeHeader(String s); public abstract void setMimeHeader(String s, String s1); public abstract void addMimeHeader(String s, String s1); public abstract Iterator getAllMimeHeaders(); public abstract Iterator getMatchingMimeHeaders(String as[]); public abstract Iterator getNonMatchingMimeHeaders(String as[]); /** Sets the content of the SOAPEnvelope object with the data from the given Source object. * This Source must contain a valid SOAP document. * @param source the {@link javax.xml.transform.Source} object with the data to be set * @throws SOAPException if the implementation cannot convert the specified Source object */ public abstract void setContent(Source source) throws SOAPException; /** Returns the content of the SOAPEnvelope as a JAXP Source object. * @return the content as a javax.xml.transform.Source object * @throws javax.xml.soap.SOAPException if the implementation cannot convert the specified Source object * @see #setContent(javax.xml.transform.Source) setContent(javax.xml.transform.Source) */ public abstract Source getContent() throws SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SAAJFactoryLoader.java0000644000175000017500000001472610673747600030576 0ustar godgod/* * 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 javax.xml.soap; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Properties; // $Id: SAAJFactoryLoader.java 4583 2007-09-18 13:15:44Z thomas.diesler@jboss.com $ /** * Load a factory using this ordered lookup procedure * *

        *
      1. Use the system property *
      2. Use the properties file "lib/jaxm.properties" in the JRE directory *
      3. Use the Services API (as detailed in the JAR specification), if available, to determine the classname *
      4. Use the default factory implementation class *
      * * @author Thomas.Diesler@jboss.com * @since 14-Dec-2006 */ class SAAJFactoryLoader { private SAAJFactoryLoader() { } /** * * @return the factory impl, or null */ public static Object loadFactory(String propertyName, String defaultFactory) { Object factory = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); // Use the system property PrivilegedAction action = new PropertyAccessAction(propertyName); String factoryName = (String)AccessController.doPrivileged(action); if (factoryName != null) { try { //if(log.isDebugEnabled()) log.debug("Load from system property: " + factoryName); Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } // Use the properties file "lib/jaxm.properties" in the JRE directory. // This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. if (factory == null) { action = new PropertyAccessAction("java.home"); String javaHome = (String)AccessController.doPrivileged(action); File jaxmFile = new File(javaHome + "/lib/jaxm.properties"); if (jaxmFile.exists()) { try { action = new PropertyFileAccessAction(jaxmFile.getCanonicalPath()); Properties jaxmProperties = (Properties)AccessController.doPrivileged(action); factoryName = jaxmProperties.getProperty(propertyName); if (factoryName != null) { //if(log.isDebugEnabled()) log.debug("Load from " + jaxmFile + ": " + factoryName); Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } } // Use the Services API (as detailed in the JAR specification), if available, to determine the classname. if (factory == null) { String filename = "META-INF/services/" + propertyName; InputStream inStream = loader.getResourceAsStream(filename); if (inStream != null) { try { BufferedReader br = new BufferedReader(new InputStreamReader(inStream, "UTF-8")); factoryName = br.readLine(); br.close(); if (factoryName != null) { //if(log.isTraceEnabled()) log.trace("Load from Service API " + filename + ": " + factoryName); Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } } // Use the default factory implementation class. if (factory == null && defaultFactory != null) { try { factoryName = defaultFactory; //if(log.isDebugEnabled()) log.debug("Load from default: " + factoryName); Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } return factory; } private static class PropertyAccessAction implements PrivilegedAction { private String name; PropertyAccessAction(String name) { this.name = name; } public Object run() { return System.getProperty(name); } } private static class PropertyFileAccessAction implements PrivilegedAction { private String filename; PropertyFileAccessAction(String filename) { this.filename = filename; } public Object run() { try { InputStream inStream = new FileInputStream(filename); Properties props = new Properties(); props.load(inStream); return props; } catch (IOException ex) { throw new SecurityException("Cannot load properties: " + filename, ex); } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPFactory.java0000755000175000017500000002311610676150634027465 0ustar godgod/* * 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 javax.xml.soap; // $Id: SOAPFactory.java 4618 2007-09-25 09:15:08Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import org.w3c.dom.Element; /** SOAPFactory is a factory for creating various objects that exist in the SOAP XML tree. * * SOAPFactory can be used to create XML fragments that will eventually end up in the SOAP part. * These fragments can be inserted as children of the SOAPHeaderElement or SOAPBodyElement or * SOAPEnvelope or other SOAPElement objects. * * SOAPFactory also has methods to create javax.xml.soap.Detail objects as well as java.xml.soap.Name objects. * * @author Scott.Stark@jboss.org * @version $Revision: 4618 $ */ public abstract class SOAPFactory { private static SOAPFactory soapFactory; /** * Creates a new SOAPFactory object that is an instance of the default implementation (SOAP 1.1), * This method uses the following ordered lookup procedure to determine the SOAPFactory implementation class to load: * * Use the javax.xml.soap.SOAPFactory system property. * Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. * Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.soap.SOAPFactory in jars available to the runtime. * Use the SAAJMetaFactory instance to locate the SOAPFactory implementation class. * * @return a new instance of a SOAPFactory * @throws SOAPException if there was an error creating the default SOAPFactory */ public static SOAPFactory newInstance() throws SOAPException { if (soapFactory == null) { try { String propertyName = "javax.xml.soap.SOAPFactory"; soapFactory = (SOAPFactory)SAAJFactoryLoader.loadFactory(propertyName, null); } catch (RuntimeException rte) { throw new SOAPException(rte); } // Use the SAAJMetaFactory instance to locate the MessageFactory implementation class. if (soapFactory == null) { SAAJMetaFactory saajFactory = SAAJMetaFactory.getInstance(); soapFactory = saajFactory.newSOAPFactory(SOAPConstants.DEFAULT_SOAP_PROTOCOL); } if (soapFactory == null) throw new SOAPException("Failed to to determine the SOAPFactory implementation class"); } return soapFactory; } /** * Creates a new SOAPFactory object that is an instance of the specified implementation, this method uses the SAAJMetaFactory * to locate the implementation class and create the SOAPFactory instance. * * @param protocol a string constant representing the class of the specified message factory implementation. * May be either DYNAMIC_SOAP_PROTOCOL, DEFAULT_SOAP_PROTOCOL (which is the same as) SOAP_1_1_PROTOCOL, or SOAP_1_2_PROTOCOL. * @throws SOAPException if there was an error creating the specified SOAPFactory * @since SAAJ 1.3 */ public static SOAPFactory newInstance(String protocol) throws SOAPException { SAAJMetaFactory saajFactory = SAAJMetaFactory.getInstance(); SOAPFactory factory = saajFactory.newSOAPFactory(protocol); if (factory == null) throw new SOAPException("Failed to to determine the SOAPFactory implementation class"); return factory; } /** Creates a new Detail object which serves as a container for DetailEntry objects. * * This factory method creates Detail objects for use in situations where it is not practical to use the SOAPFault abstraction. * * @return a Detail object * @throws SOAPException if there is a SOAP error */ public abstract Detail createDetail() throws SOAPException; /** * Creates a SOAPElement object from an existing DOM Element. If the DOM Element that is passed in as an argument is already a * SOAPElement then this method must return it unmodified without any further work. Otherwise, a new SOAPElement is created and * a deep copy is made of the domElement argument. The concrete type of the return value will depend on the name of the domElement * argument. If any part of the tree rooted in domElement violates SOAP rules, a SOAPException will be thrown. * @param domElement the Element to be copied. * @return a new SOAPElement that is a copy of domElement. * @throws SOAPException if there is an error in creating the SOAPElement object * @since SAAJ 1.3 */ public SOAPElement createElement(Element domElement) throws SOAPException { throw new IllegalStateException("Should be implemented by concrete implementation of this class"); } /** Create a SOAPElement object initialized with the given local name. * * @param localName a String giving the local name for the new element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object */ public abstract SOAPElement createElement(String localName) throws SOAPException; /** Create a new SOAPElement object with the given local name, prefix and uri. * * @param localName a String giving the local name for the new element * @param prefix the prefix for this SOAPElement * @param uri a String giving the URI of the namespace to which the new element belongs * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object */ public abstract SOAPElement createElement(String localName, String prefix, String uri) throws SOAPException; /** Create a SOAPElement object initialized with the given Name object. * * @param name a Name object with the XML name for the new element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object */ public abstract SOAPElement createElement(Name name) throws SOAPException; /** * Creates a SOAPElement object initialized with the given QName object. * The concrete type of the return value will depend on the name given to the new SOAPElement. * For instance, a new SOAPElement with the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would * cause a SOAPEnvelope that supports SOAP 1.2 behavior to be created. * @param qname a QName object with the XML name for the new element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the SOAPElement object * @since SAAJ 1.3 */ public SOAPElement createElement(QName qname) throws SOAPException { throw new IllegalStateException("Should be implemented by concrete implementation of this class"); } /** * Creates a new SOAPFault object initialized with the given reasonText and faultCode * @param reasonText the ReasonText/FaultString for the fault * @param faultCode the FaultCode for the fault * @return a SOAPFault object * @throws SOAPException if there is a SOAP error * @since SAAJ 1.3 */ public abstract SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException; /** * Creates a new default SOAPFault object * @return a SOAPFault object * @throws SOAPException if there is a SOAP error * @since SAAJ 1.3 */ public abstract SOAPFault createFault() throws SOAPException; /** Creates a new Name object initialized with the given local name. * * This factory method creates Name objects for use in situations where it is not practical to use the * SOAPEnvelope abstraction. * @return * @throws SOAPException */ public abstract Name createName(String localName) throws SOAPException; /** Creates a new Name object initialized with the given local name, namespace prefix, and namespace URI. * * This factory method creates Name objects for use in situations where it is not practical to use the SOAPEnvelope abstraction. * * @param localName a String giving the local name * @param prefix a String giving the prefix of the namespace * @param uri a String giving the URI of the namespace * @return a Name object initialized with the given local name, namespace prefix, and namespace URI * @throws SOAPException if there is a SOAP error */ public abstract Name createName(String localName, String prefix, String uri) throws SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/soap/SOAPFault.java0000755000175000017500000003236310613047074027127 0ustar godgod/* * 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 javax.xml.soap; import java.util.Iterator; import java.util.Locale; import javax.xml.namespace.QName; /** An element in the SOAPBody object that contains error and/or status * information. This information may relate to errors in the SOAPMessage * object or to problems that are not related to the content in the message * itself. Problems not related to the message itself are generally errors in * processing, such as the inability to communicate with an upstream server. * * Depending on the protocol specified while creating the MessageFactory instance, a * SOAPFault has sub-elements as defined in the SOAP 1.1/SOAP 1.2 specification. * * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org * @version $Revision: 2897 $ */ public interface SOAPFault extends SOAPBodyElement { /** * Creates an optional Detail object and sets it as the Detail object for this SOAPFault object. * * It is illegal to add a detail when the fault already contains a detail. * Therefore, this method should be called only after the existing detail has been removed. * @return the new Detail object * @throws SOAPException if this SOAPFault object already contains a valid Detail object */ Detail addDetail() throws SOAPException; /** * Appends or replaces a Reason Text item containing the specified text message and an xml:lang derived from locale. * If a Reason Text item with this xml:lang already exists its text value will be replaced with text. * The locale parameter should not be null * * Code sample: * * SOAPFault fault = ...; * fault.addFaultReasonText("Version Mismatch", Locale.ENGLISH); * * @param text reason message string * @param locale Locale object representing the locale of the message * @throws SOAPException if there was an error in adding the Reason text or the locale passed was null. * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Reason. * @since SAAJ 1.3 */ void addFaultReasonText(String text, Locale locale) throws SOAPException; /** * Adds a Subcode to the end of the sequence of Subcodes contained by this SOAPFault. * Subcodes, which were introduced in SOAP 1.2, are represented by a recursive sequence of * subelements rooted in the mandatory Code subelement of a SOAP Fault. * * @param subcode a QName containing the Value of the Subcode * @throws SOAPException if there was an error in setting the Subcode * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Subcode. * @since SAAJ 1.3 */ void appendFaultSubcode(javax.xml.namespace.QName subcode) throws SOAPException; /** * Returns the optional detail element for this SOAPFault object. * * A Detail object carries application-specific error information related to SOAPBodyElement objects. * * @return a Detail object with application-specific error information */ Detail getDetail(); /** * Gets the fault actor for this SOAPFault object. * @return a String giving the actor in the message path that caused this SOAPFault object */ String getFaultActor(); /** * Gets the fault code for this SOAPFault object. * @return a String with the fault code */ String getFaultCode(); /** * Gets the mandatory SOAP 1.1 fault code for this SOAPFault object as a SAAJ Name object. * The SOAP 1.1 specification requires the value of the "faultcode" element to be of type QName. * This method returns the content of the element as a QName in the form of a SAAJ Name object. * This method should be used instead of the getFaultCode method since it allows applications to * easily access the namespace name without additional parsing. * * In the future, a QName object version of this method may also be added. * * @return a Name representing the faultcode */ Name getFaultCodeAsName(); /** * Gets the fault code for this SOAPFault object as a QName object. * @return a QName representing the faultcode * @since SAAJ 1.3 */ QName getFaultCodeAsQName(); /** * Returns the optional Node element value for this SOAPFault object. The Node element is optional in SOAP 1.2. * @return Content of the env:Fault/env:Node element as a String or null if none * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Node. * @since SAAJ 1.3 */ String getFaultNode(); /** * Returns an Iterator over a distinct sequence of Locales for which there are associated Reason Text items. * Any of these Locales can be used in a call to getFaultReasonText in order to obtain a localized version of the Reason Text string. * @return an Iterator over a sequence of Locale objects for which there are associated Reason Text items. * @throws SOAPException if there was an error in retrieving the fault Reason locales. * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Reason. * @since SAAJ 1.3 */ Iterator getFaultReasonLocales() throws SOAPException; /** * Returns an Iterator over a sequence of String objects containing all of the Reason Text items for this SOAPFault. * @return an Iterator over env:Fault/env:Reason/env:Text items. * @throws SOAPException if there was an error in retrieving the fault Reason texts. * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Reason. * @since SAAJ 1.3 */ Iterator getFaultReasonTexts() throws SOAPException; /** * Returns the Reason Text associated with the given Locale. If more than one such Reason Text exists the first matching Text is returned * @param locale the Locale for which a localized Reason Text is desired * @return the Reason Text associated with locale * @throws SOAPException if there was an error in retrieving the fault Reason text for the specified locale . * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Reason. * @since SAAJ 1.3 */ String getFaultReasonText(Locale locale) throws SOAPException; /** * Creates or replaces any existing Node element value for this SOAPFault object. The Node element is optional in SOAP 1.2. * @throws SOAPException f there was an error in setting the Node for this SOAPFault object. * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Node. * @since SAAJ 1.3 */ void setFaultNode(String uri) throws SOAPException; /** * Returns the optional Role element value for this SOAPFault object. The Role element is optional in SOAP 1.2. * @return Content of the env:Fault/env:Role element as a String or null if none * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Role. * @since SAAJ 1.3 */ String getFaultRole(); /** * Creates or replaces any existing Role element value for this SOAPFault object. The Role element is optional in SOAP 1.2. * @throws SOAPException f there was an error in setting the Role for this SOAPFault object. * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Fault Role. * @since SAAJ 1.3 */ void setFaultRole(String uri) throws SOAPException; /** * Gets the fault string for this SOAPFault object. * @return a String giving an explanation of the fault */ String getFaultString(); /** * Gets the locale of the fault string for this SOAPFault object. * @return a Locale object indicating the native language of the fault string or null if no locale was specified */ Locale getFaultStringLocale(); /** * Gets the Subcodes for this SOAPFault as an iterator over QNames. * @return an Iterator that accesses a sequence of QNames. This Iterator should not support the optional remove method. * The order in which the Subcodes are returned reflects the hierarchy of Subcodes present in the fault from top to bottom. * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Subcode. * @since SAAJ 1.3 */ Iterator getFaultSubcodes(); /** * Removes any Subcodes that may be contained by this SOAPFault. Subsequent calls to getFaultSubcodes will return an empty * iterator until a call to appendFaultSubcode is made. * @throws UnsupportedOperationException if this message does not support the SOAP 1.2 concept of Subcode. * @since SAAJ 1.3 */ void removeAllFaultSubcodes(); /** * Returns true if this SOAPFault has a Detail subelement and false otherwise. Equivalent to (getDetail()!=null). * @return true if this SOAPFault has a Detail subelement and false otherwise. * @since SAAJ 1.3 */ boolean hasDetail(); /** * Sets this SOAPFault object with the given fault actor. * * The fault actor is the recipient in the message path who caused the fault to happen. * * @param faultActor a String identifying the actor that caused this SOAPFault object * @throws SOAPException if there was an error in adding the faultActor to the underlying XML tree. */ void setFaultActor(String faultActor) throws SOAPException; /** * Sets this SOAPFault object with the give fault code. * * Fault codes, which given information about the fault, are defined in the SOAP 1.1 specification. * This element is mandatory in SOAP 1.1. Because the fault code is required to be a QName * it is preferable to use the setFaultCode(Name) form of this method. * * @param faultCode a String giving the fault code to be set. * It must be of the form "prefix:localName" where the prefix has been defined in a namespace declaration. * @throws SOAPException if there was an error in adding the faultCode to the underlying XML tree. */ void setFaultCode(String faultCode) throws SOAPException; /** * Sets this SOAPFault object with the given fault code. * * Fault codes, which give information about the fault, are defined in the SOAP 1.1 specification. * A fault code is mandatory and must be of type QName. This method provides a convenient way to set a fault code. * For example, * * SOAPEnvelope se = ...; * //Create a qualified name in the SOAP namespace with a localName * // of "Client". Note that prefix parameter is optional and is null * // here which causes the implementation to use an appropriate prefix. * Name qname = se.createName("Client", null, SOAPConstants.URI_NS_SOAP_ENVELOPE); * SOAPFault fault = ...; * fault.setFaultCode(qname); * * It is preferable to use this method over setFaultCode(String). * * @param faultCode a Name object giving the fault code to be set. It must be namespace qualified. * @throws SOAPException if there was an error in adding the faultcode element to the underlying XML tree. */ void setFaultCode(Name faultCode) throws SOAPException; /** * Sets this SOAPFault object with the given fault code. It is preferable to use this method over setFaultCode(Name). * @param faultCode a QName object giving the fault code to be set. It must be namespace qualified. * @throws SOAPException if there was an error in adding the faultcode element to the underlying XML tree. * @since SAAJ 1.3 */ void setFaultCode(QName faultCode) throws SOAPException; /** * Sets the fault string for this SOAPFault object to the given string. * * @param faultString a String giving an explanation of the fault * @throws SOAPException if there was an error in adding the faultString to the underlying XML tree. */ void setFaultString(String faultString) throws SOAPException; /** * Sets the fault string for this SOAPFault object to the given string and localized to the given locale. * * @param faultString a String giving an explanation of the fault * @param locale a Locale object indicating the native language of the faultString * @throws SOAPException */ void setFaultString(String faultString, Locale locale) throws SOAPException; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/0000755000175000017500000000000010755000270024330 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/0000755000175000017500000000000010755000270025770 5ustar godgod././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ByteWrapperHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ByteWrapperHolder.j0000755000175000017500000000247510613047074031566 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Bytes. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class ByteWrapperHolder implements Holder { public Byte value; public ByteWrapperHolder() { } public ByteWrapperHolder(Byte value) { this.value = value; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ByteArrayHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ByteArrayHolder.jav0000755000175000017500000000247510613047074031553 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for byte[]s. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class ByteArrayHolder implements Holder { public byte[] value; public ByteArrayHolder() { } public ByteArrayHolder(byte[] value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/QNameHolder.java0000755000175000017500000000252110613047074031003 0ustar godgod/* * 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 javax.xml.rpc.holders; import javax.xml.namespace.QName; /** A holder for QNames. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class QNameHolder implements Holder { public QName value; public QNameHolder() { } public QNameHolder(QName value) { this.value = value; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/FloatWrapperHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/FloatWrapperHolder.0000755000175000017500000000250310613047074031546 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Floats. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class FloatWrapperHolder implements Holder { public Float value; public FloatWrapperHolder() { } public FloatWrapperHolder(Float value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ByteHolder.java0000755000175000017500000000245010613047074030706 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for bytes. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class ByteHolder implements Holder { public byte value; public ByteHolder() { } public ByteHolder(byte value) { this.value = value; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/DoubleWrapperHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/DoubleWrapperHolder0000755000175000017500000000251110613047074031634 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Doubles. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class DoubleWrapperHolder implements Holder { public Double value; public DoubleWrapperHolder() { } public DoubleWrapperHolder(Double value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/FloatHolder.java0000755000175000017500000000245610613047074031056 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for floats. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class FloatHolder implements Holder { public float value; public FloatHolder() { } public FloatHolder(float value) { this.value = value; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/CalendarHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/CalendarHolder.java0000755000175000017500000000253410613047074031517 0ustar godgod/* * 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 javax.xml.rpc.holders; import java.util.Calendar; /** A holder for Calendars. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class CalendarHolder implements Holder { public Calendar value; public CalendarHolder() { } public CalendarHolder(Calendar value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ObjectHolder.java0000755000175000017500000000246410613047074031216 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Objects. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class ObjectHolder implements Holder { public Object value; public ObjectHolder() { } public ObjectHolder(Object value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/StringHolder.java0000755000175000017500000000246410613047074031256 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Strings. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class StringHolder implements Holder { public String value; public StringHolder() { } public StringHolder(String value) { this.value = value; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/BigIntegerHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/BigIntegerHolder.ja0000755000175000017500000000255210613047074031476 0ustar godgod/* * 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 javax.xml.rpc.holders; import java.math.BigInteger; /** A holder for BigIntegers. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class BigIntegerHolder implements Holder { public BigInteger value; public BigIntegerHolder() { } public BigIntegerHolder(BigInteger value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/DoubleHolder.java0000755000175000017500000000246410613047074031222 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for doubles. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class DoubleHolder implements Holder { public double value; public DoubleHolder() { } public DoubleHolder(double value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/BooleanHolder.java0000755000175000017500000000247210613047074031366 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for booleans. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class BooleanHolder implements Holder { public boolean value; public BooleanHolder() { } public BooleanHolder(boolean value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/Holder.java0000755000175000017500000000251410613047074030063 0ustar godgod/* * 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 javax.xml.rpc.holders; /** This interface represents the base interface for both standard and generated * Holder classes. A generated Holder class is required to implement this Holder * interface. * * @author Scott.Stark@jboss.org * @author Rahul Sharma (javadoc) * @version $Revision: 2897 $ */ public interface Holder { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/LongHolder.java0000755000175000017500000000245010613047074030702 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for longs. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class LongHolder implements Holder { public long value; public LongHolder() { } public LongHolder(long value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/IntHolder.java0000755000175000017500000000244210613047074030536 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for ints. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class IntHolder implements Holder { public int value; public IntHolder() { } public IntHolder(int value) { this.value = value; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/BooleanWrapperHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/BooleanWrapperHolde0000755000175000017500000000251710613047074031625 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Booleans. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class BooleanWrapperHolder implements Holder { public Boolean value; public BooleanWrapperHolder() { } public BooleanWrapperHolder(Boolean value) { this.value = value; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/BigDecimalHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/BigDecimalHolder.ja0000755000175000017500000000255210613047074031437 0ustar godgod/* * 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 javax.xml.rpc.holders; import java.math.BigDecimal; /** A holder for BigDecimals. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class BigDecimalHolder implements Holder { public BigDecimal value; public BigDecimalHolder() { } public BigDecimalHolder(BigDecimal value) { this.value = value; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/IntegerWrapperHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/IntegerWrapperHolde0000755000175000017500000000251710613047074031643 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Integers. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class IntegerWrapperHolder implements Holder { public Integer value; public IntegerWrapperHolder() { } public IntegerWrapperHolder(Integer value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ShortHolder.java0000755000175000017500000000245610613047074031110 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for shorts. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class ShortHolder implements Holder { public short value; public ShortHolder() { } public ShortHolder(short value) { this.value = value; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ShortWrapperHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/ShortWrapperHolder.0000755000175000017500000000250310613047074031600 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Shorts. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class ShortWrapperHolder implements Holder { public Short value; public ShortWrapperHolder() { } public ShortWrapperHolder(Short value) { this.value = value; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/LongWrapperHolder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/holders/LongWrapperHolder.j0000755000175000017500000000247510613047074031562 0ustar godgod/* * 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 javax.xml.rpc.holders; /** A holder for Longs. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public final class LongWrapperHolder implements Holder { public Long value; public LongWrapperHolder() { } public LongWrapperHolder(Long value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/soap/0000755000175000017500000000000010755000270025272 5ustar godgod././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/soap/SOAPFaultException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/soap/SOAPFaultException.jav0000755000175000017500000000603510706573414031433 0ustar godgod/* * 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 javax.xml.rpc.soap; // $Id: SOAPFaultException.java 4839 2007-10-21 06:51:56Z thomas.diesler@jboss.com $ import java.util.logging.Logger; import javax.xml.namespace.QName; import javax.xml.soap.Detail; import javax.xml.soap.Name; /** The SOAPFaultException exception represents a SOAP fault. * * The message part in the SOAP fault maps to the contents of faultdetail * element accessible through the getDetail method on the SOAPFaultException. * The method createDetail on the javax.xml.soap.SOAPFactory creates an instance * of the javax.xml.soap.Detail. * * The faultstring provides a human-readable description of the SOAP fault. The * faultcode element provides an algorithmic mapping of the SOAP fault. * * Refer to SOAP 1.1 and WSDL 1.1 specifications for more details of the SOAP * faults. * * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org * @author Rahul Sharma (javadoc) */ public class SOAPFaultException extends RuntimeException { private static final long serialVersionUID = -7224636940495025621L; // provide logging private static Logger log = Logger.getLogger(SOAPFaultException.class.getName()); private QName faultCode; private String faultString; private String faultActor; private Detail faultDetail; public SOAPFaultException(QName faultCode, String faultString, String faultActor, Detail faultDetail) { super(faultString); Name detailName = faultDetail != null ? faultDetail.getElementName() : null; log.fine("new SOAPFaultException [code=" + faultCode + ",string=" + faultString + ",actor=" + faultActor + ",detail=" + detailName + "]"); this.faultCode = faultCode; this.faultString = faultString; this.faultActor = faultActor; this.faultDetail = faultDetail; } public QName getFaultCode() { return faultCode; } public String getFaultString() { return faultString; } public String getFaultActor() { return faultActor; } public Detail getDetail() { return faultDetail; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/0000755000175000017500000000000010755000270026116 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/Serializer.java0000755000175000017500000000270210613047074031104 0ustar godgod/* * 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 javax.xml.rpc.encoding; import java.io.Serializable; /** This interface defines the base interface for serializers. A Serializer * converts a Java object to an XML representation using a specific XML * processing mechanism and based on the specified type mapping and encoding * style. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface Serializer extends Serializable { public String getMechanismType(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/XMLType.java0000755000175000017500000000571010613047074030277 0ustar godgod/* * 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 javax.xml.rpc.encoding; import javax.xml.namespace.QName; /** Constants for common XML Schema and SOAP 1.1 types. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public class XMLType { public static final QName SOAP_ARRAY = QName.valueOf("{SOAP-ENC}Array"); public static final QName SOAP_BASE64 = QName.valueOf("{SOAP-ENC}base64"); public static final QName SOAP_BOOLEAN = QName.valueOf("{SOAP-ENC}boolean"); public static final QName SOAP_BYTE = QName.valueOf("{SOAP-ENC}byte"); public static final QName SOAP_DOUBLE = QName.valueOf("{SOAP-ENC}double"); public static final QName SOAP_FLOAT = QName.valueOf("{SOAP-ENC}float"); public static final QName SOAP_INT = QName.valueOf("{SOAP-ENC}int"); public static final QName SOAP_LONG = QName.valueOf("{SOAP-ENC}long"); public static final QName SOAP_SHORT = QName.valueOf("{SOAP-ENC}short"); public static final QName SOAP_STRING = QName.valueOf("{SOAP-ENC}string"); public static final QName XSD_BASE64 = QName.valueOf("{SOAP-ENC}base64Binary"); public static final QName XSD_BOOLEAN = QName.valueOf("{SOAP-ENC}boolean"); public static final QName XSD_BYTE = QName.valueOf("{xsd}byte"); public static final QName XSD_DATETIME = QName.valueOf("{xsd}dateTime"); public static final QName XSD_DECIMAL = QName.valueOf("{xsd}decimal"); public static final QName XSD_DOUBLE = QName.valueOf("{xsd}double"); public static final QName XSD_FLOAT = QName.valueOf("{xsd}float"); public static final QName XSD_HEXBINARY = QName.valueOf("{xsd}hexBinary"); public static final QName XSD_INT = QName.valueOf("{xsd}int"); public static final QName XSD_INTEGER = QName.valueOf("{xsd}integer"); public static final QName XSD_LONG = QName.valueOf("{xsd}long"); public static final QName XSD_QNAME = QName.valueOf("{xsd}QName"); public static final QName XSD_SHORT = QName.valueOf("{xsd}short"); public static final QName XSD_STRING = QName.valueOf("{xsd}string"); } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/SerializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/SerializerFactory.0000755000175000017500000000417110613047074031574 0ustar godgod/* * 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 javax.xml.rpc.encoding; import java.io.Serializable; import java.util.Iterator; /** * This is a factory of the serializers. A SerializerFactory is registered * with a TypeMapping object as part of the TypeMappingRegistry. * * @see Serializer * @see TypeMapping * @see TypeMappingRegistry * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface SerializerFactory extends Serializable { /** Returns a Serializer for the specified XML processing mechanism type. * * @param mechanismType XML processing mechanism type [TBD: definition of valid constants] * @return A Serializer * @throws javax.xml.rpc.JAXRPCException If SerializerFactory does not support the specified XML processing mechanism * @throws IllegalArgumentException If an invalid mechanism type is specified. */ public Serializer getSerializerAs(String mechanismType); /** Returns a list of all XML processing mechanism types supported by this SerializerFactory. * @return List of unique identifiers for the supported XML processing mechanism types */ public Iterator getSupportedMechanismTypes(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/Deserializer.java0000755000175000017500000000265310613047074031422 0ustar godgod/* * 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 javax.xml.rpc.encoding; import java.io.Serializable; /** A base interface for deserializers. A Deserializer converts an XML * representation to a Java object using a specific XML processing mechanism * and based on the specified type mapping and encoding style. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface Deserializer extends Serializable { public String getMechanismType(); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/SerializationContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/SerializationConte0000755000175000017500000000274510613047074031670 0ustar godgod/* * 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 javax.xml.rpc.encoding; /** This interface is implemented by the JAX-RPC runtime system in an XML * processing mechanism specific manner. A serializer uses the * SerializationContext interface during the serialization to get the context * information related to the XML processing mechanism and to manage * information specific to serialization. * * @see Serializer * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface SerializationContext { } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/TypeMappingRegistry.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/TypeMappingRegistr0000755000175000017500000001155210613047074031653 0ustar godgod/* * 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 javax.xml.rpc.encoding; import java.io.Serializable; /** * This defines a registry of TypeMapping instances for encoding styles. * * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org * @version $Revision: 2897 $ */ public interface TypeMappingRegistry extends Serializable { /** * Removes all registered TypeMappings and encodingStyleURIs from this TypeMappingRegistry. */ public void clear(); /** * Gets the registered default TypeMapping instance. * This method returns null if there is no registered default TypeMapping in the registry. * @return The registered default TypeMapping instance or null */ public TypeMapping getDefaultTypeMapping(); /** * Registers the TypeMapping instance that is default for all encoding styles supported by the TypeMappingRegistry. * A default TypeMapping should include serializers and deserializers that are independent of and usable with any * encoding style. Successive invocations of the registerDefault method replace any existing default TypeMapping instance. * * If the default TypeMapping is registered, any other TypeMapping instances registered through the * TypeMappingRegistry.register method (for a set of encodingStyle URIs) override the default TypeMapping. * * @param mapping TypeMapping instance * @throws javax.xml.rpc.JAXRPCException If there is an error in the registration of the default TypeMapping */ public void registerDefault(TypeMapping mapping); /** * Creates a new empty TypeMapping object. * @return TypeMapping instance */ public TypeMapping createTypeMapping(); /** * Returns the registered TypeMapping for the specified encodingStyle URI. If there is no registered TypeMapping for * the specified encodingStyleURI, this method returns null. * @param encodingStyleURI Encoding style specified as an URI * @return TypeMapping for the specified encodingStyleURI or null */ public TypeMapping getTypeMapping(String encodingStyleURI); /** * Returns a list of registered encodingStyle URIs in this TypeMappingRegistry instance. * @return Array of the registered encodingStyle URIs */ public String[] getRegisteredEncodingStyleURIs(); /** * Registers a TypeMapping instance with the TypeMappingRegistry. * This method replaces any existing registered TypeMapping instance for the specified encodingStyleURI. * * @param encodingStyleURI An encoding style specified as an URI. * @param mapping TypeMapping instance * @return Previous TypeMapping associated with the specified encodingStyleURI, or null if there was no * TypeMapping associated with the specified encodingStyleURI * @throws javax.xml.rpc.JAXRPCException If there is an error in the registration of the TypeMapping for the specified encodingStyleURI. */ public TypeMapping register(String encodingStyleURI, TypeMapping mapping); /** * Unregisters a TypeMapping instance, if present, from the specified encodingStyleURI. * @param encodingStyleURI Encoding style specified as an URI * @return TypeMapping instance that has been unregistered or null if there was no * TypeMapping registered for the specified encodingStyleURI */ public TypeMapping unregisterTypeMapping(String encodingStyleURI); /** * Removes a TypeMapping from the TypeMappingRegistry. * A TypeMapping is associated with 1 or more encodingStyleURIs. This method unregisters the specified * TypeMapping instance from all associated encodingStyleURIs and then removes this TypeMapping * instance from the registry. * * @param mapping TypeMapping to be removed * @return true if specified TypeMapping is removed from the TypeMappingRegistry; * false if the specified TypeMapping was not in the TypeMappingRegistry */ public boolean removeTypeMapping(TypeMapping mapping); } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/DeserializationContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/DeserializationCon0000755000175000017500000000237310613047074031645 0ustar godgod/* * 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 javax.xml.rpc.encoding; /** A deserializer uses this interface to access and maintain context * information during the deserialization. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface DeserializationContext { } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/DeserializerFactory.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/DeserializerFactor0000755000175000017500000000406310613047074031636 0ustar godgod/* * 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 javax.xml.rpc.encoding; import java.io.Serializable; import java.util.Iterator; /** A factory of deserializers. A DeserializerFactory is registered with a * TypeMapping instance as part of the TypeMappingRegistry. * * @see Deserializer * @see TypeMapping * @see TypeMappingRegistry * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface DeserializerFactory extends Serializable { /** * Returns a Deserializer for the specified XML processing mechanism type. * @param mechanismType XML processing mechanism type [TBD: definition of valid constants] * @return a Deserializer * @throws javax.xml.rpc.JAXRPCException If DeserializerFactory does not support the specified XML processing mechanism */ public Deserializer getDeserializerAs(String mechanismType); /** Returns a list of all XML processing mechanism types supported by this DeserializerFactory. * * @return List of unique identifiers for the supported XML processing mechanism types */ public Iterator getSupportedMechanismTypes(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/encoding/TypeMapping.java0000755000175000017500000001116410613047074031232 0ustar godgod/* * 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 javax.xml.rpc.encoding; import javax.xml.namespace.QName; /** * This is the base interface for the representation of a type mapping. A * TypeMapping implementation class may support one or more encoding styles. * * For its supported encoding styles, a TypeMapping instance maintains a set of * tuples of the type {Java Class, SerializerFactory, DeserializerFactory, XML type-QName}. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface TypeMapping { /** * Gets the DeserializerFactory registered for the specified pair of Java type and XML data type. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @return Registered DeserializerFactory or null if there is no registered factory */ public DeserializerFactory getDeserializer(Class javaType, QName xmlType); /** * Gets the SerializerFactory registered for the specified pair of Java type and XML data type. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @return Registered SerializerFactory or null if there is no registered factory */ public SerializerFactory getSerializer(Class javaType, QName xmlType); /** * Returns the encodingStyle URIs (as String[]) supported by this TypeMapping instance. * A TypeMapping that contains only encoding style independent serializers and deserializers * returns null from this method. * * @return Array of encodingStyle URIs for the supported encoding styles */ public String[] getSupportedEncodings(); /** * Sets the encodingStyle URIs supported by this TypeMapping instance. A TypeMapping that contains only encoding * independent serializers and deserializers requires null as the parameter for this method. * * @param encodingStyleURIs Array of encodingStyle URIs for the supported encoding styles */ public void setSupportedEncodings(String[] encodingStyleURIs); /** * Checks whether or not type mapping between specified XML type and Java type is registered. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @return boolean; true if type mapping between the specified XML type and Java type is registered; otherwise false */ public boolean isRegistered(Class javaType, QName xmlType); /** * Registers SerializerFactory and DeserializerFactory for a specific type mapping between an XML type and Java type. * This method replaces any existing registered SerializerFactory DeserializerFactory instances. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @param sf SerializerFactory * @param dsf DeserializerFactory * @throws javax.xml.rpc.JAXRPCException If any error during the registration */ public void register(Class javaType, QName xmlType, SerializerFactory sf, DeserializerFactory dsf); /** * Removes the DeserializerFactory registered for the specified pair of Java type and XML data type. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered DeserializerFactory */ public void removeDeserializer(Class javaType, QName xmlType); /** * Removes the SerializerFactory registered for the specified pair of Java type and XML data type. * @param javaType Class of the Java type * @param xmlType QName of the XML type * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered SerializerFactory */ public void removeSerializer(Class javaType, QName xmlType); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/Service.java0000644000175000017500000001602710613047074026607 0ustar godgod/* * 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 javax.xml.rpc; import java.net.URL; import java.rmi.Remote; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.rpc.encoding.TypeMappingRegistry; import javax.xml.rpc.handler.HandlerRegistry; /** Service class acts as a factory for: *
        *
      • Dynamic proxy for the target service endpoint. *
      • Instance of the type javax.xml.rpc.Call for the dynamic invocation of a remote operation on the target service endpoint. *
      • Instance of a generated stub class *
      * * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org * @version $Revision: 2897 $ */ public interface Service { /** * The getPort method returns either an instance of a generated stub implementation class or a dynamic proxy. * A service client uses this dynamic proxy to invoke operations on the target service endpoint. * The serviceEndpointInterface specifies the service endpoint interface that is supported by the created dynamic proxy or stub instance. * * @param portName Qualified name of the service endpoint in the WSDL service descr * @param seiClass Service endpoint interface supported by the dynamic proxy or stub instance * @return Stub instance or dynamic proxy that supports the specified service endpoint interface * @throws ServiceException This exception is thrown in the following cases: *
        *
      • If there is an error in creation of the dynamic proxy or stub instance *
      • If there is any missing WSDL metadata as required by this method *
      • Optionally, if an illegal serviceEndpointInterface or portName is specified *
      */ public Remote getPort(QName portName, Class seiClass) throws ServiceException; /** * The getPort method returns either an instance of a generated stub implementation class or a dynamic proxy. * The parameter serviceEndpointInterface specifies the service endpoint interface that is supported by the returned stub or proxy. * In the implementation of this method, the JAX-RPC runtime system takes the responsibility of selecting a protocol binding (and a port) * and configuring the stub accordingly. The returned Stub instance should not be reconfigured by the client. */ public Remote getPort(Class seiClass) throws ServiceException; /** Gets an array of preconfigured Call objects for invoking operations on the specified port. * There is one Call object per operation that can be invoked on the specified port. * Each Call object is pre-configured and does not need to be configured using the setter methods on Call interface. * * Each invocation of the getCalls method returns a new array of preconfigured Call objects * * This method requires the Service implementation class to have access to the WSDL related metadata. * * @param portName Qualified name for the target service endpoint * @return Call[] Array of pre-configured Call objects * @throws ServiceException If this Service class does not have access to the required WSDL metadata or if an illegal portName is specified. */ public Call[] getCalls(QName portName) throws ServiceException; /** Creates a Call instance. * * @param portName Qualified name for the target service endpoint * @return Call instance * @throws ServiceException If any error in the creation of the Call object */ public Call createCall(QName portName) throws ServiceException; /** Creates a Call instance. * * @param portName Qualified name for the target service endpoint * @param operationName Qualified name of the operation for which this Call object is to be created. * @return Call instance * @throws ServiceException If any error in the creation of the Call object */ public Call createCall(QName portName, QName operationName) throws ServiceException; /** Creates a Call instance. * * @param portName Qualified name for the target service endpoint * @param operationName Name of the operation for which this Call object is to be created. * @return Call instance * @throws ServiceException If any error in the creation of the Call object */ public Call createCall(QName portName, String operationName) throws ServiceException; /** * Creates a Call object not associated with specific operation or target service endpoint. * This Call object needs to be configured using the setter methods on the Call interface. * * @return Call object * @throws ServiceException If any error in the creation of the Call object */ public Call createCall() throws ServiceException; /** Gets the name of this service. * @return Qualified name of this service */ public QName getServiceName(); /** Returns an Iterator for the list of QNames of service endpoints grouped by this service * * @return Returns java.util.Iterator with elements of type javax.xml.namespace.QName * @throws ServiceException If this Service class does not have access to the required WSDL metadata */ public Iterator getPorts() throws ServiceException; /** Gets the location of the WSDL document for this Service. * * @return URL for the location of the WSDL document for this service */ public URL getWSDLDocumentLocation(); /** Gets the TypeMappingRegistry for this Service object. The returned TypeMappingRegistry instance is pre-configured * to support the standard type mapping between XML and Java types types as required by the JAX-RPC specification. * * @return The TypeMappingRegistry for this Service object. * @throws java.lang.UnsupportedOperationException if the Service class does not support the configuration of TypeMappingRegistry. */ public TypeMappingRegistry getTypeMappingRegistry(); /** Returns the configured HandlerRegistry instance for this Service instance. * * @return HandlerRegistry * @throws java.lang.UnsupportedOperationException if the Service class does not support the configuration of a HandlerRegistry */ public HandlerRegistry getHandlerRegistry(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/ServiceException.java0000755000175000017500000000310310706573414030465 0ustar godgod/* * 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 javax.xml.rpc; /** * @author Scott.Stark@jboss.org * @version $Revision: 4839 $ */ public class ServiceException extends Exception { private static final long serialVersionUID = -6582148924441189775L; public ServiceException() { } public ServiceException(String message) { super(message); } public ServiceException(String message, Throwable cause) { super(message, cause); } public ServiceException(Throwable cause) { super(cause); } public Throwable getLinkedCause() { return super.getCause(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/server/0000755000175000017500000000000010755000270025636 5ustar godgod././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/server/ServiceLifecycle.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/server/ServiceLifecycle.jav0000755000175000017500000000567210613047074031603 0ustar godgod/* * 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 javax.xml.rpc.server; import javax.xml.rpc.ServiceException; /** This interface defines a lifecycle interface for a JAX-RPC service endpoint. * If the service endpoint class implements the ServiceLifeycle interface, the * servlet container based JAX-RPC runtime system is required to manage the * lifecycle of the corresponding service endpoint objects. * * @author Scott.Stark@jboss.org * @author Rahul Sharma (javadoc) * @version $Revision: 2897 $ */ public interface ServiceLifecycle { /** * Used for initialization of a service endpoint. After a service endpoint instance (an instance of a service endpoint class) * is instantiated, the JAX-RPC runtime system invokes the init method. * The service endpoint class uses the init method to initialize its configuration and setup access to any external resources. * The context parameter in the init method enables the endpoint instance to access the endpoint context provided by * the underlying JAX-RPC runtime system. * * The init method implementation should typecast the context parameter to an appropriate Java type. * For service endpoints deployed on a servlet container based JAX-RPC runtime system, the context parameter is * of the Java type javax.xml.rpc.server.ServletEndpointContext. The ServletEndpointContext provides an endpoint * context maintained by the underlying servlet container based JAX-RPC runtime system * * @param context Endpoint context for a JAX-RPC service endpoint * @throws ServiceException If any error in initialization of the service endpoint; or if any illegal context has been provided in the init method */ public void init(Object context) throws ServiceException; /** * JAX-RPC runtime system ends the lifecycle of a service endpoint instance by invoking the destroy method. * The service endpoint releases its resourcesin the implementation of the destroy method. */ public void destroy(); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/server/ServletEndpointContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/server/ServletEndpointConte0000755000175000017500000001211610613047074031711 0ustar godgod/* * 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 javax.xml.rpc.server; import java.security.Principal; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import javax.xml.rpc.handler.MessageContext; /** * This interface provides an endpoint context maintained by the underlying * servlet container based JAX-RPC runtime system. For service endpoints * deployed on a servlet container based JAX-RPC runtime system, the context * parameter in the ServiceLifecycle.init method is required to be of the Java * type javax.xml.rpc.server.ServletEndpointContext. * * A servlet container based JAX-RPC runtime system implements the * ServletEndpointContext interface. The JAX-RPC runtime system is required to * provide appropriate session, message context, servlet context and user * principal information per method invocation on the endpoint class. * * @author Scott.Stark@jboss.org * @author Rahul Sharma, Roberto Chinnici (javadoc) * @version $Revision: 2897 $ */ public interface ServletEndpointContext { /** * The getHttpSession method returns the current HTTP session (as a javax.servlet.http.HTTPSession). * When invoked by the service endpoint within a remote method implementation, the getHttpSession returns the HTTP * session associated currently with this method invocation. This method returns null if there is no HTTP session * currently active and associated with this service endpoint. An endpoint class should not rely on an active HTTP * session being always there; the underlying JAX-RPC runtime system is responsible for managing whether or not there * is an active HTTP session. * * The getHttpSession method throws JAXRPCException if invoked by an non HTTP bound endpoint. * * @return The HTTP session associated with the current invocation or null if there is no active session. */ public HttpSession getHttpSession(); /** * The method getMessageContext returns the MessageContext targeted for this endpoint instance. * This enables the service endpoint instance to acccess the MessageContext propagated by request HandlerChain * (and its contained Handler instances) to the target endpoint instance and to share any SOAP message processing related context. * The endpoint instance can access and manipulate the MessageContext and share the SOAP message processing related context with the response HandlerChain. * * @return MessageContext; If there is no associated MessageContext, this method returns null. */ public MessageContext getMessageContext(); /** * The method getServletContext returns the ServletContext associated with the web application that contain this endpoint. * According to the Servlet specification, There is one context per web application (installed as a WAR) per JVM . * A servlet based service endpoint is deployed as part of a web application. * @return ServletContext */ public ServletContext getServletContext(); /** * Returns a java.security.Principal instance that contains the name of the authenticated user for the current method * invocation on the endpoint instance. This method returns null if there is no associated principal yet. * The underlying JAX-RPC runtime system takes the responsibility of providing the appropriate authenticated principal * for a remote method invocation on the service endpoint instance. * * @return A java.security.Principal for the authenticated principal associated with the current invocation on the * servlet endpoint instance; Returns null if there no authenticated user associated with a method invocation. */ public Principal getUserPrincipal(); /** * Returns a boolean indicating whether the authenticated user for the current method invocation on the endpoint * instance is included in the specified logical "role". * * @param role a String specifying the name of the role * @return a boolean indicating whether the authenticated user associated with the current method invocation belongs * to a given role; false if the user has not been authenticated */ public boolean isUserInRole(String role); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/0000755000175000017500000000000010755000271025746 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/soap/0000755000175000017500000000000010755000270026707 5ustar godgod././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/soap/SOAPMessageContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/soap/SOAPMessageCon0000755000175000017500000000315010613047074031351 0ustar godgod/* * 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 javax.xml.rpc.handler.soap; import javax.xml.rpc.handler.MessageContext; import javax.xml.soap.SOAPMessage; /** This interface provides access to the SOAP message for either RPC request * or response. The javax.xml.soap.SOAPMessage specifies the standard Java API * for the representation of a SOAP 1.1 message with attachments. * * @author Scott.Stark@jboss.org * @author Rahul Sharma (javadoc) * @version $Revision: 2897 $ */ public interface SOAPMessageContext extends MessageContext { public SOAPMessage getMessage(); public void setMessage(SOAPMessage message); public String[] getRoles(); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/MessageContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/MessageContext.java0000755000175000017500000000610110613047074031550 0ustar godgod/* * 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 javax.xml.rpc.handler; import java.util.Iterator; /** This interface abstracts the message context that is processed by a handler * in the handle method. * * The MessageContext interface provides methods to manage a property set. * MessageContext properties enable handlers in a handler chain to share * processing related state. * * @author Scott.Stark@jboss.org * @author Rahul Sharma, Roberto Chinnici (javadoc) * @version $Revision: 2897 $ */ public interface MessageContext { /** * Returns true if the MessageContext contains a property with the specified name. * @param name Name of the property whose presense is to be tested * @return Returns true if the MessageContext contains the property; otherwise false */ public boolean containsProperty(String name); /** * Gets the value of a specific property from the MessageContext * @param name Name of the property whose value is to be retrieved * @return Value of the property * @throws IllegalArgumentException if an illegal property name is specified */ public Object getProperty(String name); /** * Returns an Iterator view of the names of the properties in this MessageContext * @return Iterator for the property names */ public Iterator getPropertyNames(); /** * Removes a property (name-value pair) from the MessageContext * @param name Name of the property to be removed * @throws IllegalArgumentException if an illegal property name is specified */ public void removeProperty(String name); /** * Sets the name and value of a property associated with the MessageContext. * If the MessageContext contains a value of the same property, the old value is replaced. * @param name Name of the property associated with the MessageContext * @param value Value of the property * @throws IllegalArgumentException If some aspect of the property is prevents it from being stored in the context * @throws UnsupportedOperationException If this method is not supported. */ public void setProperty(String name, Object value); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/HandlerInfo.java0000755000175000017500000000760710642000211031004 0ustar godgod/* * 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 javax.xml.rpc.handler; import java.io.Serializable; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; /** This represents information about a handler in the HandlerChain. A * HandlerInfo instance is passed in the Handler.init method to initialize a * Handler instance. * * @author Scott.Stark@jboss.org * @version $Revision: 3772 $ */ public class HandlerInfo implements Serializable { private static final long serialVersionUID = -6735139577513563610L; private Class handlerClass; private Map configMap = new HashMap(); private QName[] headers; /** Default constructor */ public HandlerInfo() { } /** Constructor for HandlerInfo * * @param handlerClass Java Class for the Handler * @param config Handler Configuration as a java.util.Map * @param headers QNames for the header blocks processed by this Handler. * QName is the qualified name of the outermost element of a header block */ public HandlerInfo(Class handlerClass, Map config, QName[] headers) { this.handlerClass = handlerClass; this.headers = headers; if (config != null) this.configMap.putAll(config); } /** Gets the Handler class * * @return Returns null if no Handler class has been set; otherwise the set handler class */ public Class getHandlerClass() { return handlerClass; } /** Sets the Handler class * * @param handlerClass Class for the Handler */ public void setHandlerClass(Class handlerClass) { this.handlerClass = handlerClass; } /** Gets the Handler configuration * * @return Returns empty Map if no configuration map has been set; otherwise returns the set configuration map */ public Map getHandlerConfig() { return new HashMap(configMap); } /** Sets the Handler configuration as java.util.Map * * @param config Configuration map */ public void setHandlerConfig(Map config) { configMap.clear(); if (config != null) configMap.putAll(config); } /** Gets the header blocks processed by this Handler. * * @return Array of QNames for the header blocks. Returns null if no header blocks have been set using the setHeaders method. */ public QName[] getHeaders() { return headers; } /** Sets the header blocks processed by this Handler. * * @param qnames QNames of the header blocks. QName is the qualified name of the outermost element of the SOAP header block */ public void setHeaders(QName[] qnames) { headers = qnames; } /** Returns a string representation of the object. */ public String toString() { List hlist = (headers != null ? Arrays.asList(headers) : null); return "[class=" + handlerClass.getName() + ",headers=" + hlist + ",config=" + configMap + "]"; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/HandlerChain.java0000755000175000017500000001001710613047074031140 0ustar godgod/* * 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 javax.xml.rpc.handler; import java.util.List; import java.util.Map; import javax.xml.rpc.JAXRPCException; /** This interface represents a list of handlers. All elements in the * HandlerChain are of the type javax.xml.rpc.handler.Handler. * * An implementation class for the HandlerChain interface abstracts the policy * and mechanism for the invocation of the registered handlers. * * @author Scott.Stark@jboss.org * @author Rahul Sharma (javadoc) * @version $Revision: 2897 $ */ public interface HandlerChain extends List { /** * Initializes the configuration for a HandlerChain. * @param config Configuration for the initialization of this handler chain * @throws JAXRPCException If any error during initialization */ public void init(Map config); /** * Indicates the end of lifecycle for a HandlerChain. * @throws JAXRPCException If any error during destroy */ public void destroy(); /** * Gets SOAP actor roles registered for this HandlerChain at this SOAP node. The returned array includes the * special SOAP actor next. * @return SOAP Actor roles as URIs */ public String[] getRoles(); /** * Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in which this HandlerChain is to act * for the SOAP message processing at this SOAP node. These roles assumed by a HandlerChain must be invariant during * the processing of an individual SOAP message through the HandlerChain. *

      * A HandlerChain always acts in the role of the special SOAP actor next. Refer to the SOAP specification for the * URI name for this special SOAP actor. There is no need to set this special role using this method. * @param soapActorNames URIs for SOAP actor name */ public void setRoles(String[] soapActorNames); /** * The handleRequest method initiates the request processing for this handler chain. * @param msgContext MessageContext parameter provides access to the request SOAP message. * @return Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method. * @throws JAXRPCException if any processing error happens */ public boolean handleRequest(MessageContext msgContext); /** * The handleResponse method initiates the response processing for this handler chain. * @return Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method. * @throws JAXRPCException if any processing error happens */ public boolean handleResponse(MessageContext msgContext); /** * The handleFault method initiates the SOAP fault processing for this handler chain. * @return Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method. * @throws JAXRPCException if any processing error happens */ public boolean handleFault(MessageContext msgContext); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/HandlerRegistry.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/HandlerRegistry.jav0000755000175000017500000000357010613047074031573 0ustar godgod/* * 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 javax.xml.rpc.handler; import java.io.Serializable; import java.util.List; import javax.xml.namespace.QName; /** This interface provides support for the programmatic configuration of * handlers in a HandlerRegistry. * * A handler chain is registered per service endpoint, as indicated by the * qualified name of a port. The getHandlerChain returns the handler chain * (as a java.util.List) for the specified service endpoint. The returned * handler chain is configured using the java.util.List interface. Each element * in this list is required to be of the Java type * javax.xml.rpc.handler.HandlerInfo. * * @author Scott.Stark@jboss.org * @author Rahul Sharma (javadoc) * @version $Revision: 2897 $ */ public interface HandlerRegistry extends Serializable { public List getHandlerChain(QName portName); public void setHandlerChain(QName portName, List chain); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/GenericHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/GenericHandler.java0000755000175000017500000001033410613047074031474 0ustar godgod/* * 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 javax.xml.rpc.handler; import javax.xml.namespace.QName; /** The GenericHandler class implements the Handler interface. SOAP Message * Handler developers should typically subclass GenericHandler class unless * the Handler class needs another class as a superclass. * * The GenericHandler class is a convenience abstract class that makes writing * Handlers easy. This class provides default implementations of the lifecycle * methods init and destroy and also different handle methods. A Handler * developer should only override methods that it needs to specialize as part * of the derived Handler implementation class. * * @author Scott.Stark@jboss.org * @author Rahul Sharma (javadoc) * @version $Revision: 2897 $ */ public abstract class GenericHandler implements Handler { /** Default constructor. */ protected GenericHandler() { } /** * Gets the header blocks processed by this Handler instance. * * @return Array of QNames of header blocks processed by this handler instance. * QName is the qualified name of the outermost element of the Header block. */ public abstract QName[] getHeaders(); /** * The init method to enable the Handler instance to initialize itself. This method should be overridden if the * derived Handler class needs to specialize implementation of this method. * @param config handler configuration */ public void init(HandlerInfo config) { } /** * The destroy method indicates the end of lifecycle for a Handler instance. This method should be overridden if * the derived Handler class needs to specialize implementation of this method. */ public void destroy() { } /** * The handleRequest method processes the request SOAP message. The default implementation of this method returns true. * This indicates that the handler chain should continue processing of the request SOAP message. * This method should be overridden if the derived Handler class needs to specialize implementation of this method. * @param msgContext the message msgContext * @return true/false */ public boolean handleRequest(MessageContext msgContext) { return true; } /** * The handleResponse method processes the response message. The default implementation of this method returns true. * This indicates that the handler chain should continue processing of the response SOAP message. * This method should be overridden if the derived Handler class needs to specialize implementation of this method. * @param msgContext the message msgContext * @return true/false */ public boolean handleResponse(MessageContext msgContext) { return true; } /** * The handleFault method processes the SOAP faults based on the SOAP message processing model. * The default implementation of this method returns true. This indicates that the handler chain should continue * processing of the SOAP fault. This method should be overridden if the derived Handler class needs to specialize * implementation of this method. * @param msgContext the message msgContext * @return the message msgContext */ public boolean handleFault(MessageContext msgContext) { return true; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/handler/Handler.java0000755000175000017500000002024310613047074030177 0ustar godgod/* * 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 javax.xml.rpc.handler; import javax.xml.namespace.QName; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.soap.SOAPFaultException; /** This interface is required to be implemented by a SOAP message handler. * The handleRequest, handleResponse and handleFault methods for a SOAP message * handler get access to the SOAPMessage from the SOAPMessageContext. The * implementation of these methods can modify the SOAPMessage including the * headers and body elements. * * @author Scott.Stark@jboss.org * @author Rahul Sharma (javadoc) * @version $Revision: 2897 $ */ public interface Handler { /** Gets the header blocks processed by this Handler instance. * * @return Array of QNames of header blocks processed by this handler instance. * QName is the qualified name of the outermost element of the Header block. */ public QName[] getHeaders(); /** The init method enables the Handler instance to initialize itself. The init method passes the handler * configuration as a HandlerInfo instance. The HandlerInfo is used to configure the Handler (for example: setup * access to an external resource or service) during the initialization. * In the init method, the Handler class may get access to any resources * (for example; access to a logging service or database) and maintain these as part of its instance variables. * Note that these instance variables must not have any state specific to the SOAP message processing performed in * the various handle method. * * @param config HandlerInfo configuration for the initialization of this handler * @throws JAXRPCException - if initialization of the handler fails */ public void init(HandlerInfo config) throws JAXRPCException; /** The destroy method indicates the end of lifecycle for a Handler instance. The Handler implementation class should * release its resources and perform cleanup in the implementation of the destroy method. * * @throws JAXRPCException - if there was any error during destroy */ public void destroy() throws JAXRPCException; /** The handleRequest method processes the request message. * * @param msgContext MessageContext parameter provides access to the request message. * @return boolean boolean Indicates the processing mode *

        *
      • Return true to indicate continued processing of the request handler chain. * The HandlerChain takes the responsibility of invoking the next entity. * The next entity may be the next handler in the HandlerChain or if this handler is the last handler in the chain, * the next entity is the service endpoint object.
      • * *
      • Return false to indicate blocking of the request handler chain. In this case, further processing of the request * handler chain is blocked and the target service endpoint is not dispatched. The JAX-RPC runtime system takes the * responsibility of invoking the response handler chain next with the SOAPMessageContext. The Handler implementation * class has the the responsibility of setting the appropriate response SOAP message in either handleRequest and/or * handleResponse method. In the default processing model, the response handler chain starts processing from the same * Handler instance (that returned false) and goes backward in the execution sequence.
      • *
      * * @throws JAXRPCException - indicates a handler-specific runtime error. * If JAXRPCException is thrown by a handleRequest method, the HandlerChain terminates the further processing of this handler chain. * On the server side, the HandlerChain generates a SOAP fault that indicates that the message could not be processed * for reasons not directly attributable to the contents of the message itself but rather to a runtime error during * the processing of the message. On the client side, the exception is propagated to the client code * * @throws SOAPFaultException - indicates a SOAP fault. The Handler implementation class has the the responsibility * of setting the SOAP fault in the SOAP message in either handleRequest and/or handleFault method. * If SOAPFaultException is thrown by a server-side request handler's handleRequest method, the HandlerChain * terminates the further processing of the request handlers in this handler chain and invokes the handleFault * method on the HandlerChain with the SOAP message msgContext. Next, the HandlerChain invokes the handleFault method * on handlers registered in the handler chain, beginning with the Handler instance that threw the exception and * going backward in execution. The client-side request handler's handleRequest method should not throw the SOAPFaultException. */ public boolean handleRequest(MessageContext msgContext) throws JAXRPCException, SOAPFaultException; /** The handleResponse method processes the response SOAP message. * * @param msgContext MessageContext parameter provides access to the response SOAP message * @return boolean Indicates the processing mode *
        *
      • Return true to indicate continued processing ofthe response handler chain. The HandlerChain invokes the handleResponse method on the next Handler in the handler chain.
      • *
      • Return false to indicate blocking of the response handler chain. In this case, no other response handlers in the handler chain are invoked.
      • *
      * @throws JAXRPCException - indicates a handler specific runtime error. If JAXRPCException is thrown by a * handleResponse method, the HandlerChain terminates the further processing of this handler chain. On the server * side, the HandlerChain generates a SOAP fault that indicates that the message could not be processed for reasons * not directly attributable to the contents of the message itself but rather to a runtime error during the processing * of the message. On the client side, the runtime exception is propagated to the client code. */ public boolean handleResponse(MessageContext msgContext); /** The handleFault method processes the SOAP faults based on the SOAP message processing model. * * @param msgContext MessageContext parameter provides access to the SOAP message * @return boolean Indicates the processing mode *
        *
      • Return true to indicate continued processing of SOAP Fault. The HandlerChain invokes the handleFault method * on the next Handler in the handler chain.
      • *
      • Return false to indicate end of the SOAP fault processing. In this case, no other handlers in the handler * chain are invoked.
      • *
      * * @throws JAXRPCException - indicates handler specific runtime error. * If JAXRPCException is thrown by a handleFault method, the HandlerChain terminates the further processing of this * handler chain. On the server side, the HandlerChain generates a SOAP fault that indicates that the message could * not be processed for reasons not directly attributable to the contents of the message itself but rather to a runtime * error during the processing of the message. On the client side, the JAXRPCException is propagated to the client code. */ public boolean handleFault(MessageContext msgContext); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/JAXRPCException.java0000755000175000017500000000310410706573414030055 0ustar godgod/* * 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 javax.xml.rpc; /** * @author Scott.Stark@jboss.org * @version $Revision: 4839 $ */ public class JAXRPCException extends RuntimeException { private static final long serialVersionUID = 5213579554532711730L; public JAXRPCException() { } public JAXRPCException(String message) { super(message); } public JAXRPCException(String message, Throwable cause) { super(message, cause); } public JAXRPCException(Throwable cause) { super(cause); } public Throwable getLinkedCause() { return super.getCause(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/ParameterMode.java0000755000175000017500000000303310613047074027730 0ustar godgod/* * 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 javax.xml.rpc; /** A type-safe enumeration for parameter passing modes. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public class ParameterMode { private String mode; public static final ParameterMode IN = new ParameterMode("IN"); public static final ParameterMode OUT = new ParameterMode("OUT"); public static final ParameterMode INOUT = new ParameterMode("INOUT"); private ParameterMode(String mode) { this.mode = mode; } public String toString() { return mode; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/NamespaceConstants.java0000755000175000017500000000361210613047074030777 0ustar godgod/* * 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 javax.xml.rpc; /** Constants used in JAX-RPC for namespace prefixes and URIs * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public class NamespaceConstants { public static final String NSPREFIX_SOAP_ENVELOPE = "soapenv"; public static final String NSPREFIX_SOAP_ENCODING = "soapenc"; public static final String NSPREFIX_SCHEMA_XSD = "xsd"; public static final String NSPREFIX_SCHEMA_XSI = "xsi"; public static final String NSURI_SOAP_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/"; public static final String NSURI_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; public static final String NSURI_SOAP_NEXT_ACTOR = "http://schemas.xmlsoap.org/soap/actor/next"; public static final String NSURI_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema"; public static final String NSURI_SCHEMA_XSI = "http://www.w3.org/2001/XMLSchema-instance"; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/ServiceFactory.java0000755000175000017500000001765510634204450030146 0ustar godgod/* * 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 javax.xml.rpc; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Properties; import java.util.logging.Logger; import javax.xml.namespace.QName; /** The javax.xml.rpc.ServiceFactory is an abstract class that provides a * factory for the creation of instances of the type javax.xml.rpc.Service. * This abstract class follows the abstract static factory design pattern. * This enables a J2SE based client to create a Service instance in a portable * manner without using the constructor of the Service implementation class. * * The ServiceFactory implementation class is set using the * javax.xml.rpc.ServiceFactory System property. * * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org * @version 1.1 */ public abstract class ServiceFactory { // provide logging private static Logger log = Logger.getLogger(ServiceFactory.class.getName()); // The singlton private static ServiceFactory factory; /** A constant representing the property used to lookup the name of a ServiceFactory implementation class. */ public static final String SERVICEFACTORY_PROPERTY = "javax.xml.rpc.ServiceFactory"; private static final String DEFAULT_SERVICE_FACTORY = "org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl"; private static final String[] alternativeFactories = new String[] {}; protected ServiceFactory() { } /** Gets an instance of the ServiceFactory * Only one copy of a factory exists and is returned to the application each time this method is called. * * The implementation class to be used can be overridden by setting the javax.xml.rpc.ServiceFactory system property. * * @return The ServiceFactory singleton * @throws ServiceException on failure to instantiate the ServiceFactory impl */ public static ServiceFactory newInstance() throws ServiceException { // Create the factory singleton if needed if (factory == null) { PrivilegedAction action = new PropertyAccessAction(SERVICEFACTORY_PROPERTY, DEFAULT_SERVICE_FACTORY); String factoryName = (String)AccessController.doPrivileged(action); ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { try { Class factoryClass = loader.loadClass(factoryName); factory = (ServiceFactory)factoryClass.newInstance(); } catch (ClassNotFoundException e) { // Throw the exception if the user asked for a specific factory if (factoryName.equals(DEFAULT_SERVICE_FACTORY) == false) throw e; for (int i = 0; i < alternativeFactories.length; i++) { factoryName = alternativeFactories[i]; try { Class factoryClass = loader.loadClass(factoryName); return (ServiceFactory)factoryClass.newInstance(); } catch (ClassNotFoundException e1) { log.severe("Cannot load factory: " + factoryName); } } } } catch (Throwable e) { throw new ServiceException("Failed to create factory: " + factoryName, e); } } if (factory == null) throw new ServiceException("Cannot find ServiceFactory implementation"); return factory; } /** * Create a Service instance. * * @param wsdlDocumentLocation URL for the WSDL document location * @param serviceName QName for the service. * @return Service. * @throws ServiceException If any error in creation of the * specified service */ public abstract Service createService(URL wsdlDocumentLocation, QName serviceName) throws ServiceException; /** * Create a Service instance. * * @param serviceName QName for the service * @return Service. * @throws ServiceException If any error in creation of the specified service */ public abstract Service createService(QName serviceName) throws ServiceException; /** Create an instance of the generated service implementation class for a given service interface, if available. * @param serviceInterface Service interface * @return A Service * @throws ServiceException If there is any error while creating the specified service, including the case where a * generated service implementation class cannot be located */ public abstract Service loadService(Class serviceInterface) throws ServiceException; /** * Create an instance of the generated service implementation class for a given service interface, if available. * An implementation may use the provided wsdlDocumentLocation and properties to help locate the generated implementation class. * If no such class is present, a ServiceException will be thrown. * * @param wsdlDocumentLocation URL for the WSDL document location for the service or null * @param serviceInterface Service interface * @param props A set of implementation-specific properties to help locate the generated service implementation class * @return A Service * @throws ServiceException If there is any error while creating the specified service, including the case where a * generated service implementation class cannot be located */ public abstract Service loadService(URL wsdlDocumentLocation, Class serviceInterface, Properties props) throws ServiceException; /** * Create an instance of the generated service implementation class for a given service, if available. * The service is uniquely identified by the wsdlDocumentLocation and serviceName arguments. * An implementation may use the provided properties to help locate the generated implementation class. * If no such class is present, a ServiceException will be thrown. * * @param wsdlDocumentLocation URL for the WSDL document location for the service or null * @param serviceName Qualified name for the service * @param props A set of implementation-specific properties to help locate the generated service implementation class * @return A Service * @throws ServiceException If there is any error while creating the specified service, including the case where a generated service implementation class cannot be located */ public abstract Service loadService(URL wsdlDocumentLocation, QName serviceName, Properties props) throws ServiceException; private static class PropertyAccessAction implements PrivilegedAction { private String name; private String defaultValue; PropertyAccessAction(String name, String defaultValue) { this.name = name; this.defaultValue = defaultValue; } public Object run() { return System.getProperty(name, defaultValue); } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/Call.java0000755000175000017500000003204310613047074026061 0ustar godgod/* * 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 javax.xml.rpc; import java.rmi.RemoteException; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; /** The javax.xml.rpc.Call interface provides support for the dynamic invocation of a service endpoint. * The javax.xml.rpc.Service interface acts as a factory for the creation of Call instances. * * Once a Call instance is created, various setter and getter methods may be used to configure this Call instance. * * @author Scott.Stark@jboss.org * @version $Revision: 2897 $ */ public interface Call { /** Standard property: User name for authentication Type: java.lang.String */ public static final String USERNAME_PROPERTY = "javax.xml.rpc.security.auth.username"; /** Standard property: Password for authentication Type: java.lang.String */ public static final String PASSWORD_PROPERTY = "javax.xml.rpc.security.auth.password"; /** Standard property for operation style. */ public static final String OPERATION_STYLE_PROPERTY = "javax.xml.rpc.soap.operation.style"; /** Standard property for SOAPAction. */ public static final String SOAPACTION_USE_PROPERTY = "javax.xml.rpc.soap.http.soapaction.use"; /** Standard property for SOAPAction. */ public static final String SOAPACTION_URI_PROPERTY = "javax.xml.rpc.soap.http.soapaction.uri"; /** Standard property for encoding Style: Encoding style specified as a namespace URI. */ public static final String ENCODINGSTYLE_URI_PROPERTY = "javax.xml.rpc.encodingstyle.namespace.uri"; /** Standard property: This boolean property is used by a service client to indicate whether or not it wants to participate in a session with a service endpoint. */ public static final String SESSION_MAINTAIN_PROPERTY = "javax.xml.rpc.session.maintain"; /** Indicates whether addParameter and setReturnType methods are to be invoked to specify the parameter and return * type specification for a specific operation. * @param operationName Qualified name of the operation * @return Returns true if the Call implementation class requires addParameter and setReturnType to be invoked in the client code for the specified operation. This method returns false otherwise. * @throws IllegalArgumentException If invalid operation name is specified */ public boolean isParameterAndReturnSpecRequired(QName operationName); /** Adds a parameter type and mode for a specific operation. * Note that the client code may not call any addParameter and setReturnType methods before calling the invoke method. * In this case, the Call implementation class determines the parameter types by using reflection on parameters, * using the WSDL description and configured type mapping registry. * * @param paramName Name of the parameter * @param xmlType XML type of the parameter * @param parameterMode Mode of the parameter-whether ParameterMode.IN, ParameterMode.OUT, or ParameterMode.INOUT * @throws JAXRPCException This exception may be thrown if the method isParameterAndReturnSpecRequired returns false for this operation. * @throws IllegalArgumentException If any illegal parameter name or XML type is specified */ public void addParameter(String paramName, QName xmlType, ParameterMode parameterMode); /** Adds a parameter type and mode for a specific operation. * This method is used to specify the Java type for either OUT or INOUT parameters. * * @param paramName Name of the parameter * @param xmlType XML type of the parameter * @param javaType Java class of the parameter * @param parameterMode Mode of the parameter-whether ParameterMode.IN, ParameterMode.OUT, or ParameterMode.INOUT * @throws JAXRPCException *
        *
      • This exception may be thrown if the method isParameterAndReturnSpecRequired returns false for this operation. *
      • If specified XML type and Java type mapping is not valid. For example, TypeMappingRegistry has no serializers for this mapping. *
      * @throws IllegalArgumentException If any illegal parameter name or XML type is specified * @throws UnsupportedOperationException If this method is not supported */ public void addParameter(String paramName, QName xmlType, Class javaType, ParameterMode parameterMode); /** Gets the XML type of a parameter by name. * * @param paramName - Name of the parameter * @return Returns XML type for the specified parameter */ public QName getParameterTypeByName(String paramName); /** Sets the return type for a specific operation. Invoking setReturnType(null) removes the return type for this Call object. * * @param xmlType XML data type of the return value * @throws JAXRPCException This exception may be thrown when the method isParameterAndReturnSpecRequired returns false. * @throws IllegalArgumentException If an illegal XML type is specified */ public void setReturnType(QName xmlType); /** Sets the return type for a specific operation. * * @param xmlType XML data type of the return value * @param javaType Java Class of the return value * @throws JAXRPCException *
        *
      • This exception may be thrown if this method is invoked when the method isParameterAndReturnSpecRequired returns false. *
      • If XML type and Java type cannot be mapped using the standard type mapping or TypeMapping registry *
      * @throws UnsupportedOperationException If this method is not supported * @throws IllegalArgumentException If an illegal XML type is specified */ public void setReturnType(QName xmlType, Class javaType); /** Gets the return type for a specific operation * * @return Returns the XML type for the return value */ public QName getReturnType(); /** Removes all specified parameters from this Call instance. Note that this method removes only the parameters and * not the return type. The setReturnType(null) is used to remove the return type. * @throws JAXRPCException This exception may be thrown If this method is called when the method isParameterAndReturnSpecRequired returns false for this Call's operation. */ public void removeAllParameters(); /** Gets the name of the operation to be invoked using this Call instance. * @return Qualified name of the operation */ public QName getOperationName(); /** Sets the name of the operation to be invoked using this Call instance. * * @param operationName QName of the operation to be invoked using the Call instance */ public void setOperationName(QName operationName); /** Gets the qualified name of the port type. * @return Qualified name of the port type */ public QName getPortTypeName(); /** Sets the qualified name of the port type. * * @param portType - Qualified name of the port type */ public void setPortTypeName(QName portType); /** Sets the address of the target service endpoint. This address must correspond to the transport * specified in the binding for this Call instance. * * @param address Address of the target service endpoint; specified as an URI */ public void setTargetEndpointAddress(String address); /** Gets the address of a target service endpoint. * @return Address of the target service endpoint as an URI */ public String getTargetEndpointAddress(); /** Sets the value for a named property. * JAX-RPC specification specifies a standard set of properties that may be passed to the Call.setProperty method. * * @param name Name of the property * @param value Value of the property * @throws JAXRPCException *
        *
      • If an optional standard property name is specified, however this Call implementation class does not support the configuration of this property. *
      • If an invalid (or unsupported) property name is specified or if a value of mismatched property type is passed. *
      • If there is any error in the configuration of a valid property. *
      */ public void setProperty(String name, Object value); /** Gets the value of a named property. * * @param name Name of the property * @return Value of the named property * @throws JAXRPCException if an invalid or unsupported property name is passed. */ public Object getProperty(String name); /** Removes a named property. * @param name Name of the property * @throws JAXRPCException if an invalid or unsupported property name is passed. */ public void removeProperty(String name); /** Gets the names of configurable properties supported by this Call object. * @return Iterator for the property names */ public Iterator getPropertyNames(); /** Invokes a specific operation using a synchronous request-response interaction mode. * * @param inputParams Object[]--Parameters for this invocation. This includes only the input params * @return Returns the return value or null * @throws RemoteException if there is any error in the remote method invocation * @throws javax.xml.rpc.soap.SOAPFaultException Indicates a SOAP fault * @throws JAXRPCException *
        *
      • If there is an error in the configuration of the Call object *
      • If inputParams do not match the required parameter set (as specified through the addParameter invocations or in the corresponding WSDL) *
      • If parameters and return type are incorrectly specified *
      */ public Object invoke(Object[] inputParams) throws RemoteException; /** Invokes a specific operation using a synchronous request-response interaction mode. * * @param operationName QName of the operation * @param inputParams Object[]--Parameters for this invocation. This includes only the input params. * @return Return value or null * @throws RemoteException if there is any error in the remote method invocation. * @throws javax.xml.rpc.soap.SOAPFaultException - Indicates a SOAP fault * @throws JAXRPCException *
        *
      • If there is an error in the configuration of the Call object *
      • If inputParams do not match the required parameter set (as specified through the addParameter invocations or in the corresponding WSDL) *
      • If parameters and return type are incorrectly specified *
      */ public Object invoke(QName operationName, Object[] inputParams) throws RemoteException; /** Invokes a remote method using the one-way interaction mode. * The client thread does not normally block waiting for the completion of the server processing for this * remote method invocation. When the protocol in use is SOAP/HTTP, this method should block until an HTTP response * code has been received or an error occurs. This method must not throw any remote exceptions. * This method may throw a JAXRPCException during the processing of the one-way remote call. * * @param inputParams Object[]--Parameters for this invocation. This includes only the input params. * @throws JAXRPCException if there is an error in the configuration of the Call object * (example: a non-void return type has been incorrectly specified for the one-way call) or * if there is any error during the invocation of the one-way remote call */ public void invokeOneWay(Object[] inputParams); /** Returns a Map of {name, value} for the output parameters of the last invoked operation. * The parameter names in the returned Map are of type java.lang.String. * * @return Map Output parameters for the last Call.invoke(). Empty Map is returned if there are no output parameters. * @throws JAXRPCException If this method is invoked for a one-way operation or is invoked before any invoke method has been called. */ public Map getOutputParams(); /** Returns a List values for the output parameters of the last invoked operation. * * @return java.util.List Values for the output parameters. An empty List is returned if there are no output values. * @throws JAXRPCException If this method is invoked for a one-way operation or is invoked before any invoke method has been called. */ public List getOutputValues(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/rpc/Stub.java0000755000175000017500000000755710613047074026137 0ustar godgod/* * 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 javax.xml.rpc; import java.util.Iterator; /** * The interface javax.xml.rpc.Stub is the common base interface for the stub classes. * All generated stub classes are required to implement the javax.xml.rpc.Stub interface. * An instance of a stub class represents a client side proxy or stub instance for the target service endpoint. * * The javax.xml.rpc.Stub interface provides an extensible property mechanism for the dynamic configuration of a stub instance. * * @author Scott.Stark@jboss.org * @author Thomas.Diesler@jboss.org * @version $Revision: 2897 $ */ public interface Stub { /** Standard property: User name for authentication. */ public static final String USERNAME_PROPERTY = "javax.xml.rpc.security.auth.username"; /** Standard property: Password for authentication. */ public static final String PASSWORD_PROPERTY = "javax.xml.rpc.security.auth.password"; /** Standard property: Target service endpoint address. */ public static final String ENDPOINT_ADDRESS_PROPERTY = "javax.xml.rpc.service.endpoint.address"; /** Standard property: This boolean property is used by a service client to indicate whether or not it wants to participate in a session with a service endpoint. */ public static final String SESSION_MAINTAIN_PROPERTY = "javax.xml.rpc.session.maintain"; /** Sets the name and value of a configuration property for this Stub instance. * * If the Stub instances contains a value of the same property, the old value is replaced. * Note that the _setProperty method may not perform validity check on a configured property value. * An example is the standard property for the target service endpoint address that is not checked for validity in * the _setProperty method. In this case, stub configuration errors are detected at the remote method invocation. * * @param name Name of the configuration property * @param value Value of the property * @throws JAXRPCException * If an optional standard property name is specified, however this Stub implementation class does not support the configuration of this property. * If an invalid or unsupported property name is specified or if a value of mismatched property type is passed. * If there is any error in the configuration of a valid property. */ public void _setProperty(String name, Object value); /** Gets the value of a specific configuration property. * @param name Name of the property whose value is to be retrieved * @return Value of the configuration property * @throws JAXRPCException if an invalid or unsupported property name is passed. */ public Object _getProperty(String name); /** Returns an Iterato view of the names of the properties that can be configured on this stub instance. * @return Iterator for the property names of the type java.lang.String */ public Iterator _getPropertyNames(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/0000755000175000017500000000000010755000272024177 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/http/0000755000175000017500000000000010755000271025155 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/http/HTTPException.java0000644000175000017500000000356310706452722030475 0ustar godgod/* * 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 javax.xml.ws.http; // $Id: HTTPException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ /** The HTTPException exception represents a * XML/HTTP fault. * *

      Since there is no standard format for faults or exceptions * in XML/HTTP messaging, only the HTTP status code is captured. * * @since JAX-WS 2.0 **/ public class HTTPException extends javax.xml.ws.ProtocolException { private static final long serialVersionUID = -7126704204037460302L; private int statusCode; /** Constructor for the HTTPException * @param statusCode int for the HTTP status code **/ public HTTPException(int statusCode) { super(); this.statusCode = statusCode; } /** Gets the HTTP status code. * * @return HTTP status code **/ public int getStatusCode() { return statusCode; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/http/HTTPBinding.java0000644000175000017500000000275110676455223030114 0ustar godgod/* * 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 javax.xml.ws.http; // $Id: HTTPBinding.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import javax.xml.ws.Binding; import javax.xml.ws.Binding21; /** The HTTPBinding interface is an * abstraction for the XML/HTTP binding. * * @since JAX-WS 2.0 **/ public interface HTTPBinding extends Binding { /** * A constant representing the identity of the XML/HTTP binding. */ public static final String HTTP_BINDING = "http://www.w3.org/2004/08/wsdl/http"; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/0000755000175000017500000000000010755000271026321 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/soap/0000755000175000017500000000000010755000271027263 5ustar godgod././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/soap/SOAPAddressingElement.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/soap/SOAPAddressi0000644000175000017500000000300010613047074031425 0ustar godgod/* * 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 javax.xml.ws.addressing.soap; //$Id: SOAPAddressingElement.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.soap.SOAPElement; import javax.xml.ws.addressing.AddressingException; import javax.xml.ws.addressing.AddressingType; public interface SOAPAddressingElement extends AddressingType { public void read(SOAPElement element) throws AddressingException; public SOAPElement write(SOAPElement parent, QName name) throws AddressingException; } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/soap/SOAPAddressingBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/soap/SOAPAddressi0000644000175000017500000000236210613047074031437 0ustar godgod/* * 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 javax.xml.ws.addressing.soap; //$Id: SOAPAddressingBuilder.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.ws.addressing.AddressingBuilder; public abstract class SOAPAddressingBuilder extends AddressingBuilder { } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/soap/SOAPAddressingProperties.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/soap/SOAPAddressi0000644000175000017500000000301610613047074031434 0ustar godgod/* * 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 javax.xml.ws.addressing.soap; //$Id: SOAPAddressingProperties.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.soap.SOAPMessage; import javax.xml.ws.addressing.AddressingException; import javax.xml.ws.addressing.AddressingProperties; public interface SOAPAddressingProperties extends AddressingProperties { public void readHeaders(SOAPMessage message) throws AddressingException; public void writeHeaders(SOAPMessage message) throws AddressingException; public void setMu(boolean mu); } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingExcepti0000644000175000017500000000430410706452722031662 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: AddressingException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; public class AddressingException extends WebServiceException { private static final long serialVersionUID = -4470655951999027171L; protected QName code; protected String reason; protected Object detail; protected static AddressingConstants ac = null; protected static String fMessage = null; static { ac = AddressingBuilder.getAddressingBuilder().newAddressingConstants(); } public AddressingException() { } public AddressingException(String message) { super(message); } public AddressingException(Throwable cause) { super(cause); } public AddressingException(String message, Throwable cause) { super(message, cause); } /** * Returns the fault code. * * @return the fault code */ public QName getCode() { return code; } public QName getSubcode() { return null; } public String getReason() { return reason; } public Object getDetail() { return detail; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/EndpointReference.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/EndpointReference0000644000175000017500000000252510613047074031654 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: EndpointReference.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ public interface EndpointReference extends AddressingType, AttributeExtensible, ElementExtensible { public AttributedURI getAddress(); public ReferenceParameters getReferenceParameters(); public Metadata getMetadata(); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/Relationship.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/Relationship.java0000644000175000017500000000247010613047074031635 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: Relationship.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.net.URI; import javax.xml.namespace.QName; public interface Relationship extends AttributeExtensible { public URI getID(); public QName getType(); public void setType(QName type); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingProperties.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingPropert0000644000175000017500000000410210613047074031705 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: AddressingProperties.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.util.Map; import javax.xml.namespace.QName; public interface AddressingProperties extends AddressingType, Map { public AttributedURI getTo(); public void setTo(AttributedURI iri); public AttributedURI getAction(); public void setAction(AttributedURI iri); public AttributedURI getMessageID(); public void setMessageID(AttributedURI iri); public Relationship[] getRelatesTo(); public void setRelatesTo(Relationship[] relationship); public EndpointReference getReplyTo(); public void setReplyTo(EndpointReference ref); public EndpointReference getFaultTo(); public void setFaultTo(EndpointReference ref); public EndpointReference getFrom(); public void setFrom(EndpointReference ref); public ReferenceParameters getReferenceParameters(); public void initializeAsDestination(EndpointReference ref); public void initializeAsReply(AddressingProperties props, boolean isFault); } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/ActionNotSupportedException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/ActionNotSupporte0000644000175000017500000000334410706452722031720 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: ActionNotSupportedException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; public class ActionNotSupportedException extends AddressingException { private static final long serialVersionUID = -2281268200778671820L; static { fMessage = ac.getActionNotSupportedText(); } private String action; protected ActionNotSupportedException() { super(); } public ActionNotSupportedException(String action) { super(fMessage + ": " + action); this.action = action; } public String getAction() { return action; } public QName getSubcode() { return ac.getActioNotSupportedQName(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/InvalidMapException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/InvalidMapExcepti0000644000175000017500000000305410706452722031624 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: InvalidMapException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; public class InvalidMapException extends AddressingException { private static final long serialVersionUID = 1760077070006214469L; static { fMessage = ac.getInvalidMapText(); } protected InvalidMapException() { } public InvalidMapException(QName name) { super(fMessage + ": " + name); } public QName getSubcode() { return ac.getInvalidMapQName(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/FaultAction.java0000644000175000017500000000273510613047074031411 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: FaultAction.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface FaultAction { Class className(); String value() default "##default"; } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/ElementExtensible.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/ElementExtensible0000644000175000017500000000250710613047074031671 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: ElementExtensible.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.util.List; public interface ElementExtensible extends AddressingType { public List getElements(); public void addElement(Object element); public boolean removeElement(Object element); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/Action.java0000644000175000017500000000301710613047074030407 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: Action.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Action { String input() default "##default"; String output() default "##default"; String[] fault() default "##default"; } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/EndpointUnavailableException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/EndpointUnavailab0000644000175000017500000000324010706452722031656 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: EndpointUnavailableException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; public class EndpointUnavailableException extends AddressingException { private static final long serialVersionUID = 4098776568071868541L; static { fMessage = ac.getEndpointUnavailableText(); } public EndpointUnavailableException() { } public EndpointUnavailableException(int retryAfter, String problemIRI) { super(fMessage + ": [retry=" + retryAfter + ",iri=" + problemIRI + "]"); } public QName getSubcode() { return ac.getEndpointUnavailableQName(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingConstants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingConstan0000644000175000017500000000446710613047074031675 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: AddressingConstants.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; public interface AddressingConstants { String getNamespaceURI(); String getNamespacePrefix(); String getWSDLNamespaceURI(); String getWSDLNamespacePrefix(); QName getWSDLExtensibilityQName(); QName getWSDLActionQName(); String getAnonymousURI(); String getNoneURI(); QName getFromQName(); QName getToQName(); QName getReplyToQName(); QName getFaultToQName(); QName getActionQName(); QName getMessageIDQName(); QName getRelationshipReplyQName(); QName getRelatesToQName(); String getRelationshipTypeName(); // [TODO] Add this method QName getReferenceParametersQName(); QName getMetadataQName(); QName getAddressQName(); String getPackageName(); String getIsReferenceParameterName(); QName getInvalidMapQName(); QName getMapRequiredQName(); QName getDestinationUnreachableQName(); QName getActioNotSupportedQName(); QName getEndpointUnavailableQName(); String getDefaultFaultAction(); String getActionNotSupportedText(); String getDestinationUnreachableText(); String getEndpointUnavailableText(); String getInvalidMapText(); String getMapRequiredText(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/Metadata.java0000644000175000017500000000226110613047074030712 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: Metadata.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ public interface Metadata extends AttributeExtensible, ElementExtensible { } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/ReferenceParameters.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/ReferenceParamete0000644000175000017500000000230610613047074031627 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: ReferenceParameters.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ public interface ReferenceParameters extends AttributeExtensible, ElementExtensible { } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/MapRequiredException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/MapRequiredExcept0000644000175000017500000000305710706452722031650 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: MapRequiredException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; public class MapRequiredException extends AddressingException { private static final long serialVersionUID = 7593796661805754938L; static { fMessage = ac.getMapRequiredText(); } public MapRequiredException() { } public MapRequiredException(QName name) { super(fMessage + ": " + name); } public QName getSubcode() { return ac.getMapRequiredQName(); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AttributeExtensible.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AttributeExtensib0000644000175000017500000000255210613047074031722 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: AttributeExtensible.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.util.Map; import javax.xml.namespace.QName; public interface AttributeExtensible extends AddressingType { public Map getAttributes(); public void addAttribute(QName name, String value) throws AddressingException; } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingType.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingType.ja0000644000175000017500000000226110613047074031570 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: AddressingType.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ public interface AddressingType { public String getNamespaceURI(); } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AttributedQName.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AttributedQName.j0000644000175000017500000000246410613047074031540 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: AttributedQName.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; public interface AttributedQName extends AddressingType, AttributeExtensible { public QName getQName(); public void addAttribute(QName name, String value); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AttributedURI.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AttributedURI.jav0000644000175000017500000000250010613047074031514 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: AttributedURI.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.net.URI; import javax.xml.namespace.QName; public interface AttributedURI extends AddressingType, AttributeExtensible { public URI getURI(); public void addAttribute(QName name, String value); } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/AddressingBuilder0000644000175000017500000000675710634204450031656 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: AddressingBuilder.java 3576 2007-06-14 09:23:52Z thomas.diesler@jboss.com $ import static javax.xml.ws.addressing.JAXWSAConstants.ADDRESSING_BUILDER_PROPERTY; import static javax.xml.ws.addressing.JAXWSAConstants.DEFAULT_ADDRESSING_BUILDER; import java.net.URI; import java.net.URISyntaxException; import java.util.logging.Logger; import javax.xml.namespace.QName; public abstract class AddressingBuilder implements AddressingType { // provide logging private static Logger log = Logger.getLogger(AddressingBuilder.class.getName()); protected AddressingBuilder() { } public static AddressingBuilder getAddressingBuilder() { ClassLoader classLoader; try { classLoader = Thread.currentThread().getContextClassLoader(); } catch (Exception x) { throw new AddressingException(x.toString(), x); } String name = null; // Use the system property first try { name = System.getProperty(ADDRESSING_BUILDER_PROPERTY); if (name != null) { return newInstance(name, classLoader); } } catch (Exception e) { log.warning("Could not create and instance of " + name + " trying " + DEFAULT_ADDRESSING_BUILDER); } // default builder return newInstance(DEFAULT_ADDRESSING_BUILDER, classLoader); } private static AddressingBuilder newInstance(String className, ClassLoader classLoader) { try { Class cls; if (classLoader == null) { cls = Class.forName(className); } else { cls = classLoader.loadClass(className); } return (AddressingBuilder)cls.newInstance(); } catch (ClassNotFoundException x) { throw new AddressingException("Provider " + className + " not found", x); } catch (Exception x) { throw new AddressingException("Provider " + className + " could not be instantiated: " + x, x); } } public abstract AttributedURI newURI(URI uri); public abstract AttributedURI newURI(String uri) throws URISyntaxException; public abstract AttributedQName newQName(QName name); public abstract Relationship newRelationship(URI uri); public abstract EndpointReference newEndpointReference(URI uri); public abstract AddressingProperties newAddressingProperties(); public abstract AddressingConstants newAddressingConstants(); } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/JAXWSAConstants.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/JAXWSAConstants.j0000644000175000017500000000607410613047074031402 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: JAXWSAConstants.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPFactory; public class JAXWSAConstants { private JAXWSAConstants() { } public static final String ADDRESSING_BUILDER_PROPERTY = "javax.xml.ws.addressing.AddressingBuilder"; public static final String DEFAULT_ADDRESSING_BUILDER = "org.jboss.ws.extensions.addressing.soap.SOAPAddressingBuilderImpl"; public static final String SOAP11_NAMESPACE_NAME = "http://schemas.xmlsoap.org/soap/envelope/"; public static final String SOAP12_NAMESPACE_NAME = "http://www.w3.org/2003/05/soap-envelope"; public static final QName SOAP11_SENDER_QNAME = new QName(SOAP11_NAMESPACE_NAME, "Client"); public static final QName SOAP11_RECEIVER_QNAME = new QName(SOAP11_NAMESPACE_NAME, "Server"); public static final QName SOAP12_SENDER_QNAME = new QName(SOAP12_NAMESPACE_NAME, "Sender"); public static final QName SOAP12_RECEIVER_QNAME = new QName(SOAP12_NAMESPACE_NAME, "Receiver"); public static final String SOAP11HTTP_ADDRESSING_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?addressing=1.0"; public static final String SOAP12HTTP_ADDRESSING_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?addressing=1.0"; public static final String CLIENT_ADDRESSING_PROPERTIES = "javax.xml.ws.addressing.context"; public static final String CLIENT_ADDRESSING_PROPERTIES_INBOUND = "javax.xml.ws.addressing.context.inbound"; public static final String CLIENT_ADDRESSING_PROPERTIES_OUTBOUND = "javax.xml.ws.addressing.context.outbound"; public static final String SERVER_ADDRESSING_PROPERTIES_INBOUND = "javax.xml.ws.addressing.context.inbound"; public static final String SERVER_ADDRESSING_PROPERTIES_OUTBOUND = "javax.xml.ws.addressing.context.outbound"; public static SOAPFactory SOAP_FACTORY = null; static { try { SOAP_FACTORY = SOAPFactory.newInstance(); } catch (SOAPException e) { } } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/DestinationUnreachableException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/addressing/DestinationUnreac0000644000175000017500000000317610706452722031702 0ustar godgod/* * 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 javax.xml.ws.addressing; //$Id: DestinationUnreachableException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; public class DestinationUnreachableException extends AddressingException { private static final long serialVersionUID = 7420697131368408456L; static { fMessage = ac.getDestinationUnreachableText(); } public DestinationUnreachableException() { } public DestinationUnreachableException(String problemIRI) { super(fMessage + ": " + problemIRI); } public QName getSubcode() { return ac.getDestinationUnreachableQName(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/spi/0000755000175000017500000000000010755000271024771 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/spi/ServiceDelegate21.java0000644000175000017500000005001310676455223031046 0ustar godgod/* * 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 javax.xml.ws.spi; import javax.xml.namespace.QName; import javax.xml.ws.WebServiceFeature; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.xml.ws.EndpointReference; import javax.xml.bind.JAXBContext; /** * @author Heiko.Braun@jboss.com * @version $Revision: 4632 $ */ public abstract class ServiceDelegate21 extends ServiceDelegate { /** * The getPort method returns a proxy. A service client * uses this proxy to invoke operations on the target * service endpoint. The serviceEndpointInterface * specifies the service endpoint interface that is supported by * the created dynamic proxy instance. * * @param portName Qualified name of the service endpoint in * the WSDL service description * @param serviceEndpointInterface Service endpoint interface * supported by the dynamic proxy or instance * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * @return Object Proxy instance that * supports the specified service endpoint * interface * @throws javax.xml.ws.WebServiceException This exception is thrown in the * following cases: *
        *
      • If there is an error in creation of * the proxy *
      • If there is any missing WSDL metadata * as required by this method *
      • If an illegal * serviceEndpointInterface * or portName is specified *
      • If a feature is enabled that is not compatible * with this port or is unsupported. *
      * @see java.lang.reflect.Proxy * @see java.lang.reflect.InvocationHandler * @see javax.xml.ws.WebServiceFeature * * @since JAX-WS 2.1 **/ public abstract T getPort(QName portName, Class serviceEndpointInterface, WebServiceFeature... features); /** * The getPort method returns a proxy. * The parameter endpointReference specifies the * endpoint that will be invoked by the returned proxy. If there * are any reference parameters in the * endpointReference, then those reference * parameters MUST appear as SOAP headers, indicating them to be * reference parameters, on all messages sent to the endpoint. * The endpointReference's address MUST be used * for invocations on the endpoint. * The parameter serviceEndpointInterface specifies * the service endpoint interface that is supported by the * returned proxy. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the proxy accordingly from * the WSDL associated with this Service instance or * from the WSDL Metadata from the endpointReference. * If this Service instance has a WSDL and * the endpointReference * also has a WSDL, then the WSDL from this instance will be used. * If this Service instance does not have a WSDL and * the endpointReference does have a WSDL, then the * WSDL from the endpointReference will be used. * The returned proxy should not be reconfigured by the client. * If this Service instance has a known proxy * port that matches the information contained in * the WSDL, * then that proxy is returned, otherwise a WebServiceException * is thrown. *

      * Calling this method has the same behavior as the following *

          * port = service.getPort(portName, serviceEndpointInterface);
          * 
      * where the portName is retrieved from the * wsaw:EndpontName attribute of the * wsaw:ServiceName element in the * metadata of the endpointReference or from the * serviceEndpointInterface and the WSDL * associated with this Service instance. *
      * See WS-Addressing - WSDL 1.0 * . * * @param endpointReference The EndpointReference * for the target service endpoint that will be invoked by the * returned proxy. * @param serviceEndpointInterface Service endpoint interface. * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * @return Object Proxy instance that supports the * specified service endpoint interface. * @throws javax.xml.ws.WebServiceException *
        *
      • If there is an error during creation * of the proxy. *
      • If there is any missing WSDL metadata * as required by this method. *
      • If the wsaw:EndpointName is * missing from the endpointReference * or does not match a wsdl:Port * in the WSDL metadata. *
      • If the wsaw:ServiceName in the * endpointReference metadata does not * match the serviceName of this * Service instance. *
      • If an invalid * endpointReference * is specified. *
      • If an invalid * serviceEndpointInterface * is specified. *
      • If a feature is enabled that is not compatible * with this port or is unsupported. *
      * * @since JAX-WS 2.1 **/ public abstract T getPort(EndpointReference endpointReference, Class serviceEndpointInterface, WebServiceFeature... features); /** * The getPort method returns a proxy. The parameter * serviceEndpointInterface specifies the service * endpoint interface that is supported by the returned proxy. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the proxy accordingly. * The returned proxy should not be reconfigured by the client. * * @param serviceEndpointInterface Service endpoint interface * @param features An array of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * @return Object instance that supports the * specified service endpoint interface * @throws javax.xml.ws.WebServiceException *
        *
      • If there is an error during creation * of the proxy *
      • If there is any missing WSDL metadata * as required by this method *
      • If an illegal * serviceEndpointInterface * is specified *
      • If a feature is enabled that is not compatible * with this port or is unsupported. *
      * * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public abstract T getPort(Class serviceEndpointInterface, WebServiceFeature... features); /** * Creates a Dispatch instance for use with objects of * the users choosing. * * @param portName Qualified name for the target service endpoint * @param type The class of object used for messages or message * payloads. Implementations are required to support * javax.xml.transform.Source and javax.xml.soap.SOAPMessage. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. Mode MUST be MESSAGE * when type is SOAPMessage. * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * * @return Dispatch instance * @throws javax.xml.ws.WebServiceException If any error in the creation of * the Dispatch object or if a * feature is enabled that is not compatible with * this port or is unsupported. * * @see javax.xml.transform.Source * @see javax.xml.soap.SOAPMessage * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public abstract Dispatch createDispatch(QName portName, Class type, Service.Mode mode, WebServiceFeature... features); /** * Creates a Dispatch instance for use with objects of * the users choosing. If there * are any reference parameters in the * endpointReference, then those reference * parameters MUST appear as SOAP headers, indicating them to be * reference parameters, on all messages sent to the endpoint. * The endpointReference's address MUST be used * for invocations on the endpoint. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the dispatch accordingly from * the WSDL associated with this Service instance or * from the WSDL Metadata from the endpointReference. * If this Service instance has a WSDL and * the endpointReference * also has a WSDL, then the WSDL from this instance will be used. * If this Service instance does not have a WSDL and * the endpointReference does have a WSDL, then the * WSDL from the endpointReference will be used. *

      * This method behaves the same as calling *

          * dispatch = service.createDispatch(portName, type, mode, features);
          * 
      * where the portName is retrieved from the * wsaw:EndpointName attribute of the wsaw:ServiceName * element in the * metadata of the endpointReference. *
      * See WS-Addressing - WSDL 1.0 * . * * @param endpointReference The EndpointReference * for the target service endpoint that will be invoked by the * returned Dispatch object. * @param type The class of object used to messages or message * payloads. Implementations are required to support * javax.xml.transform.Source and javax.xml.soap.SOAPMessage. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. Mode MUST be MESSAGE * when type is SOAPMessage. * @param features An array of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * * @return Dispatch instance * @throws javax.xml.ws.WebServiceException *
        *
      • If there is any missing WSDL metadata * as required by this method. *
      • If the wsaw:ServiceName element * or the wsaw:EndpointName attribute * is missing in the metdata of the * endpointReference. *
      • If the wsaw:ServiceName does not * match the serviceName of this instance. *
      • If the wsaw:EndpointName does not * match a valid wsdl:Port in the WSDL metadata. *
      • If any error in the creation of * the Dispatch object. *
      • if a feature is enabled that is not * compatible with this port or is unsupported. *
      * * @see javax.xml.transform.Source * @see javax.xml.soap.SOAPMessage * @see WebServiceFeature; * * @since JAX-WS 2.1 **/ public abstract Dispatch createDispatch(EndpointReference endpointReference, Class type, Service.Mode mode, WebServiceFeature... features); /** * Creates a Dispatch instance for use with JAXB * generated objects. * * @param portName Qualified name for the target service endpoint * @param context The JAXB context used to marshall and unmarshall * messages or message payloads. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * * @return Dispatch instance * @throws javax.xml.ws.WebServiceException If any error in the creation of * the Dispatch object or if a * feature is enabled that is not compatible with * this port or is unsupported. * * @see javax.xml.bind.JAXBContext * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public abstract Dispatch createDispatch(QName portName, JAXBContext context, Service.Mode mode, WebServiceFeature... features); /** * Creates a Dispatch instance for use with JAXB * generated objects. If there * are any reference parameters in the * endpointReference, then those reference * parameters MUST appear as SOAP headers, indicating them to be * reference parameters, on all messages sent to the endpoint. * The endpointReference's address MUST be used * for invocations on the endpoint. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the dispatch accordingly from * the WSDL associated with this Service instance or * from the WSDL Metadata from the endpointReference. * If this Service instance has a WSDL and * the endpointReference * also has a WSDL, then the WSDL from this instance will be used. * If this Service instance does not have a WSDL and * the endpointReference does have a WSDL, then the * WSDL from the endpointReference will be used. *

      * This method behavies the same as calling *

          * dispatch = service.createDispatch(portName, context, mode, features);
          * 
      * where the portName is retrieved from the * wsaw:EndpointName attribute of the wsaw:ServiceName * element in the * metadata of the endpointReference. *
      * See WS-Addressing - WSDL 1.0 * . * * @param endpointReference The EndpointReference * for the target service endpoint that will be invoked by the * returned Dispatch object. * @param context The JAXB context used to marshall and unmarshall * messages or message payloads. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. * @param features An array of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * * @return Dispatch instance * @throws javax.xml.ws.WebServiceException * @throws javax.xml.ws.WebServiceException *
        *
      • If there is any missing WSDL metadata * as required by this method. *
      • If the wsaw:ServiceName element * or the wsaw:EndpointName attribute * is missing in the metdata of the * endpointReference. *
      • If the wsaw:ServiceName does not * match the serviceName of this instance. *
      • If the wsaw:EndpointName does not * match a valid wsdl:Port in the WSDL metadata. *
      • If any error in the creation of * the Dispatch object. *
      • if a feature is enabled that is not * compatible with this port or is unsupported. *
      * * @see javax.xml.bind.JAXBContext * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public abstract Dispatch createDispatch(EndpointReference endpointReference, JAXBContext context, Service.Mode mode, WebServiceFeature... features); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/spi/ProviderLoader.java0000644000175000017500000001670210676455223030600 0ustar godgod/* * 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 javax.xml.ws.spi; // $Id: ProviderLoader.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Properties; /** * Load the provider using the following algorithm. * * 1. If a resource with the name of META-INF/services/javax.xml.ws.spi.Provider exists, then * its first line, if present, is used as the UTF-8 encoded name of the implementation class. * * 2. If the ${java.home}/lib/jaxws.properties file exists and it is readable by the * java.util.Properties.load(InputStream) method and it contains an entry whose key is * javax.xml.ws.spi.Provider, then the value of that entry is used as the name of the implementation class. * * 3. If a system property with the name javax.xml.ws.spi.Provider is defined, then its value is used * as the name of the implementation class. * * 4. Finally, a default implementation class name is used. * * @author Thomas.Diesler@jboss.com * @since 03-May-2006 */ abstract class ProviderLoader { /** * This method uses the algirithm described above. * * 1. If a resource with the name of META-INF/services/javax.xml.ws.spi.Provider exists, then * its first line, if present, is used as the UTF-8 encoded name of the implementation class. * * 2. If the ${java.home}/lib/jaxws.properties file exists and it is readable by the * java.util.Properties.load(InputStream) method and it contains an entry whose key is * javax.xml.ws.spi.Provider, then the value of that entry is used as the name of the implementation class. * * 3. If a system property with the name javax.xml.ws.spi.Provider is defined, then its value is used * as the name of the implementation class. * * 4. Finally, a default implementation class name is used. */ public static Provider loadProvider(String defaultFactory) { Object factory = null; String factoryName = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); // Use the Services API (as detailed in the JAR specification), if available, to determine the classname. String propertyName = Provider.JAXWSPROVIDER_PROPERTY; String filename = "META-INF/services/" + propertyName; InputStream inStream = loader.getResourceAsStream(filename); if (inStream != null) { try { BufferedReader br = new BufferedReader(new InputStreamReader(inStream, "UTF-8")); factoryName = br.readLine(); br.close(); if (factoryName != null) { Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } // Use the properties file "lib/jaxws.properties" in the JRE directory. // This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. if (factory == null) { PrivilegedAction action = new PropertyAccessAction("java.home"); String javaHome = (String)AccessController.doPrivileged(action); File jaxmFile = new File(javaHome + "/lib/jaxws.properties"); if (jaxmFile.exists()) { try { action = new PropertyFileAccessAction(jaxmFile.getCanonicalPath()); Properties jaxmProperties = (Properties)AccessController.doPrivileged(action); factoryName = jaxmProperties.getProperty(propertyName); if (factoryName != null) { //if(log.isDebugEnabled()) log.debug("Load from " + jaxmFile + ": " + factoryName); Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } } // Use system property if (factory == null) { PrivilegedAction action = new PropertyAccessAction(propertyName); factoryName = (String)AccessController.doPrivileged(action); if (factoryName != null) { try { //if(log.isDebugEnabled()) log.debug("Load from system property: " + factoryName); Class factoryClass = loader.loadClass(factoryName); factory = factoryClass.newInstance(); } catch (Throwable t) { throw new IllegalStateException("Failed to load " + propertyName + ": " + factoryName, t); } } } // Use the default factory implementation class. if (factory == null && defaultFactory != null) { try { //if(log.isDebugEnabled()) log.debug("Load from default: " + factoryName); Class factoryClass = loader.loadClass(defaultFactory); factory = factoryClass.newInstance(); } catch (Throwable t) { throw new IllegalStateException("Failed to load: " + defaultFactory, t); } } return (Provider)factory; } private static class PropertyAccessAction implements PrivilegedAction { private String name; PropertyAccessAction(String name) { this.name = name; } public Object run() { return System.getProperty(name); } } private static class PropertyFileAccessAction implements PrivilegedAction { private String filename; PropertyFileAccessAction(String filename) { this.filename = filename; } public Object run() { try { InputStream inStream = new FileInputStream(filename); Properties props = new Properties(); props.load(inStream); return props; } catch (IOException ex) { throw new SecurityException("Cannot load properties: " + filename, ex); } } } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/spi/Provider.java0000644000175000017500000001154110676455223027445 0ustar godgod/* * 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 javax.xml.ws.spi; // $Id: Provider.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import javax.xml.namespace.QName; import javax.xml.ws.Endpoint; import javax.xml.ws.WebServiceException; /** * Service provider for ServiceDelegate and Endpoint objects. * * @author Thomas.Diesler@jboss.com * @since 03-May-2006 */ public abstract class Provider { public static final String JAXWSPROVIDER_PROPERTY = "javax.xml.ws.spi.Provider"; private static final String DEFAULT_JAXWSPROVIDER = "org.jboss.ws.core.jaxws.spi.ProviderImpl"; /** * Creates a new instance of Provider */ protected Provider() { } /** * * Creates a new provider object. *

      * The algorithm used to locate the provider subclass to use consists * of the following steps: *

      *

        *
      • * If a resource with the name of * META-INF/services/javax.xml.ws.spi.Provider * exists, then its first line, if present, is used as the UTF-8 encoded * name of the implementation class. *
      • *
      • * If the $java.home/lib/jaxws.properties file exists and it is readable by * the java.util.Properties.load(InputStream) method and it contains * an entry whose key is javax.xml.ws.spi.Provider, then the value of * that entry is used as the name of the implementation class. *
      • *
      • * If a system property with the name javax.xml.ws.spi.Provider * is defined, then its value is used as the name of the implementation class. *
      • *
      • * Finally, a default implementation class name is used. *
      • *
      * */ public static Provider provider() { try { return (Provider)ProviderLoader.loadProvider(DEFAULT_JAXWSPROVIDER); } catch (WebServiceException ex) { throw ex; } catch (Exception ex) { throw new WebServiceException("Unable to load Provider: " + ex.getMessage(), ex); } } /** * Creates a service delegate object. *

      * @param wsdlDocumentLocation A URL pointing to the WSDL document * for the service, or null if there isn't one. * @param serviceName The qualified name of the service. * @param serviceClass The service class, which MUST be either * javax.xml.ws.Service or a subclass thereof. * @return The newly created service delegate. */ public abstract ServiceDelegate createServiceDelegate(java.net.URL wsdlDocumentLocation, QName serviceName, Class serviceClass); /** * * Creates an endpoint object with the provided binding and implementation * object. * * @param bindingId A URI specifying the desired binding (e.g. SOAP/HTTP) * @param implementor A service implementation object to which * incoming requests will be dispatched. The corresponding * class MUST be annotated with all the necessary Web service * annotations. * @return The newly created endpoint. */ public abstract Endpoint createEndpoint(String bindingId, Object implementor); /** * Creates and publishes an endpoint object with the specified * address and implementation object. * * @param address A URI specifying the address and transport/protocol * to use. A http: URI MUST result in the SOAP 1.1/HTTP * binding being used. Implementations may support other * URI schemes. * @param implementor A service implementation object to which * incoming requests will be dispatched. The corresponding * class MUST be annotated with all the necessary Web service * annotations. * @return The newly created endpoint. */ public abstract Endpoint createAndPublishEndpoint(String address, Object implementor); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/spi/Provider21.java0000644000175000017500000002356310676455223027617 0ustar godgod/* * 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 javax.xml.ws.spi; import org.w3c.dom.Element; import javax.xml.ws.EndpointReference; import javax.xml.ws.WebServiceFeature; import javax.xml.ws.wsaddressing.W3CEndpointReference; import javax.xml.namespace.QName; import javax.xml.transform.Source; import java.util.List; /** * @author Heiko.Braun@jboss.com * @version $Revision: 4632 $ */ public abstract class Provider21 extends Provider { /** * The getPort method returns a proxy. If there * are any reference parameters in the * endpointReference, then those reference * parameters MUST appear as SOAP headers, indicating them to be * reference parameters, on all messages sent to the endpoint. * The parameter serviceEndpointInterface specifies * the service endpoint interface that is supported by the * returned proxy. * The parameter endpointReference specifies the * endpoint that will be invoked by the returned proxy. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the proxy accordingly from * the WSDL Metadata from the EndpointReference. * * * @param endpointReference the EndpointReference that will * be invoked by the returned proxy. * @param serviceEndpointInterface Service endpoint interface * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * @return Object Proxy instance that supports the * specified service endpoint interface * @throws javax.xml.ws.WebServiceException *

        *
      • If there is an error during creation * of the proxy *
      • If there is any missing WSDL metadata * as required by this method *
      • If this * endpointReference * is illegal *
      • If an illegal * serviceEndpointInterface * is specified *
      • If feature is enabled that is not compatible with * this port or is unsupported. *
      * * @see javax.xml.ws.WebServiceFeature * * @since JAX-WS 2.1 **/ public abstract T getPort(EndpointReference endpointReference, Class serviceEndpointInterface, WebServiceFeature... features); /** * Factory method to create a W3CEndpointReference. * *

      * This method can be used to create a W3CEndpointReference * for any endpoint by specifying the address property along * with any other desired properties. This method * can also be used to create a W3CEndpointReference for * an endpoint that is published by the same Java EE application. * To do so the address property can be provided or this * method can automatically determine the address of * an endpoint that is published by the same Java EE application and is * identified by the serviceName and * portName propeties. If the address is * null and the serviceName and * portName do not identify an endpoint published by the * same Java EE application, a * javax.lang.IllegalArgumentException MUST be thrown. * * @param address Specifies the address of the target endpoint * @param serviceName Qualified name of the service in the WSDL. * @param portName Qualified name of the endpoint in the WSDL. * @param metadata A list of elements that should be added to the * W3CEndpointReference instances wsa:metadata * element. * @param wsdlDocumentLocation URL for the WSDL document location for * the service. * @param referenceParameters Reference parameters to be associated * with the returned EndpointReference instance. * * @return the W3CEndpointReference created from * serviceName, portName, * metadata, wsdlDocumentLocation * and referenceParameters. This method * never returns null. * * @throws javax.lang.IllegalArgumentException *

        *
      • If the address, serviceName and * portName are all null. *
      • If the serviceName service is null and the * portName> is NOT null. *
      • If the address property is null and * the serviceName and portName do not * specify a valid endpoint published by the same Java EE * application. *
      • If the serviceNameis NOT null * and is not present in the specified WSDL. *
      • If the portName port is not null and it * is not present in serviceName service in the WSDL. *
      • If the wsdlDocumentLocation is NOT null * and does not represent a valid WSDL. *
      * @throws javax.xml.ws.WebServiceException If an error occurs while creating the * W3CEndpointReference. * * @since JAX-WS 2.1 */ public abstract W3CEndpointReference createW3CEndpointReference(String address, QName serviceName, QName portName, List metadata, String wsdlDocumentLocation, List referenceParameters); /** * read an EndpointReference from the infoset contained in * eprInfoset. * * @returns the EndpointReference unmarshalled from * eprInfoset. This method never returns null. * * @throws javax.xml.ws.WebServiceException If there is an error creating the * EndpointReference from the specified eprInfoset. * * @throws NullPointerException If the null * eprInfoset value is given. * * @since JAX-WS 2.1 **/ public abstract EndpointReference readEndpointReference(javax.xml.transform.Source eprInfoset); /** * Create an EndpointReference for serviceName * service and portName port from the WSDL wsdlDocumentLocation. The instance * returned will be of type clazz and contain the referenceParameters * reference parameters. This method delegates to the vendor specific * implementation of the {@link javax.xml.ws.spi.Provider#createEndpointReference(Class, javax.xml.namespace.QName, javax.xml.namespace.QName, javax.xml.transform.Source, org.w3c.dom.Element...)} method. * * @param clazz Specifies the type of EndpointReference that MUST be returned. * @param serviceName Qualified name of the service in the WSDL. * @param portName Qualified name of the endpoint in the WSDL. * @param wsdlDocumentLocation URL for the WSDL document location for the service. * @param referenceParameters Reference parameters to be associated with the * returned EndpointReference instance. * * @return the EndpointReference created from serviceName, portName, * wsdlDocumentLocation and referenceParameters. This method * never returns null. * @throws javax.xml.ws.WebServiceException *
        *
      • If the serviceName service is not present in the WSDL. *
      • If the portName port is not present in serviceName service in the WSDL. *
      • If the wsdlDocumentLocation does not represent a valid WSDL. *
      • If an error occurs while creating the EndpointReference. *
      • If the Class clazz is not supported by this implementation. *
      * @throws java.lang.IllegalArgumentException * if any of the clazz, serviceName, portName and wsdlDocumentLocation is null. */ public abstract T createEndpointReference(Class clazz, QName serviceName, QName portName, Source wsdlDocumentLocation, Element... referenceParameters); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/spi/WebServiceFeatureAnnotation.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/spi/WebServiceFeatureAnnotat0000644000175000017500000000514710613047074031627 0ustar godgod/* * 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 javax.xml.ws.spi; // $Id: WebServiceFeatureAnnotation.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.xml.ws.WebServiceFeature; /** * Annotation used to identify other annotations * as a WebServiceFeature. * * Each WebServiceFeature annotation annotated with * this annotation MUST contain an * enabled property of type * boolean with a default value of true. * JAX-WS defines the following * WebServiceFeature annotations, however, an implementation * may define vendors specific annotations for other features. * If a JAX-WS implementation encounters an annotation annotated * with the WebServiceFeatureAnnotation that is does not * recognize/support an error MUST be given. * * @see javax.xml.ws.soap.WSAddressing * @see javax.xml.ws.soap.MTOM * @see javax.xml.ws.RespectBinding * * @since JAX-WS 2.1 */ @Target(ElementType.ANNOTATION_TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface WebServiceFeatureAnnotation { /** * Unique identifier for the WebServiceFeature. This * identifier MUST be unique across all implementations * of JAX-WS. */ String id(); /** * The WebServiceFeature bean that is associated * with the WebServiceFeature annotation */ Class bean(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/spi/ServiceDelegate.java0000644000175000017500000002377710676455223030724 0ustar godgod/* * 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 javax.xml.ws.spi; // $Id: ServiceDelegate.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import java.util.Iterator; import javax.xml.bind.JAXBContext; import javax.xml.namespace.QName; import javax.xml.rpc.ServiceException; import javax.xml.ws.Dispatch; import javax.xml.ws.Service; import javax.xml.ws.WebServiceException; import javax.xml.ws.handler.HandlerResolver; /** * Service delegates are used internally by Service objects * to allow pluggability of JAX-WS implementations. *

      * Every Service object has its own delegate, created using * the javax.xml.ws.Provider#createServiceDelegate method. A Service * object delegates all of its instance methods to its delegate. * * @see javax.xml.ws.Service * @see javax.xml.ws.spi.Provider * * @since JAX-WS 2.0 */ public abstract class ServiceDelegate { protected ServiceDelegate() { } /** * The getPort method returns a proxy. A service client * uses this proxy to invoke operations on the target * service endpoint. The serviceEndpointInterface * specifies the service endpoint interface that is supported by * the created dynamic proxy instance. * * @param portName Qualified name of the service endpoint in * the WSDL service description * @param serviceEndpointInterface Service endpoint interface * supported by the dynamic proxy * @return Object Proxy instance that * supports the specified service endpoint * interface * @throws WebServiceException This exception is thrown in the * following cases: *

        *
      • If there is an error in creation of * the proxy *
      • If there is any missing WSDL metadata * as required by this method *
      • If an illegal * serviceEndpointInterface * or portName is specified *
      * @see java.lang.reflect.Proxy * @see java.lang.reflect.InvocationHandler **/ public abstract T getPort(QName portName, Class serviceEndpointInterface); /** * The getPort method returns a proxy. The parameter * serviceEndpointInterface specifies the service * endpoint interface that is supported by the returned proxy. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the proxy accordingly. * The returned proxy should not be reconfigured by the client. * * @param serviceEndpointInterface Service endpoint interface * @return Object instance that supports the * specified service endpoint interface * @throws WebServiceException *
        *
      • If there is an error during creation * of the proxy *
      • If there is any missing WSDL metadata * as required by this method *
      • If an illegal * serviceEndpointInterface * is specified *
      **/ public abstract T getPort(Class serviceEndpointInterface); /** * Creates a new port for the service. Ports created in this way contain * no WSDL port type information and can only be used for creating * Dispatchinstances. * * @param portName Qualified name for the target service endpoint * @param bindingId A URI identifier of a binding. * @param endpointAddress Address of the target service endpoint as a URI * @throws WebServiceException If any error in the creation of * the port * * @see javax.xml.ws.soap.SOAPBinding#SOAP11HTTP_BINDING * @see javax.xml.ws.soap.SOAPBinding#SOAP12HTTP_BINDING * @see javax.xml.ws.http.HTTPBinding#HTTP_BINDING **/ public abstract void addPort(QName portName, String bindingId, String endpointAddress); /** * Creates a Dispatch instance for use with objects of * the users choosing. * * @param portName Qualified name for the target service endpoint * @param type The class of object used for messages or message * payloads. Implementations are required to support * javax.xml.transform.Source and javax.xml.soap.SOAPMessage. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. Mode MUST be MESSAGE * when type is SOAPMessage. * * @return Dispatch instance * @throws WebServiceException If any error in the creation of * the Dispatch object * @see javax.xml.transform.Source * @see javax.xml.soap.SOAPMessage **/ public abstract Dispatch createDispatch(QName portName, Class type, Service.Mode mode); /** * Creates a Dispatch instance for use with JAXB * generated objects. * * @param portName Qualified name for the target service endpoint * @param context The JAXB context used to marshall and unmarshall * messages or message payloads. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. * * @return Dispatch instance * @throws ServiceException If any error in the creation of * the Dispatch object * * @see javax.xml.bind.JAXBContext **/ public abstract Dispatch createDispatch(QName portName, JAXBContext context, Service.Mode mode); /** * Gets the name of this service. * @return Qualified name of this service **/ public abstract QName getServiceName(); /** * Returns an Iterator for the list of * QNames of service endpoints grouped by this * service * * @return Returns java.util.Iterator with elements * of type javax.xml.namespace.QName * @throws WebServiceException If this Service class does not * have access to the required WSDL metadata **/ public abstract Iterator getPorts(); /** * Gets the location of the WSDL document for this Service. * * @return URL for the location of the WSDL document for * this service **/ public abstract java.net.URL getWSDLDocumentLocation(); /** * Returns the configured handler resolver. * * @return HandlerResolver The HandlerResolver being * used by this Service instance, or null * if there isn't one. **/ public abstract HandlerResolver getHandlerResolver(); /** * Sets the HandlerResolver for this Service * instance. *

      * The handler resolver, if present, will be called once for each * proxy or dispatch instance that is created, and the handler chain * returned by the resolver will be set on the instance. * * @param handlerResolver The HandlerResolver to use * for all subsequently created proxy/dispatch objects. * * @see javax.xml.ws.handler.HandlerResolver **/ public abstract void setHandlerResolver(HandlerResolver handlerResolver); /** * Returns the executor for this Serviceinstance. * * The executor is used for all asynchronous invocations that * require callbacks. * * @return The java.util.concurrent.Executor to be * used to invoke a callback. * * @see java.util.concurrent.Executor **/ public abstract java.util.concurrent.Executor getExecutor(); /** * Sets the executor for this Service instance. * * The executor is used for all asynchronous invocations that * require callbacks. * * @param executor The java.util.concurrent.Executor * to be used to invoke a callback. * * @throws SecurityException If the instance does not support * setting an executor for security reasons (e.g. the * necessary permissions are missing). * * @see java.util.concurrent.Executor **/ public abstract void setExecutor(java.util.concurrent.Executor executor); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/wsaddressing/0000755000175000017500000000000010755000271026673 5ustar godgod././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/wsaddressing/W3CEndpointRefe0000644000175000017500000002621410676455223031537 0ustar godgod/* * 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 javax.xml.ws.wsaddressing; // $Id: W3CEndpointReferenceBuilder.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; import javax.xml.ws.spi.Provider; import javax.xml.ws.spi.Provider21; import org.w3c.dom.Element; /** * This class is used to build W3CEndpointReference * instances. The intended use of this clsss is for * an application component, for example a factory component, * to create an W3CEndpointReference for a * web service endpoint published by the same * Java EE application. It can also be used to create * W3CEndpointReferences for an Java SE based * endpoint by providing the address property. *

      * When creating a W3CEndpointReference for an * endpoint that is not published by the same Java EE application, * the address property MUST be specified. *

      * When creating a W3CEndpointReference for an endpoint * published by the same Java EE application, the address * property MAY be null but then the serviceName * and endpointName MUST specify an endpoint published by * the same Java EE application. *

      * When the wsdlDocumentLocation is specified it MUST refer * to a valid WSDL document and the serviceName and * endpointName (if specified) MUST match a service and port * in the WSDL document. * * @since JAX-WS 2.1 */ public final class W3CEndpointReferenceBuilder { public W3CEndpointReferenceBuilder() { referenceParameters = new ArrayList(); metadata = new ArrayList(); } /** * Sets the address to the * W3CEndpointReference instance's * wsa:Address. *

      * The address MUST be set to a non-null * value when building a W3CEndpointReference for a * web service endpoint that is not published by the same * Java EE application or when running on Java SE. * * @param address The address of the endpoint to be targeted * by the returned W3CEndpointReference. * * @return A W3CEndpointReferenceBuilder instance with * the address set to the wsa:Address. */ public W3CEndpointReferenceBuilder address(String address) { this.address = address; return this; } /** * Sets the serviceName as the * wsaw:ServiceName element in the * wsa:Metadata element. * * @param serviceName The service name of the endpoint to be targeted * by the returned W3CEndpointReference. This property * may also be used with the endpointName (portName) * property to lookup the address of a web service * endpoint that is published by the same Java EE application. * * @return A W3CEndpointReferenceBuilder instance with * the serviceName element added to the * wsa:Metadata element. * */ public W3CEndpointReferenceBuilder serviceName(QName serviceName) { this.serviceName = serviceName; return this; } /** * Sets the endpointName as and attribute on * wsaw:ServiceName element in the * wsa:Metadata element. This method can only * be called after the {@link #serviceName} method has been called. * * @param endpointName The name of the endpoint to be targeted * by the returned W3CEndpointReference. The * endpointName (portName) property may also be * used with the serviceName property to lookup * the address of a web service * endpoint published by the same Java EE application. * * @return A W3CEndpointReferenceBuilder instance with * the endpointName atrribute added to the * wsaw:ServiceName element in the * wsa:Metadata element. * * @throws javax.lang.IllegalStateException If the serviceName has not * been set. */ public W3CEndpointReferenceBuilder endpointName(QName endpointName) { if (serviceName == null) { throw new IllegalStateException("The W3CEndpointReferenceBuilder's serviceName must be set before setting the endpointName: "+endpointName); } this.endpointName = endpointName; return this; } /** * Sets the wsdlDocumentLocation that will be inlined * in the W3CEndpointReferenc instance's * wsa:Metadata. * * @param wsdlDocumentLocation The location of the WSDL document to * be inlined in the wsa:Metadata of the * W3CEndpointReference. * * @return A W3CEndpointReferenceBuilder instance with * the wsdlDocumentLocation that is to be inlined. * */ public W3CEndpointReferenceBuilder wsdlDocumentLocation(String wsdlDocumentLocation) { this.wsdlDocumentLocation = wsdlDocumentLocation; return this; } /** * Adds the referenceParameter to the * W3CEndpointReference instance * wsa:ReferenceParameters element. * * @param referenceParameter The element to be added to the * wsa:ReferenceParameters element. * * @return A W3CEndpointReferenceBuilder instance with * the referenceParameter added to the * wsa:ReferenceParameters element. * * @throws java.lang.IllegalArgumentException if referenceParameter * is null. */ public W3CEndpointReferenceBuilder referenceParameter(Element referenceParameter) { if (referenceParameter == null) throw new java.lang.IllegalArgumentException("The referenceParameter cannot be null."); referenceParameters.add(referenceParameter); return this; } /** * Adds the metadataElement to the * W3CEndpointReference instance's * wsa:Metadata element. * * @param metadataElement The element to be added to the * wsa:Metadata element. * * @return A W3CEndpointReferenceBuilder instance with * the metadataElement added to the * wsa:Metadata element. * * @throws java.lang.IllegalArgumentException if metadataElement * is null. */ public W3CEndpointReferenceBuilder metadata(Element metadataElement) { if (metadataElement == null) throw new java.lang.IllegalArgumentException("The metadataElement cannot be null."); metadata.add(metadataElement); return this; } /** * Builds a W3CEndpointReference from the accumulated * properties set on this W3CEndpointReferenceBuilder * instance. *

      * This method can be used to create a W3CEndpointReference * for any endpoint by specifying the address property along * with any other desired properties. This method * can also be used to create a W3CEndpointReference for * an endpoint that is published by the same Java EE application. * This method can automatically determine the address of * an endpoint published by the same Java EE application that is identified by the * serviceName and * endpointName properties. If the address is * null and the serviceName and * endpointName * do not identify an endpoint published by the same Java EE application, a * javax.lang.IllegalStateException MUST be thrown. * * * @return W3CEndpointReference from the accumulated * properties set on this W3CEndpointReferenceBuilder * instance. This method never returns null. * * @throws javax.lang.IllegalStateException *

        *
      • If the address, serviceName and * endpointName are all null. *
      • If the serviceName service is null and the * endpointName is NOT null. *
      • If the address property is null and * the serviceName and endpointName do not * specify a valid endpoint published by the same Java EE * application. *
      • If the serviceNameis NOT null * and is not present in the specified WSDL. *
      • If the endpointName port is not null and it * is not present in serviceName service in the WSDL. *
      • If the wsdlDocumentLocation is NOT null Pr * and does not represent a valid WSDL. *
      * @throws WebServiceException If an error occurs while creating the * W3CEndpointReference. * */ public W3CEndpointReference build() { return ((Provider21)Provider.provider()).createW3CEndpointReference(address, serviceName, endpointName, metadata, wsdlDocumentLocation, referenceParameters); } private String address; private List referenceParameters; private List metadata; private QName serviceName; private QName endpointName; private String wsdlDocumentLocation; } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/wsaddressing/BindingProvider21.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/wsaddressing/BindingProvider0000644000175000017500000000751210676430372031723 0ustar godgod/* * 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 javax.xml.ws.wsaddressing; import javax.xml.ws.BindingProvider; import javax.xml.ws.EndpointReference; /** * @author Heiko.Braun@jboss.com * @version $Revision: 4630 $ */ public interface BindingProvider21 extends BindingProvider { /** * Returns the EndpointReference associated with * this BindingProvider instance. *

      * If the Binding for this bindingProvider is * either SOAP1.1/HTTP or SOAP1.2/HTTP, then a * W3CEndpointReference MUST be returned. * If the returned EndpointReference is a * W3CEndpointReference it MUST contain * the wsaw:ServiceName element and the * wsaw:EndpointName attribute on the * wsaw:ServiceName. It SHOULD contain * the embedded WSDL in the wsa:Metadata element * if there is an associated WSDL. The * wsaw:InterfaceName MAY also be present. *
      * See * WS-Addressing - WSDL 1.0. * * @return EndpointReference of the target endpoint associated with this * BindingProvider instance. * * @throws java.lang.UnsupportedOperationException If this * BindingProvider uses the XML/HTTP binding. * * @see W3CEndpointReference * * @since JAX-WS 2.1 */ public EndpointReference getEndpointReference(); /** * Returns the EndpointReference associated with * this BindingProvider instance. The instance * returned will be of type clazz. *

      * If the returned EndpointReference is a * W3CEndpointReference it MUST contain * the wsaw:ServiceName element and the * wsaw:EndpointName attribute on the * wsaw:ServiceName. It SHOULD contain * the embedded WSDL in the wsa:Metadata element * if there is an associated WSDL. The * wsaw:InterfaceName MAY also be present. *
      * See * WS-Addressing - WSDL 1.0. * * @param clazz Specifies the type of EndpointReference * that MUST be returned. * @return EndpointReference of the target endpoint associated with this * BindingProvider instance. MUST be of type * clazz. * @throws javax.xml.ws.WebServiceException If the Class clazz * is not supported by this implementation. * @throws java.lang.UnsupportedOperationException If this * BindingProvider uses the XML/HTTP binding. * * @since JAX-WS 2.1 */ public T getEndpointReference(Class clazz); } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/wsaddressing/W3CEndpointReference.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/wsaddressing/W3CEndpointRefe0000644000175000017500000001244410644464306031534 0ustar godgod/* * 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 javax.xml.ws.wsaddressing; // $Id: W3CEndpointReference.java 3828 2007-07-09 16:56:38Z heiko.braun@jboss.com $ import java.util.List; import java.util.Map; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.namespace.QName; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.ws.EndpointReference; import javax.xml.ws.WebServiceException; import org.w3c.dom.Element; import org.jboss.ws.core.jaxws.JAXBContextFactory; /** * This class represents a W3C Addressing EndpointReferece which is * a remote reference to a web service endpoint that supports the * W3C WS-Addressing 1.0 - Core Recommendation. *

      * Developers should use this class in their SEIs if they want to * pass/return endpoint references that represent the W3C WS-Addressing * recommendation. *

      * JAXB will use the JAXB annotations and bind this class to XML infoset * that is consistent with that defined by WS-Addressing. See * * WS-Addressing * for more information on WS-Addressing EndpointReferences. * * @since JAX-WS 2.1 */ // XmlRootElement allows this class to be marshalled on its own @XmlRootElement(name="EndpointReference",namespace=W3CEndpointReference.NS) @XmlType(name="EndpointReferenceType",namespace=W3CEndpointReference.NS) public final class W3CEndpointReference extends EndpointReference { private final static JAXBContext w3cjc = getW3CJaxbContext(); protected W3CEndpointReference() { } /** * construct an EPR from infoset representation * * @param source A source object containing valid XmlInfoset * instance consistent with the W3C WS-Addressing Core * recommendation. * * @throws WebServiceException * If the source does NOT contain a valid W3C WS-Addressing * EndpointReference. * @throws NullPointerException * If the null source value is given */ public W3CEndpointReference(Source source) { try { W3CEndpointReference epr = w3cjc.createUnmarshaller().unmarshal(source,W3CEndpointReference.class).getValue(); this.address = epr.address; this.metadata = epr.metadata; this.referenceParameters = epr.referenceParameters; } catch (JAXBException e) { throw new WebServiceException("Error unmarshalling W3CEndpointReference " ,e); } catch (ClassCastException e) { throw new WebServiceException("Source did not contain W3CEndpointReference", e); } } /** * {@inheritDoc} */ public void writeTo(Result result){ try { Marshaller marshaller = w3cjc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); marshaller.marshal(this, result); } catch (JAXBException e) { throw new WebServiceException("Error marshalling W3CEndpointReference. ", e); } } private static JAXBContext getW3CJaxbContext() { return JAXBContextFactory.newInstance().createContext(new Class[] { W3CEndpointReference.class}); } // private but necessary properties for databinding @XmlElement(name="Address",namespace=NS) private Address address; @XmlElement(name="ReferenceParameters",namespace=NS) private Elements referenceParameters; @XmlElement(name="Metadata",namespace=NS) private Elements metadata; @XmlAnyAttribute Map attributes; @XmlAnyElement List elements; private static class Address { protected Address() {} @XmlValue String uri; @XmlAnyAttribute Map attributes; } private static class Elements { protected Elements() {} @XmlAnyElement List elements; @XmlAnyAttribute Map attributes; } protected static final String NS = "http://www.w3.org/2005/08/addressing"; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/EndpointReference.java0000644000175000017500000001757010676455223030467 0ustar godgod/* * 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 javax.xml.ws; // $Id: EndpointReference.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import java.io.StringWriter; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamResult; import javax.xml.ws.spi.Provider; import javax.xml.ws.spi.Provider21; import javax.xml.ws.wsaddressing.W3CEndpointReference; /** * This class represents an WS-Addressing EndpointReference * which is a remote reference to a web service endpoint. * See * WS-Addressing * for more information on WS-Addressing EndpointReferences. *

      * This class is immutable as the typical web service developer * need not be concerned with its contents. The web service * developer should use this class strictly as a mechanism to * reference a remote web service endpoint. See the {@link Service} APIs * that clients can use to that utilize an EndpointReference. * See the {@link javax.xml.ws.Endpoint}, and * {@link javax.xml.ws.BindingProvider} APIs on how * EndpointReferences can be created for published * endpoints. *

      * Concrete implementations of this class will represent * an EndpointReference for a particular version of Addressing. * For example the {@link W3CEndpointReference} is for use * with W3C WS-Addressing 1.0 - Core Recommendation. * If JAX-WS implementors need to support different versions * of addressing, they should write their own * EndpointReference subclass for that version. * This will allow a JAX-WS implementation to createEndpointReference * vendor specific EndpointReferences that that * vendor can use to flag a different version of * addressing. *

      * Web service developers that wish to pass or return * EndpointReferences in Java methods in an * SEI should use * concrete instances of an EndpointReference such * as the W3CEndpointReferendce. This way the * schema mapped from the SEI will be more descriptive of the * type of endpoint reference being passed. *

      * JAX-WS implementors are expected to extract the XML infoset * from an EndpointReferece using the * {@link EndpointReference#writeTo} * method. *

      * JAXB will bind this class to xs:anyType. If a better binding * is desired, web services developers should use a concrete * subclass such as {@link W3CEndpointReference}. * * @see W3CEndpointReference * @see Service * @since JAX-WS 2.1 */ //@XmlTransient // to treat this class like Object as far as databinding is concerned (proposed JAXB 2.1 feature) public abstract class EndpointReference { // //Default constructor to be only called by derived types. // protected EndpointReference() { }; /** * Factory method to read an EndpointReference from the infoset contained in * eprInfoset. This method delegates to the vendor specific * implementation of the {@link javax.xml.ws.spi.Provider#readEndpointReference} method. * * @param eprInfoset The EndpointReference infoset to be unmarshalled * * @return the EndpointReference unmarshalled from eprInfoset * never null * @throws WebServiceException * if an error occurs while creating the * EndpointReference from the eprInfoset * @throws java.lang.IllegalArgumentException * if the null eprInfoset value is given. */ public static EndpointReference readFrom(Source eprInfoset) { return ((Provider21)Provider.provider()).readEndpointReference(eprInfoset); } /** * write this EndpointReference to the specified infoset format * @throws WebServiceException * if there is an error writing the * EndpointReference to the specified result. * * @throws java.lang.IllegalArgumentException * If the null result value is given. */ public abstract void writeTo(Result result); /** * The getPort method returns a proxy. If there * are any reference parameters in the * EndpointReference instance, then those reference * parameters MUST appear as SOAP headers, indicating them to be * reference parameters, on all messages sent to the endpoint. * The parameter serviceEndpointInterface specifies * the service endpoint interface that is supported by the * returned proxy. * The EndpointReference instance specifies the * endpoint that will be invoked by the returned proxy. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the proxy accordingly from * the WSDL Metadata from this EndpointReference or from * annotations on the serviceEndpointInterface. *

      * Because this port is not created from a Service object, handlers * will not automatically be configured, and the HandlerResolver * and Executor cannot be get or set for this port. The * BindingProvider().getBinding().setHandlerChain() * method can be used to manually configure handlers for this port. * * * @param serviceEndpointInterface Service endpoint interface * @param features An array of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * @return Object Proxy instance that supports the * specified service endpoint interface * @throws WebServiceException *

        *
      • If there is an error during creation * of the proxy *
      • If there is any missing WSDL metadata * as required by this method *
      • If this * endpointReference * is invalid *
      • If an illegal * serviceEndpointInterface * is specified *
      • If feature is enabled that is not compatible with * this port or is unsupported. *
      * * @see java.lang.reflect.Proxy * @see WebServiceFeature **/ public T getPort(Class serviceEndpointInterface, WebServiceFeature... features) { return ((Provider21)Provider.provider()).getPort(this, serviceEndpointInterface, features); } /** * Displays EPR infoset for debugging convenience. */ public String toString() { StringWriter w = new StringWriter(); writeTo(new StreamResult(w)); return w.toString(); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Service.java0000644000175000017500000003120510676455223026457 0ustar godgod/* * 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 javax.xml.ws; // $Id: Service.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import javax.xml.bind.JAXBContext; import javax.xml.namespace.QName; import javax.xml.ws.handler.HandlerResolver; import javax.xml.ws.spi.Provider; import javax.xml.ws.spi.ServiceDelegate; import javax.xml.ws.spi.ServiceDelegate21; import javax.xml.ws.spi.Provider21; import java.net.URL; import java.util.Iterator; /** * Service objects provide the client view of a Web service. *

      Service acts as a factory of the following: *

        *
      • Proxies for a target service endpoint. *
      • Instances of javax.xml.ws.Dispatch for * dynamic message-oriented invocation of a remote * operation. *
      • * *

        The ports available on a service can be enumerated using the * getPorts method. Alternatively, you can pass a * service endpoint interface to the unary getPort method * and let the runtime select a compatible port. * *

        Handler chains for all the objects created by a Service * can be set by means of a HandlerResolver. * *

        An Executor may be set on the service in order * to gain better control over the threads used to dispatch asynchronous * callbacks. For instance, thread pooling with certain parameters * can be enabled by creating a ThreadPoolExecutor and * registering it with the service. * * @since JAX-WS 2.0 * * @see javax.xml.ws.spi.Provider * @see javax.xml.ws.handler.HandlerResolver * @see java.util.concurrent.Executor **/ public class Service { ServiceDelegate21 delegate; /** * The orientation of a dynamic client or service. MESSAGE provides * access to entire protocol message, PAYLOAD to protocol message * payload only. **/ public enum Mode { MESSAGE, PAYLOAD }; protected Service(java.net.URL wsdlDocumentLocation, QName serviceName) { delegate = (ServiceDelegate21)Provider.provider().createServiceDelegate(wsdlDocumentLocation, serviceName, this.getClass()); } /** * The getPort method returns a proxy. A service client * uses this proxy to invoke operations on the target * service endpoint. The serviceEndpointInterface * specifies the service endpoint interface that is supported by * the created dynamic proxy instance. * * @param portName Qualified name of the service endpoint in * the WSDL service description. * @param serviceEndpointInterface Service endpoint interface * supported by the dynamic proxy instance. * @return Object Proxy instance that * supports the specified service endpoint * interface. * @throws WebServiceException This exception is thrown in the * following cases: *

          *
        • If there is an error in creation of * the proxy. *
        • If there is any missing WSDL metadata * as required by this method. *
        • If an illegal * serviceEndpointInterface * or portName is specified. *
        * @see java.lang.reflect.Proxy * @see java.lang.reflect.InvocationHandler **/ public T getPort(QName portName, Class serviceEndpointInterface) { return delegate.getPort(portName, serviceEndpointInterface); } /** * The getPort method returns a proxy. The parameter * serviceEndpointInterface specifies the service * endpoint interface that is supported by the returned proxy. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the proxy accordingly. * The returned proxy should not be reconfigured by the client. * * @param serviceEndpointInterface Service endpoint interface. * @return Object instance that supports the * specified service endpoint interface. * @throws WebServiceException *
          *
        • If there is an error during creation * of the proxy. *
        • If there is any missing WSDL metadata * as required by this method. *
        • If an illegal. * serviceEndpointInterface * is specified. *
        **/ public T getPort(Class serviceEndpointInterface) { return delegate.getPort(serviceEndpointInterface); } /** * Creates a new port for the service. Ports created in this way contain * no WSDL port type information and can only be used for creating * Dispatchinstances. * * @param portName Qualified name for the target service endpoint. * @param bindingId A String identifier of a binding. * @param endpointAddress Address of the target service endpoint as a URI. * @throws WebServiceException If any error in the creation of * the port. * * @see javax.xml.ws.soap.SOAPBinding#SOAP11HTTP_BINDING * @see javax.xml.ws.soap.SOAPBinding#SOAP12HTTP_BINDING * @see javax.xml.ws.http.HTTPBinding#HTTP_BINDING **/ public void addPort(QName portName, String bindingId, String endpointAddress) { delegate.addPort(portName, bindingId, endpointAddress); } /** * Creates a Dispatch instance for use with objects of * the users choosing. * * @param portName Qualified name for the target service endpoint * @param type The class of object used for messages or message * payloads. Implementations are required to support * javax.xml.transform.Source, javax.xml.soap.SOAPMessage * and javax.activation.DataSource, depending on * the binding in use. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. Mode MUST be MESSAGE * when type is SOAPMessage. * * @return Dispatch instance. * @throws WebServiceException If any error in the creation of * the Dispatch object. * * @see javax.xml.transform.Source * @see javax.xml.soap.SOAPMessage **/ public Dispatch createDispatch(QName portName, Class type, Mode mode) { return delegate.createDispatch(portName, type, mode); } /** * Creates a Dispatch instance for use with JAXB * generated objects. * * @param portName Qualified name for the target service endpoint * @param context The JAXB context used to marshall and unmarshall * messages or message payloads. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. * * @return Dispatch instance. * @throws WebServiceException If any error in the creation of * the Dispatch object. * * @see javax.xml.bind.JAXBContext **/ public Dispatch createDispatch(QName portName, JAXBContext context, Mode mode) { return delegate.createDispatch(portName, context, mode); } /** * Gets the name of this service. * @return Qualified name of this service **/ public QName getServiceName() { return delegate.getServiceName(); } /** * Returns an Iterator for the list of * QNames of service endpoints grouped by this * service * * @return Returns java.util.Iterator with elements * of type javax.xml.namespace.QName. * @throws WebServiceException If this Service class does not * have access to the required WSDL metadata. **/ public Iterator getPorts() { return delegate.getPorts(); } /** * Gets the location of the WSDL document for this Service. * * @return URL for the location of the WSDL document for * this service. **/ public java.net.URL getWSDLDocumentLocation() { return delegate.getWSDLDocumentLocation(); } /** * Returns the configured handler resolver. * * @return HandlerResolver The HandlerResolver being * used by this Service instance, or null * if there isn't one. **/ public HandlerResolver getHandlerResolver() { return delegate.getHandlerResolver(); } /** * Sets the HandlerResolver for this Service * instance. *

        * The handler resolver, if present, will be called once for each * proxy or dispatch instance that is created, and the handler chain * returned by the resolver will be set on the instance. * * @param handlerResolver The HandlerResolver to use * for all subsequently created proxy/dispatch objects. * * @see javax.xml.ws.handler.HandlerResolver **/ public void setHandlerResolver(HandlerResolver handlerResolver) { delegate.setHandlerResolver(handlerResolver); } /** * Returns the executor for this Serviceinstance. * * The executor is used for all asynchronous invocations that * require callbacks. * * @return The java.util.concurrent.Executor to be * used to invoke a callback. * * @see java.util.concurrent.Executor **/ public java.util.concurrent.Executor getExecutor() { return delegate.getExecutor(); } /** * Sets the executor for this Service instance. * * The executor is used for all asynchronous invocations that * require callbacks. * * @param executor The java.util.concurrent.Executor * to be used to invoke a callback. * * @throws SecurityException If the instance does not support * setting an executor for security reasons (e.g. the * necessary permissions are missing). * * @see java.util.concurrent.Executor **/ public void setExecutor(java.util.concurrent.Executor executor) { delegate.setExecutor(executor); } /** * Create a Service instance. * * The specified WSDL document location and service qualified name MUST * uniquely identify a wsdl:service element. * * @param wsdlLocation URL for the WSDL document location * for the service * @param serviceName QName for the service * @throws WebServiceException If any error in creation of the * specified service. **/ public static Service create(URL wsdlLocation, QName serviceName) { return new Service(wsdlLocation, serviceName); } /** * Create a Service instance. * * @param serviceName QName for the service * @throws WebServiceException If any error in creation of the * specified service */ public static Service create(QName serviceName) { return create(null, serviceName); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Service21.java0000644000175000017500000005040410676430372026622 0ustar godgod/* * 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 javax.xml.ws; import javax.xml.namespace.QName; import javax.xml.bind.JAXBContext; import java.net.URL; /** * @author Heiko.Braun@jboss.com * @version $Revision: 4630 $ */ public abstract class Service21 extends Service { protected Service21(URL wsdlDocumentLocation, QName serviceName) { super(wsdlDocumentLocation, serviceName); } /** * Creates a Dispatch instance for use with objects of * the users choosing. If there * are any reference parameters in the * endpointReference, then those reference * parameters MUST appear as SOAP headers, indicating them to be * reference parameters, on all messages sent to the endpoint. * The endpointReference's address MUST be used * for invocations on the endpoint. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the dispatch accordingly from * the WSDL associated with this Service instance or * from the WSDL Metadata from the endpointReference. * If this Service instance has a WSDL and * the endpointReference * also has a WSDL, then the WSDL from this instance will be used. * If this Service instance does not have a WSDL and * the endpointReference does have a WSDL, then the * WSDL from the endpointReference will be used. *

        * This method behaves the same as calling *

               * dispatch = service.createDispatch(portName, type, mode, features);
               * 
        * where the portName is retrieved from the * wsaw:EndpointName attribute of the wsaw:ServiceName * element in the * metadata of the endpointReference. *
        * See WS-Addressing - WSDL 1.0 * . * * @param endpointReference The EndpointReference * for the target service endpoint that will be invoked by the * returned Dispatch object. * @param type The class of object used to messages or message * payloads. Implementations are required to support * javax.xml.transform.Source and javax.xml.soap.SOAPMessage. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. Mode MUST be MESSAGE * when type is SOAPMessage. * @param features An array of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * * @return Dispatch instance * @throws WebServiceException *
          *
        • If there is any missing WSDL metadata * as required by this method. *
        • If the wsaw:ServiceName element * or the wsaw:EndpointName attribute * is missing in the metdata of the * endpointReference. *
        • If the wsaw:ServiceName does not * match the serviceName of this instance. *
        • If the wsaw:EndpointName does not * match a valid wsdl:Port in the WSDL metadata. *
        • If any error in the creation of * the Dispatch object. *
        • if a feature is enabled that is not * compatible with this port or is unsupported. *
        * * @see javax.xml.transform.Source * @see javax.xml.soap.SOAPMessage * @see WebServiceFeature; * * @since JAX-WS 2.1 **/ public Dispatch createDispatch(EndpointReference endpointReference, Class type, Service.Mode mode, WebServiceFeature... features) { return delegate.createDispatch(endpointReference, type, mode, features); } /** * Creates a Dispatch instance for use with JAXB * generated objects. If there * are any reference parameters in the * endpointReference, then those reference * parameters MUST appear as SOAP headers, indicating them to be * reference parameters, on all messages sent to the endpoint. * The endpointReference's address MUST be used * for invocations on the endpoint. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the dispatch accordingly from * the WSDL associated with this Service instance or * from the WSDL Metadata from the endpointReference. * If this Service instance has a WSDL and * the endpointReference * also has a WSDL, then the WSDL from this instance will be used. * If this Service instance does not have a WSDL and * the endpointReference does have a WSDL, then the * WSDL from the endpointReference will be used. *

        * This method behavies the same as calling *

            * dispatch = service.createDispatch(portName, context, mode, features);
            * 
        * where the portName is retrieved from the * wsaw:EndpointName attribute of the wsaw:ServiceName * element in the * metadata of the endpointReference. *
        * See WS-Addressing - WSDL 1.0 * . * * @param endpointReference The EndpointReference * for the target service endpoint that will be invoked by the * returned Dispatch object. * @param context The JAXB context used to marshall and unmarshall * messages or message payloads. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. * @param features An array of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * * @return Dispatch instance * @throws WebServiceException * @throws WebServiceException *
          *
        • If there is any missing WSDL metadata * as required by this method. *
        • If the wsaw:ServiceName element * or the wsaw:EndpointName attribute * is missing in the metdata of the * endpointReference. *
        • If the wsaw:ServiceName does not * match the serviceName of this instance. *
        • If the wsaw:EndpointName does not * match a valid wsdl:Port in the WSDL metadata. *
        • If any error in the creation of * the Dispatch object. *
        • if a feature is enabled that is not * compatible with this port or is unsupported. *
        * * @see javax.xml.bind.JAXBContext * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public Dispatch createDispatch(EndpointReference endpointReference, JAXBContext context, Service.Mode mode, WebServiceFeature... features) { return delegate.createDispatch(endpointReference, context, mode, features); } /** * Creates a Dispatch instance for use with objects of * the users choosing. * * @param portName Qualified name for the target service endpoint * @param type The class of object used for messages or message * payloads. Implementations are required to support * javax.xml.transform.Source and javax.xml.soap.SOAPMessage. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. Mode MUST be MESSAGE * when type is SOAPMessage. * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * * @return Dispatch instance. * @throws WebServiceException If any error in the creation of * the Dispatch object or if a * feature is enabled that is not compatible with * this port or is unsupported. * * @see javax.xml.transform.Source * @see javax.xml.soap.SOAPMessage * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public Dispatch createDispatch(QName portName, Class type, Service.Mode mode, WebServiceFeature... features) { return delegate.createDispatch(portName, type, mode, features); } /** * Creates a Dispatch instance for use with JAXB * generated objects. * * @param portName Qualified name for the target service endpoint * @param context The JAXB context used to marshall and unmarshall * messages or message payloads. * @param mode Controls whether the created dispatch instance is message * or payload oriented, i.e. whether the user will work with complete * protocol messages or message payloads. E.g. when using the SOAP * protocol, this parameter controls whether the user will work with * SOAP messages or the contents of a SOAP body. * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * * @return Dispatch instance. * @throws WebServiceException If any error in the creation of * the Dispatch object or if a * feature is enabled that is not compatible with * this port or is unsupported. * * @see javax.xml.bind.JAXBContext * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public Dispatch createDispatch(QName portName, JAXBContext context, Service.Mode mode, WebServiceFeature... features) { return delegate.createDispatch(portName, context, mode, features); } /** * The getPort method returns a proxy. The parameter * serviceEndpointInterface specifies the service * endpoint interface that is supported by the returned proxy. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the proxy accordingly. * The returned proxy should not be reconfigured by the client. * * @param serviceEndpointInterface Service endpoint interface. * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * @return Object instance that supports the * specified service endpoint interface. * @throws WebServiceException *
          *
        • If there is an error during creation * of the proxy. *
        • If there is any missing WSDL metadata * as required by this method. *
        • If an illegal * serviceEndpointInterface * is specified. *
        • If a feature is enabled that is not compatible * with this port or is unsupported. *
        * * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public T getPort(Class serviceEndpointInterface, WebServiceFeature... features) { return delegate.getPort(serviceEndpointInterface, features); } /** * The getPort method returns a proxy. * The parameter endpointReference specifies the * endpoint that will be invoked by the returned proxy. If there * are any reference parameters in the * endpointReference, then those reference * parameters MUST appear as SOAP headers, indicating them to be * reference parameters, on all messages sent to the endpoint. * The endpointReference's address MUST be used * for invocations on the endpoint. * The parameter serviceEndpointInterface specifies * the service endpoint interface that is supported by the * returned proxy. * In the implementation of this method, the JAX-WS * runtime system takes the responsibility of selecting a protocol * binding (and a port) and configuring the proxy accordingly from * the WSDL associated with this Service instance or * from the WSDL Metadata from the endpointReference. * If this Service instance has a WSDL and * the endpointReference * also has a WSDL, then the WSDL from this instance will be used. * If this Service instance does not have a WSDL and * the endpointReference does have a WSDL, then the * WSDL from the endpointReference will be used. * The returned proxy should not be reconfigured by the client. * If this Service instance has a known proxy * port that matches the information contained in * the WSDL, * then that proxy is returned, otherwise a WebServiceException * is thrown. *

        * Calling this method has the same behavior as the following *

            * port = service.getPort(portName, serviceEndpointInterface);
            * 
        * where the portName is retrieved from the * wsaw:EndpontName attribute of the * wsaw:ServiceName element in the * metadata of the endpointReference or from the * serviceEndpointInterface and the WSDL * associated with this Service instance. *
        * See WS-Addressing - WSDL 1.0 * . * * @param endpointReference The EndpointReference * for the target service endpoint that will be invoked by the * returned proxy. * @param serviceEndpointInterface Service endpoint interface. * @param features An array of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * @return Object Proxy instance that supports the * specified service endpoint interface. * @throws WebServiceException *
          *
        • If there is an error during creation * of the proxy. *
        • If there is any missing WSDL metadata * as required by this method. *
        • If the wsaw:EndpointName is * missing from the endpointReference * or does not match a wsdl:Port * in the WSDL metadata. *
        • If the wsaw:ServiceName in the * endpointReference metadata does not * match the serviceName of this * Service instance. *
        • If an invalid * endpointReference * is specified. *
        • If an invalid * serviceEndpointInterface * is specified. *
        • If a feature is enabled that is not compatible * with this port or is unsupported. *
        * * @since JAX-WS 2.1 **/ public T getPort(EndpointReference endpointReference, Class serviceEndpointInterface, WebServiceFeature... features) { return delegate.getPort(endpointReference, serviceEndpointInterface, features); } /** * The getPort method returns a proxy. A service client * uses this proxy to invoke operations on the target * service endpoint. The serviceEndpointInterface * specifies the service endpoint interface that is supported by * the created dynamic proxy instance. * * @param portName Qualified name of the service endpoint in * the WSDL service description. * @param serviceEndpointInterface Service endpoint interface * supported by the dynamic proxy instance. * @param features A list of WebServiceFeatures to configure on the * proxy. Supported features not in the features * parameter will have their default values. * @return Object Proxy instance that * supports the specified service endpoint * interface. * @throws WebServiceException This exception is thrown in the * following cases: *
          *
        • If there is an error in creation of * the proxy. *
        • If there is any missing WSDL metadata * as required by this method. *
        • If an illegal * serviceEndpointInterface * or portName is specified. *
        • If a feature is enabled that is not compatible * with this port or is unsupported. *
        * @see java.lang.reflect.Proxy * @see java.lang.reflect.InvocationHandler * @see WebServiceFeature * * @since JAX-WS 2.1 **/ public T getPort(QName portName, Class serviceEndpointInterface, WebServiceFeature... features) { return delegate.getPort(portName, serviceEndpointInterface, features); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/soap/0000755000175000017500000000000010755000272025141 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/soap/MTOM.java0000644000175000017500000000457610613047074026600 0ustar godgod/* * 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 javax.xml.ws.soap; // $Id: MTOM.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.xml.ws.spi.WebServiceFeatureAnnotation; /** * This feature represents the use of MTOM with a * web service. * *

        * The following describes the affects of this feature with respect * to being enabled or disabled: *

          *
        • ENABLED: In this Mode, MTOM will be enabled. *
        • DISABLED: In this Mode, MTOM will be disabled *
        *

        * The {@link #threshold} property can be used to set the threshold * value used to determine when binary data should be XOP encoded. * * @since JAX-WS 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @WebServiceFeatureAnnotation(id=MTOMFeature.ID,bean=MTOMFeature.class) public @interface MTOM { /** * Specifies if this feature is enabled or disabled. */ boolean enabled() default true; /** * Property for MTOM threshold value. When MTOM is enabled, binary data above this * size in bytes will be XOP encoded or sent as attachment. The value of this property * MUST always be >= 0. Default value is 0. */ int threshold() default 0; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/soap/AddressingFeature.java0000644000175000017500000001235410613047074031414 0ustar godgod/* * 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 javax.xml.ws.soap; // $Id: AddressingFeature.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.ws.WebServiceFeature; /** * This feature represents the use of WS-Addressing with either * the SOAP 1.1/HTTP or SOAP 1.2/HTTP binding. Using this feature * with any other binding is NOT required. *

        * Enabling this feature on the server will result in the * wsaw:UsingAddressing element being added to the * wsdl:Binding for * the endpoint and in the runtime being capable of responding to * WS-Addressing headers. *

        * Enabling this feature on the client will cause the JAX-WS runtime * to include WS-Addressing headers in SOAP messages. *

        * If the web service developer has not explicitly enabled this feature, * it may be automatically enabled if the associated WSDL enables * WS-Addressing via the wsaw:UsingAddressing element with * the wsdl:required attribute set to true. *
        * See {@link javax.xml.ws.RespectBindingFeature} for more information * on required WSDL extensions. *

        * The following describes the affects of this feature with respect * to be enabled or disabled: *

          *
        • ENABLED: In this Mode, Addressing will be enabled. * If there is not a WSDL associated with the Endpoint and * a WSDL is to be generated, it MUST be generated with the * wsaw:UsingAddressing element. At runtime, Addressing headers * MUST be consumed by the receiver and generated by the * sender even if the WSDL declares otherwise. The * mustUnderstand="0" attribute MUST be used on the Addressing * headers. *
        • DISABLED: In this Mode, Addressing will be disabled * even if an associated WSDL specifies otherwise. At runtime, * Addressing headers MUST NOT be used. *
        *

        * The {@link #required} property can be used to * specify if the required attribute on the * wsaw:UsingAddressing element should * be true or false. By default the * wsdl:required parameter is false. * * See WS-Addressing * for more information on WS-Addressing. * See WS-Addressing - WSDL 1.0 * for more information on wsaw:UsingAddressing. * * @since JAX-WS 2.1 */ public final class AddressingFeature extends WebServiceFeature { /** * Constant value identifying the AddressingFeature */ public static final String ID = "http://www.w3.org/2005/08/addressing/module"; /** * Property for required feature parameter. When Addressing * is enabled, the value of this property will be set to the * wsdl:required attribute on * wsaw:UsingAddressing element in the WSDL. */ protected boolean required = false; /** * Create an AddressingFeature. * The instance created will be enabled. */ public AddressingFeature() { this.enabled = true; } /** * Create an AddressingFeature * * @param enabled specifies whether this feature should * be enabled or not. */ public AddressingFeature(boolean enabled) { this.enabled = enabled; } /** * Create an AddressingFeature * * @param enabled specifies whether this feature should * be enabled or not. * @param required specifies the value that will be used * for the wsdl:required attribute on the * wsaw:UsingAddressing element. */ public AddressingFeature(boolean enabled, boolean required) { this.enabled = enabled; this.required = required; } /** * {@inheritDoc} */ public String getID() { return ID; } /** * Gets the boolean value used to set the * wsdl:required attribute on * wsaw:UsingAddressing element * in the WSDL. * * @return the current required value */ public boolean isRequired() { return required; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/soap/Addressing.java0000644000175000017500000000714610613047074030103 0ustar godgod/* * 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 javax.xml.ws.soap; // $Id: Addressing.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.xml.ws.spi.WebServiceFeatureAnnotation; /** * This feature represents the use of WS-Addressing with either * the SOAP 1.1/HTTP or SOAP 1.2/HTTP binding. Using this feature * with any other binding is NOT required. *

        * Enabling this feature will result in the * wsaw:UsingAddressing element being added to the * wsdl:Binding for * the endpoint and in the runtime being capable of responding to * WS-Addressing headers. *

        * The following describes the affects of this feature with respect * to be enabled or disabled: *

          *
        • ENABLED: In this Mode, Addressing will be enabled. * If there is not a WSDL associated with the Endpoint and * a WSDL is to be generated, it MUST be generated with the * wsaw:UsingAddressing element. At runtime, Addressing headers * MUST be consumed by the receiver and generated by the * sender even if the WSDL declares otherwise. The * mustUnderstand="0" attribute MUST be used on the Addressing * headers. *
        • DISABLED: In this Mode, Addressing will be disabled * even if an associated WSDL specifies otherwise. At runtime, * Addressing headers MUST NOT be used. *
        *

        * The {@link #required} property can be used to * specify if the required attribute on the * wsaw:UsingAddressing element should * be true or false. By default the * wsdl:required parameter is false. * * See WS-Addressing * for more information on WS-Addressing. * See WS-Addressing - WSDL 1.0 * for more information on wsaw:UsingAddressing. * * @since JAX-WS 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @WebServiceFeatureAnnotation(id=AddressingFeature.ID,bean=AddressingFeature.class) public @interface Addressing { /** * Specifies if this feature is enabled or disabled. */ boolean enabled() default true; /** * Property to determine the value of the * wsdl:required attribute on * wsaw:UsingAddressing element in the WSDL. */ boolean required() default false; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/soap/MTOMFeature.java0000644000175000017500000001000710613047074030076 0ustar godgod/* * 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 javax.xml.ws.soap; // $Id: MTOMFeature.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; /** * This feature represents the use of MTOM with a * web service. * *

        * The following describes the affects of this feature with respect * to being enabled or disabled: *

          *
        • ENABLED: In this Mode, MTOM will be enabled. *
        • DISABLED: In this Mode, MTOM will be disabled *
        *

        * The {@link #threshold} property can be used to set the threshold * value used to determine when binary data should be XOP encoded. * * @since JAX-WS 2.1 */ public final class MTOMFeature extends WebServiceFeature { /** * Constant value identifying the MTOMFeature */ public static final String ID = "http://www.w3.org/2004/08/soap/features/http-optimization"; /** * Property for MTOM threshold value. This property serves as a hint when * MTOM is enabled, binary data above this size in bytes SHOULD be sent * as attachment. * The value of this property MUST always be >= 0. Default value is 0. */ protected int threshold = 0; /** * Create an MTOMFeature. * The instance created will be enabled. */ public MTOMFeature() { this.enabled = true; } /** * Creates an MTOMFeature. * * @param enabled specifies if this feature should be enabled or not */ public MTOMFeature(boolean enabled) { this.enabled = enabled; } /** * Creates an MTOMFeature. * The instance created will be enabled. * * @param threshold the size in bytes that binary data SHOULD be before * being sent as an attachment. * * @throws WebServiceException if threshold is < 0 */ public MTOMFeature(int threshold) { if (threshold < 0) throw new WebServiceException("MTOMFeature.threshold must be >= 0, actual value: "+threshold); this.enabled = true; this.threshold = threshold; } /** * Creates an MTOMFeature. * * @param enabled specifies if this feature should be enabled or not * @param threshold the size in bytes that binary data SHOULD be before * being sent as an attachment. * * @throws WebServiceException if threshold is < 0 */ public MTOMFeature(boolean enabled, int threshold) { if (threshold < 0) throw new WebServiceException("MTOMFeature.threshold must be >= 0, actual value: "+threshold); this.enabled = enabled; this.threshold = threshold; } /** * {@inheritDoc} */ public String getID() { return ID; } /** * Gets the threshold value used to determine when binary data * should be sent as an attachment. * * @return the current threshold size in bytes */ public int getThreshold() { return threshold; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/soap/SOAPFaultException.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/soap/SOAPFaultException.java0000644000175000017500000000535710706452722031442 0ustar godgod/* * 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 javax.xml.ws.soap; // $Id: SOAPFaultException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ import javax.xml.soap.SOAPFault; /** The SOAPFaultException exception represents a * SOAP 1.1 or 1.2 fault. * *

        A SOAPFaultException wraps a SAAJ SOAPFault * that manages the SOAP-specific representation of faults. * The createFault method of * javax.xml.soap.SOAPFactory may be used to create an instance * of javax.xml.soap.SOAPFault for use with the * constructor. SOAPBinding contains an accessor for the * SOAPFactory used by the binding instance. * *

        Note that the value of getFault is the only part of the * exception used when searializing a SOAP fault. * *

        Refer to the SOAP specification for a complete * description of SOAP faults. * * @see javax.xml.soap.SOAPFault * @see javax.xml.ws.soap.SOAPBinding#getSOAPFactory * @see javax.xml.ws.ProtocolException * * @since JAX-WS 2.0 **/ public class SOAPFaultException extends javax.xml.ws.ProtocolException { private static final long serialVersionUID = 3948617580148536298L; private SOAPFault fault; /** Constructor for SOAPFaultException * @param fault SOAPFault representing the fault * * @see javax.xml.soap.SOAPFactory#createFault **/ public SOAPFaultException(SOAPFault fault) { super(fault.getFaultString()); this.fault = fault; } /** Gets the embedded SOAPFault instance. * * @return javax.xml.soap.SOAPFault SOAP * fault element **/ public javax.xml.soap.SOAPFault getFault() { return this.fault; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/soap/SOAPBinding.java0000644000175000017500000000731610676455223030064 0ustar godgod/* * 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 javax.xml.ws.soap; // $Id: SOAPBinding.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPFactory; import javax.xml.ws.Binding; import javax.xml.ws.WebServiceException; import java.util.Set; /** The SOAPBinding interface is an abstraction for * the SOAP binding. * * @since JAX-WS 2.0 **/ public interface SOAPBinding extends Binding { /** * A constant representing the identity of the SOAP 1.1 over HTTP binding. */ public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http"; /** * A constant representing the identity of the SOAP 1.2 over HTTP binding. */ public static final String SOAP12HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/"; /** * A constant representing the identity of the SOAP 1.1 over HTTP binding * with MTOM enabled by default. */ public static final String SOAP11HTTP_MTOM_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true"; /** * A constant representing the identity of the SOAP 1.2 over HTTP binding * with MTOM enabled by default. */ public static final String SOAP12HTTP_MTOM_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true"; /** Gets the roles played by the SOAP binding instance. * * @return Set The set of roles played by the binding instance. **/ public Set getRoles(); /** Sets the roles played by the SOAP binding instance. * * @param roles The set of roles played by the binding instance. * @throws WebServiceException On an error in the configuration of * the list of roles. **/ public void setRoles(Set roles); /** * Returns true if the use of MTOM is enabled. * * @return true if and only if the use of MTOM is enabled. **/ public boolean isMTOMEnabled(); /** * Enables or disables use of MTOM. * * @param flag A boolean specifying whether the use of MTOM should * be enabled or disabled. * @throws WebServiceException If the specified setting is not supported * by this binding instance. * * **/ public void setMTOMEnabled(boolean flag); /** * Gets the SAAJ SOAPFactory instance used by this SOAP binding. * * @return SOAPFactory instance used by this SOAP binding. **/ public SOAPFactory getSOAPFactory(); /** * Gets the SAAJ MessageFactory instance used by this SOAP binding. * * @return MessageFactory instance used by this SOAP binding. **/ public MessageFactory getMessageFactory(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServiceContext.java0000644000175000017500000000654510676430372030471 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebServiceContext.java 4630 2007-09-26 10:14:18Z heiko.braun@jboss.com $ import javax.xml.ws.handler.MessageContext; import java.security.Principal; /** * A WebServiceContext makes it possible for * a web service endpoint implementation class to access * message context and security information relative to * a request being served. * * Typically a WebServiceContext is injected * into an endpoint implementation class using the * Resource annotation. * * @since JAX-WS 2.0 * * @see javax.annotation.Resource **/ public interface WebServiceContext { /** * Returns the MessageContext for the request being served * at the time this method is called. Only properties with * APPLICATION scope will be visible to the application. * * @return MessageContext The message context. * * @throws IllegalStateException This exception is thrown * if the method is called while no request is * being serviced. * * @see javax.xml.ws.handler.MessageContext * @see javax.xml.ws.handler.MessageContext.Scope * @see java.lang.IllegalStateException **/ public MessageContext getMessageContext(); /** * Returns the Principal that identifies the sender * of the request currently being serviced. If the * sender has not been authenticated, the method * returns null. * * @return Principal The principal object. * * @throws IllegalStateException This exception is thrown * if the method is called while no request is * being serviced. * * @see java.security.Principal * @see java.lang.IllegalStateException **/ public Principal getUserPrincipal(); /** * Returns a boolean indicating whether the * authenticated user is included in the specified * logical role. If the user has not been * authenticated, the method returns false. * * @param role A String specifying the name of the role * * @return a boolean indicating whether * the sender of the request belongs to a given role * * @throws IllegalStateException This exception is thrown * if the method is called while no request is * being serviced. **/ public boolean isUserInRole(String role); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServiceContext21.java0000644000175000017500000001056210676430372030626 0ustar godgod/* * 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 javax.xml.ws; import org.w3c.dom.Element; /** * @author Heiko.Braun@jboss.com * @version $Revision: 4630 $ */ public interface WebServiceContext21 extends WebServiceContext { /** * Returns the WEndpointReference for this * endpoint. *

        * If the Binding for this bindingProvider is * either SOAP1.1/HTTP or SOAP1.2/HTTP, then a * W3CEndpointReference MUST be returned. * If the returned EndpointReference is a * W3CEndpointReference it MUST contain * the wsaw:ServiceName element and the * wsaw:EndpointName attribute on the * wsaw:ServiceName. It SHOULD contain * the embedded WSDL in the wsa:Metadata element * if there is an associated WSDL. The * wsaw:InterfaceName MAY also be present. *
        * See * WS-Addressing - WSDL 1.0. * * @param referenceParameters Reference parameters to be associated with the * returned EndpointReference instance. * @return EndpointReference of the endpoint associated with this * WebServiceContext. * If the returned EndpointReference is of type * W3CEndpointReference then it MUST contain the * the specified referenceParameters. * * @throws IllegalStateException This exception is thrown * if the method is called while no request is * being serviced. * * @see javax.xml.ws.wsaddressing.W3CEndpointReference * * @since JAX-WS 2.1 */ public EndpointReference getEndpointReference(Element... referenceParameters); /** * Returns the EndpointReference associated with * this endpoint. *

        * If the returned EndpointReference is a * W3CEndpointReference it MUST contain * the wsaw:ServiceName element and the * wsaw:EndpointName attribute on the * wsaw:ServiceName. It SHOULD contain * the embedded WSDL in the wsa:Metadata element * if there is an associated WSDL. The * wsaw:InterfaceName MAY also be present. *
        * See * WS-Addressing - WSDL 1.0. * * @param clazz The type of EndpointReference that * MUST be returned. * @param referenceParameters Reference parameters to be associated with the * returned EndpointReference instance. * @return EndpointReference of type clazz of the endpoint * associated with this WebServiceContext instance. * If the returned EndpointReference is of type * W3CEndpointReference then it MUST contain the * the specified referenceParameters. * * @throws IllegalStateException This exception is thrown * if the method is called while no request is * being serviced. * @throws WebServiceException If the clazz type of * EndpointReference is not supported. * * @since JAX-WS 2.1 **/ public abstract T getEndpointReference(Class clazz, Element... referenceParameters); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/ServiceMode.java0000644000175000017500000000366410613047074027264 0ustar godgod/* * 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 javax.xml.ws; // $Id: ServiceMode.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Used to indicate whether a Provider implementation wishes to work * with entire protocol messages or just with protocol message payloads. * * @since JAX-WS 2.0 **/ @Target( { ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) @Inherited @Documented public @interface ServiceMode { /** * Service mode. PAYLOAD indicates that the Provider implementation * wishes to work with protocol message payloads only. MESSAGE indicates * that the Provider implementation wishes to work with entire protocol * messages. **/ public Service.Mode value() default Service.Mode.PAYLOAD; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/0000755000175000017500000000000010755000271025613 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/soap/0000755000175000017500000000000010755000271026555 5ustar godgod././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/soap/SOAPHandler.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/soap/SOAPHandler.jav0000644000175000017500000000353010613047074031325 0ustar godgod/* * 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 javax.xml.ws.handler.soap; // $Id: SOAPHandler.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.util.Set; import javax.xml.namespace.QName; import javax.xml.ws.handler.Handler; /** The SOAPHandler class extends Handler * to provide typesafety for the message context parameter and add a method * to obtain access to the headers that may be processed by the handler. * * @since JAX-WS 2.0 **/ public interface SOAPHandler extends Handler { /** Gets the header blocks that can be processed by this Handler * instance. * * @return Set of QNames of header blocks processed by this * handler instance. QName is the qualified * name of the outermost element of the Header block. **/ Set getHeaders(); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/soap/SOAPMessageContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/soap/SOAPMessageCont0000644000175000017500000001016410613047074031402 0ustar godgod/* * 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 javax.xml.ws.handler.soap; // $Id: SOAPMessageContext.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.util.Set; import javax.xml.bind.JAXBContext; import javax.xml.namespace.QName; import javax.xml.soap.SOAPMessage; import javax.xml.ws.WebServiceException; /** The interface SOAPMessageContext * provides access to the SOAP message for either RPC request or * response. The javax.xml.soap.SOAPMessage specifies * the standard Java API for the representation of a SOAP 1.1 message * with attachments. * * @see javax.xml.soap.SOAPMessage * * @since JAX-WS 2.0 **/ public interface SOAPMessageContext extends javax.xml.ws.handler.MessageContext { /** Gets the SOAPMessage from this message context. Modifications * to the returned SOAPMessage change the message in-place, there * is no need to susequently call setMessage. * * @return Returns the SOAPMessage; returns null if no * SOAPMessage is present in this message context **/ public SOAPMessage getMessage(); /** Sets the SOAPMessage in this message context * * @param message SOAP message * @throws WebServiceException If any error during the setting * of the SOAPMessage in this message context * @throws java.lang.UnsupportedOperationException If this * operation is not supported **/ public void setMessage(SOAPMessage message); /** Gets headers that have a particular qualified name from the message in the * message context. Note that a SOAP message can contain multiple headers * with the same qualified name. * * @param header The XML qualified name of the SOAP header(s). * @param context The JAXBContext that should be used to unmarshall the * header * @param allRoles If true then returns headers for all SOAP * roles, if false then only returns headers targetted * at the roles currently being played by this SOAP node, see * getRoles. * @return An array of unmarshalled headers; returns an empty array if no * message is present in this message context or no headers match * the supplied qualified name. * @throws WebServiceException If an error occurs when using the supplied * JAXBContext to unmarshall. The cause of * the WebServiceException is the original JAXBException. **/ public Object[] getHeaders(QName header, JAXBContext context, boolean allRoles); /** Gets the SOAP actor roles associated with an execution * of the handler chain. * Note that SOAP actor roles apply to the SOAP node and * are managed using SOAPBinding.setRoles and * SOAPBinding.getRoles. Handler instances in * the handler chain use this information about the SOAP actor * roles to process the SOAP header blocks. Note that the * SOAP actor roles are invariant during the processing of * SOAP message through the handler chain. * * @return Array of String for SOAP actor roles **/ public Set getRoles(); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/HandlerResolver.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/HandlerResolver.java0000644000175000017500000000377010613047074031571 0ustar godgod/* * 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 javax.xml.ws.handler; // $Id: HandlerResolver.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ /** * HandlerResolver is an interface implemented * by an application to get control over the handler chain * set on proxy/dispatch objects at the time of their creation. *

        * A HandlerResolver may be set on a Service * using the setHandlerResolver method. *

        * When the runtime invokes a HandlerResolver, it will * pass it a PortInfo object containing information * about the port that the proxy/dispatch object will be accessing. * * @see javax.xml.ws.Service#setHandlerResolver * * @since JAX-WS 2.0 **/ public interface HandlerResolver { /** * Gets the handler chain for the specified port. * * @param portInfo Contains information about the port being accessed. * @return java.util.List Handler chain **/ public java.util.List getHandlerChain(PortInfo portInfo); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/PortInfo.java0000644000175000017500000000413410613047074030225 0ustar godgod/* * 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 javax.xml.ws.handler; // $Id: PortInfo.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.namespace.QName; /** * The PortInfo interface is used by a * HandlerResolver to query information about * the port it is being asked to create a handler chain for. *

        * This interface is never implemented by an application, * only by a JAX-WS implementation. * * @since JAX-WS 2.0 **/ public interface PortInfo { /** * Gets the qualified name of the WSDL service name containing * the port being accessed. * * @return javax.xml.namespace.QName The qualified name of the WSDL service. **/ public QName getServiceName(); /** * Gets the qualified name of the WSDL port being accessed. * * @return javax.xml.namespace.QName The qualified name of the WSDL port. **/ public QName getPortName(); /** * Gets the URI identifying the binding used by the port being accessed. * * @return String The binding identifier for the port. * * @see javax.xml.ws.Binding **/ public String getBindingID(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/Handler.java0000644000175000017500000000664310613047074030051 0ustar godgod/* * 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 javax.xml.ws.handler; // $Id: Handler.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.ws.ProtocolException; /** The Handler interface * is the base interface for JAX-WS handlers. * * @since JAX-WS 2.0 **/ public interface Handler { /** The handleMessage method is invoked for normal processing * of inbound and outbound messages. Refer to the description of the handler * framework in the JAX-WS specification for full details. * * @param context the message context. * @return An indication of whether handler processing should continue for * the current message *

          *
        • Return true to continue * processing.
        • *
        • Return false to block * processing.
        • *
        * @throws RuntimeException Causes the JAX-WS runtime to cease * handler processing and generate a fault. * @throws ProtocolException Causes the JAX-WS runtime to switch to * fault message processing. **/ public boolean handleMessage(C context); /** The handleFault method is invoked for fault message * processing. Refer to the description of the handler * framework in the JAX-WS specification for full details. * * @param context the message context * @return An indication of whether handler fault processing should continue * for the current message *
          *
        • Return true to continue * processing.
        • *
        • Return false to block * processing.
        • *
        * @throws RuntimeException Causes the JAX-WS runtime to cease * handler fault processing and dispatch the fault. * @throws ProtocolException Causes the JAX-WS runtime to cease * handler fault processing and dispatch the fault. **/ public boolean handleFault(C context); /** * Called at the conclusion of a message exchange pattern just prior to * the JAX-WS runtime disptaching a message, fault or exception. Refer to * the description of the handler * framework in the JAX-WS specification for full details. * * @param context the message context **/ public void close(MessageContext context); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/LogicalMessageContext.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/LogicalMessageContex0000644000175000017500000000322510613047074031605 0ustar godgod/* * 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 javax.xml.ws.handler; // $Id: LogicalMessageContext.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.ws.LogicalMessage; /** The LogicalMessageContext interface extends * MessageContext to * provide access to a the contained message as a protocol neutral * LogicalMessage * * @since JAX-WS 2.0 **/ public interface LogicalMessageContext extends MessageContext { /** Gets the message from this message context * * @return The contained message; returns null if no * message is present in this message context **/ public LogicalMessage getMessage(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/LogicalHandler.java0000644000175000017500000000251610613047074031337 0ustar godgod/* * 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 javax.xml.ws.handler; // $Id: LogicalHandler.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ /** The LogicalHandler extends * Handler to provide typesafety for the message context parameter. * * @since JAX-WS 2.0 **/ public interface LogicalHandler extends Handler { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/MessageContext.java0000644000175000017500000001377510676455223031441 0ustar godgod/* * 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 javax.xml.ws.handler; // $Id: MessageContext.java 4632 2007-09-26 13:11:47Z heiko.braun@jboss.com $ import java.util.Map; /** * The interface MessageContext abstracts the message * context that is processed by a handler in the handle * method. * *

        The MessageContext interface provides methods to * manage a property set. MessageContext properties * enable handlers in a handler chain to share processing related * state. * * @since JAX-WS 2.0 */ public interface MessageContext extends Map { /** * Standard property: message direction, true for * outbound messages, false for inbound. *

        Type: boolean */ public static final String MESSAGE_OUTBOUND_PROPERTY = "javax.xml.ws.handler.message.outbound"; /** * Standard property: Map of attachments to a message for the inbound * message, key is the MIME Content-ID, value is a DataHandler. *

        Type: java.util.Map */ public static final String INBOUND_MESSAGE_ATTACHMENTS = "javax.xml.ws.binding.attachments.inbound"; /** * Standard property: Map of attachments to a message for the outbound * message, key is the MIME Content-ID, value is a DataHandler. *

        Type: java.util.Map */ public static final String OUTBOUND_MESSAGE_ATTACHMENTS = "javax.xml.ws.binding.attachments.outbound"; /** * Standard property: input source for WSDL document. *

        Type: org.xml.sax.InputSource */ public static final String WSDL_DESCRIPTION = "javax.xml.ws.wsdl.description"; /** * Standard property: name of WSDL service. *

        Type: javax.xml.namespace.QName */ public static final String WSDL_SERVICE = "javax.xml.ws.wsdl.service"; /** * Standard property: name of WSDL port. *

        Type: javax.xml.namespace.QName */ public static final String WSDL_PORT = "javax.xml.ws.wsdl.port"; /** * Standard property: name of wsdl interface (2.0) or port type (1.1). *

        Type: javax.xml.namespace.QName */ public static final String WSDL_INTERFACE = "javax.xml.ws.wsdl.interface"; /** * Standard property: name of WSDL operation. *

        Type: javax.xml.namespace.QName */ public static final String WSDL_OPERATION = "javax.xml.ws.wsdl.operation"; /** * Standard property: HTTP response status code. *

        Type: java.lang.Integer */ public static final String HTTP_RESPONSE_CODE = "javax.xml.ws.http.response.code"; /** * Standard property: HTTP request headers. *

        Type: java.util.Map> */ public static final String HTTP_REQUEST_HEADERS = "javax.xml.ws.http.request.headers"; /** * Standard property: HTTP response headers. *

        Type: java.util.Map> */ public static final String HTTP_RESPONSE_HEADERS = "javax.xml.ws.http.response.headers"; /** * Standard property: HTTP request method. *

        Type: java.lang.String */ public static final String HTTP_REQUEST_METHOD = "javax.xml.ws.http.request.method"; /** * Standard property: servlet request object. *

        Type: javax.servlet.http.HttpServletRequest */ public static final String SERVLET_REQUEST = "javax.xml.ws.servlet.request"; /** * Standard property: servlet response object. *

        Type: javax.servlet.http.HttpServletResponse */ public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response"; /** * Standard property: servlet context object. *

        Type: javax.servlet.ServletContext */ public static final String SERVLET_CONTEXT = "javax.xml.ws.servlet.context"; /** * Standard property: Query string for request. *

        Type: String **/ public static final String QUERY_STRING = "javax.xml.ws.http.request.querystring"; /** * Standard property: Request Path Info *

        Type: String */ public static final String PATH_INFO = "javax.xml.ws.http.request.pathinfo"; /** * Property scope. Properties scoped as APPLICATION are * visible to handlers, * client applications and service endpoints; properties scoped as * HANDLER * are only normally visible to handlers. */ public enum Scope { APPLICATION, HANDLER }; /** * Sets the scope of a property. * * @param name Name of the property associated with the * MessageContext * @param scope Desired scope of the property * @throws java.lang.IllegalArgumentException if an illegal * property name is specified */ public void setScope(String name, Scope scope); /** * Gets the scope of a property. * * @param name Name of the property * @return Scope of the property * @throws java.lang.IllegalArgumentException if a non-existant * property name is specified */ public Scope getScope(String name); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/MessageContext21.javalibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/handler/MessageContext21.jav0000644000175000017500000000274710676455223031440 0ustar godgod/* * 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 javax.xml.ws.handler; /** * @author Heiko.Braun@jboss.com * @version $Revision: 4632 $ */ public interface MessageContext21 extends MessageContext { /** * Standard property: WS Addressing Reference Parameters. * The list MUST include all SOAP headers marked with the * wsa:IsReferenceParameter="true" attribute. *

        Type: List * * @since JAX-WS 2.1 */ public static final String REFERENCE_PARAMETERS = "javax.xml.ws.reference.parameters"; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Response.java0000644000175000017500000000371410613047074026651 0ustar godgod/* * 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 javax.xml.ws; // $Id: Response.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.util.Map; import java.util.concurrent.Future; /** The Response interface provides methods used to obtain the * payload and context of a message sent in response to an operation * invocation. * *

        For asynchronous operation invocations it provides additional methods * to check the status of the request. The get(...) methods may * throw the standard * set of exceptions and their cause may be a RemoteException or a * WebServiceException that represents the error that occured during the * asynchronous method invocation.

        * * @since JAX-WS 2.0 **/ public interface Response extends Future { /** Gets the contained response context. * * @return The contained response context. May be null if a * response is not yet available. * **/ Map getContext(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServiceProvider.java0000644000175000017500000000354410613047074030625 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebServiceProvider.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Used to annotate a Provider implementation class. * * @since JAX-WS 2.0 * @see javax.xml.ws.Provider */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface WebServiceProvider { /** * Location of the WSDL description for the service. */ String wsdlLocation() default ""; /** * Service name. */ String serviceName() default ""; /** * Target namespace for the service */ String targetNamespace() default ""; /** * Port name. */ String portName() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/FaultAction.java0000644000175000017500000001542010613047074027261 0ustar godgod/* * 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 javax.xml.ws; // $Id: FaultAction.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * The FaultAction annotation is used inside an * Action annotation to allow an explicit association of Action message * addressing property with the fault messages of the WSDL operation mapped from * the exception class. *

        * The fault message in the generated WSDL operation mapped for className * class contains explicit wsaw:Action attribute. * *

        * Example 1: Specify explicit values for Action message addressing * property for the input, output and fault message * if the Java method throws only one service specific exception. * *

         * @javax.jws.WebService
         * public class AddNumbersImpl {
         *     @javax.xml.ws.Action(
         *         input="http://example.com/inputAction",
         *         output="http://example.com/outputAction",
         *         fault = {
         *             @javax.xml.ws.FaultAction(className=AddNumbersException.class, value="http://example.com/faultAction")
         *         })
         *     public int addNumbers(int number1, int number2) 
         *         throws AddNumbersException {
         *         return number1 + number2;
         *     }
         * }
         * 
        * * The generated WSDL looks like: * *
         *   <definitions targetNamespace="http://example.com/numbers" ...>
         *   ...
         *     <portType name="AddNumbersPortType">
         *       <operation name="AddNumbers">
         *         <input message="tns:AddNumbersInput" name="Parameters"
         *           wsaw:Action="http://example.com/inputAction"/>
         *        <output message="tns:AddNumbersOutput" name="Result"
         *          wsaw:Action="http://example.com/outputAction"/>
         *        <fault message="tns:AddNumbersException" name="AddNumbersException"
         *          wsaw:Action="http://example.com/faultAction"/>
         *       </operation>
         *     <portType>
         *   ...
         *   <definitions>
         * 
        * *

        * Example 2: Here is an example that shows how to specify explicit values for Action * message addressing property if the Java method throws only one service specific exception, * without specifying the values for input and output messages. * *

         * @javax.jws.WebService
         * public class AddNumbersImpl {
         *     @javax.xml.ws.Action(
         *         fault = {
         *             @javax.xml.ws.FaultAction(className=AddNumbersException.class, value="http://example.com/faultAction")
         *         })
         *     public int addNumbers(int number1, int number2) 
         *         throws AddNumbersException {
         *         return number1 + number2;
         *     }
         * }
         * 
        * * The generated WSDL looks like: * *
         *   <definitions targetNamespace="http://example.com/numbers" ...>
         *   ...
         *     <portType name="AddNumbersPortType">
         *       <operation name="AddNumbers">
         *         <input message="tns:AddNumbersInput" name="Parameters"/>
         *         <output message="tns:AddNumbersOutput" name="Result"/>
         *         <fault message="tns:addNumbersFault" name="InvalidNumbers"
         *           wsa:Action="http://example.com/addnumbers/fault"/>
         *       </operation>
         *     <portType>
         *   ...
         *   <definitions>
         * 
        * *

        * Example 3: Here is an example that shows how to specify explicit values for Action * message addressing property if the Java method throws more than one service specific exception. * *

         * @javax.jws.WebService
         * public class AddNumbersImpl {
         *     @javax.xml.ws.Action(
         *         fault = {
         *             @javax.xml.ws.FaultAction(className=AddNumbersException.class, value="http://example.com/addFaultAction")
         *             @javax.xml.ws.FaultAction(className=TooBigNumbersException.class, value="http://example.com/toobigFaultAction")
         *         })
         *     public int addNumbers(int number1, int number2) 
         *         throws AddNumbersException, TooBigNumbersException {
         *         return number1 + number2;
         *     }
         * }
         * 
        * * The generated WSDL looks like: * *
         *   <definitions targetNamespace="http://example.com/numbers" ...>
         *   ...
         *     <portType name="AddNumbersPortType">
         *       <operation name="AddNumbers">
         *         <input message="tns:AddNumbersInput" name="Parameters"/>
         *         <output message="tns:AddNumbersOutput" name="Result"/>
         *         <fault message="tns:addNumbersFault" name="AddNumbersException"
         *           wsa:Action="http://example.com/addnumbers/fault"/>
         *         <fault message="tns:tooBigNumbersFault" name="TooBigNumbersException"
         *           wsa:Action="http://example.com/toobigFaultAction"/>
         *       </operation>
         *     <portType>
         *   ...
         *   <definitions>
         * 
        * * @since JAX-WS 2.1 */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface FaultAction { /** * Name of the exception class */ Class className(); /** * Value of Action message addressing property for the exception */ String value() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServiceFeature.java0000644000175000017500000000533110613047074030422 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebServiceFeature.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ /** * A WebServiceFeature is used to represent a feature that can be * enabled or disabled for a web service. *

        * The JAX-WS specification will define some standard features and * JAX-WS implementors are free to define additional features if * necessary. Vendor specific features may not be portable so * caution should be used when using them. Each Feature definition * MUST define a public static final String ID * that can be used in the Feature annotation to refer * to the feature. This ID MUST be unique across all features * of all vendors. When defining a vendor specific feature ID, * use a vendor specific namespace in the ID string. * * @see javax.xml.ws.RespectBindingFeature * @see javax.xml.ws.soap.AddressingFeature * @see javax.xml.ws.soap.MTOMFeature * * @since 2.1 */ public abstract class WebServiceFeature { /** * Each Feature definition MUST define a public static final * String ID that can be used in the Feature annotation to refer * to the feature. */ // public static final String ID = "some unique feature Identifier"; /** * Get the unique identifier for this WebServiceFeature. * * @return the unique identifier for this feature. */ public abstract String getID(); /** * Specifies if the feature is enabled or disabled */ protected boolean enabled = false; protected WebServiceFeature() { } /** * Returns true if this feature is enabled. * * @return true if and only if the feature is enabled . */ public boolean isEnabled() { return enabled; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Binding.java0000644000175000017500000000425210676430372026431 0ustar godgod/* * 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 javax.xml.ws; // $Id: Binding.java 4630 2007-09-26 10:14:18Z heiko.braun@jboss.com $ /** The Binding interface is the base interface * for JAX-WS protocol bindings. * * @since JAX-WS 2.0 **/ public interface Binding { /** * Gets a copy of the handler chain for a protocol binding instance. * If the returned chain is modified a call to setHandlerChain * is required to configure the binding instance with the new chain. * * @return java.util.List Handler chain */ public java.util.List getHandlerChain(); /** * Sets the handler chain for the protocol binding instance. * * @param chain A List of handler configuration entries * @throws WebServiceException On an error in the configuration of * the handler chain * @throws java.lang.UnsupportedOperationException If this * operation is not supported. This may be done to * avoid any overriding of a pre-configured handler * chain. */ public void setHandlerChain(java.util.List chain); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Binding21.java0000644000175000017500000000265410702657335026600 0ustar godgod/* * 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 javax.xml.ws; // $Id: Binding21.java 4701 2007-10-09 10:58:37Z thomas.diesler@jboss.com $ /** * @author Heiko.Braun@jboss.com * @version $Revision: 4701 $ */ public interface Binding21 extends Binding { /** * Get the URI for this binding instance. * * @return String The binding identifier for the port. * Never returns null * * @since JAX-WS 2.1 */ String getBindingID(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Holder.java0000644000175000017500000000307210613047074026265 0ustar godgod/* * 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 javax.xml.ws; // $Id: Holder.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ /** * Holds a value of type T. * * @since JAX-WS 2.0 **/ public final class Holder { /** * The value contained in the holder. **/ public T value; /** * Creates a new holder with a null value. **/ public Holder() { } /** * Create a new holder with the specified value. * * @param value The value to be stored in the holder. **/ public Holder(T value) { this.value = value; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServicePermission.java0000644000175000017500000000507210613047074031161 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebServicePermission.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.security.BasicPermission; /** * This class defines web service permissions. *

        * Web service Permissions are identified by name (also referred to as * a "target name") alone. There are no actions associated * with them. *

        * The following permission target name is defined: *

        *

        *
        publishEndpoint *
        *

        * The publishEndpoint permission allows publishing a * web service endpoint using the publish methods * defined by the javax.xml.ws.Endpoint class. * * @see javax.xml.ws.Endpoint * @see java.security.BasicPermission * @see java.security.Permission * @see java.security.Permissions * @see java.lang.SecurityManager */ public final class WebServicePermission extends BasicPermission { private static final long serialVersionUID = -146474640053770988L; /** * Creates a new permission with the specified name. * * @param name the name of the WebServicePermission */ public WebServicePermission(String name) { super(name); } /** * Creates a new permission with the specified name and actions. * * The actions parameter is currently unused and * it should be null. * * @param name the name of the WebServicePermission * @param actions should be null */ public WebServicePermission(String name, String actions) { super(name, actions); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServiceRefs.java0000755000175000017500000000327710613047074027740 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebServiceRefs.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * The WebServiceRefs annotation allows * multiple web service references to be declared at the * class level. * * @see javax.xml.ws.WebServiceRef * @since 2.0 */ @Documented @Retention(RUNTIME) @Target(TYPE) public @interface WebServiceRefs { /** * Array used for multiple web service reference declarations. */ WebServiceRef[] value(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/ProtocolException.java0000644000175000017500000000703410706452722030535 0ustar godgod/* * 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 javax.xml.ws; // $Id: ProtocolException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ /** The ProtocolException class is a * base class for exceptions related to a specific protocol binding. Subclasses * are used to communicate protocol level fault information to clients and may * be used on the server to control the protocol specific fault representation. * * @since JAX-WS 2.0 **/ public class ProtocolException extends WebServiceException { private static final long serialVersionUID = 6688436881502883481L; /** * Constructs a new protocol exception with null as its detail message. The * cause is not initialized, and may subsequently be initialized by a call * to Throwable.initCause(java.lang.Throwable). */ public ProtocolException() { super(); } /** * Constructs a new protocol exception with the specified detail message. * The cause is not initialized, and may subsequently be initialized by a * call to Throwable.initCause(java.lang.Throwable). * * @param message the detail message. The detail message is saved for later * retrieval by the Throwable.getMessage() method. */ public ProtocolException(String message) { super(message); } /** * Constructs a new runtime exception with the specified detail message and * cause. * * Note that the detail message associated with cause is not automatically * incorporated in this runtime exception's detail message. * * @param message the detail message (which is saved for later retrieval by * the Throwable.getMessage() method). * @param cause the cause (which is saved for later retrieval by the * Throwable.getCause() method). (A null value is permitted, and indicates * that the cause is nonexistent or unknown.) */ public ProtocolException(String message, Throwable cause) { super(message, cause); } /** * Constructs a new runtime exception with the specified cause and a detail * message of (cause==null ? null : cause.toString()) (which typically * contains the class and detail message of cause). This constructor is * useful for runtime exceptions that are little more than wrappers for * other throwables. * * @param cause the cause (which is saved for later retrieval by the * Throwable.getCause() method). (A null value is permitted, and indicates * that the cause is nonexistent or unknown.) */ public ProtocolException(Throwable cause) { super(cause); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/BindingProvider.java0000644000175000017500000001047710676430372030152 0ustar godgod/* * 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 javax.xml.ws; // $Id: BindingProvider.java 4630 2007-09-26 10:14:18Z heiko.braun@jboss.com $ import java.util.Map; /** The BindingProvider interface provides access to the * protocol binding and associated context objects for request and * response message processing. * * @since JAX-WS 2.0 * * @see javax.xml.ws.Binding **/ public interface BindingProvider { /** Standard property: User name for authentication. *

        Type: java.lang.String **/ public static final String USERNAME_PROPERTY = "javax.xml.ws.security.auth.username"; /** Standard property: Password for authentication. *

        Type: java.lang.String **/ public static final String PASSWORD_PROPERTY = "javax.xml.ws.security.auth.password"; /** Standard property: Target service endpoint address. The * URI scheme for the endpoint address specification MUST * correspond to the protocol/transport binding for the * binding in use. *

        Type: java.lang.String **/ public static final String ENDPOINT_ADDRESS_PROPERTY = "javax.xml.ws.service.endpoint.address"; /** Standard property: This boolean property is used by a service * client to indicate whether or not it wants to participate in * a session with a service endpoint. If this property is set to * true, the service client indicates that it wants the session * to be maintained. If set to false, the session is not maintained. * The default value for this property is false. *

        Type: java.lang.Boolean **/ public static final String SESSION_MAINTAIN_PROPERTY = "javax.xml.ws.session.maintain"; /** Standard property for SOAPAction. This boolean property * indicates whether or not SOAPAction is to be used. The * default value of this property is false indicating that * the SOAPAction is not used. *

        Type: java.lang.Boolean **/ public static final String SOAPACTION_USE_PROPERTY = "javax.xml.ws.soap.http.soapaction.use"; /** Standard property for SOAPAction. Indicates the SOAPAction * URI if the javax.xml.ws.soap.http.soapaction.use * property is set to true. *

        Type: java.lang.String **/ public static final String SOAPACTION_URI_PROPERTY = "javax.xml.ws.soap.http.soapaction.uri"; /** Get the context that is used to initialize the message context * for request messages. * * Modifications to the request context do not affect the message context of * either synchronous or asynchronous operations that have already been * started. * * @return The context that is used in processing request messages. **/ Map getRequestContext(); /** Get the context that resulted from processing a response message. * * The returned context is for the most recently completed synchronous * operation. Subsequent synchronous operation invocations overwrite the * response context. Asynchronous operations return their response context * via the Response interface. * * @return The context that resulted from processing the latest * response messages. **/ Map getResponseContext(); /** Get the Binding for this binding provider. * * @return The Binding for this binding provider. **/ Binding getBinding(); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Provider.java0000644000175000017500000000466010613047074026646 0ustar godgod/* * 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 javax.xml.ws; // $Id: Provider.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ /** *

        Service endpoints may implement the Provider * interface as a dynamic alternative to an SEI. * *

        Implementations are required to support Provider<Source>, * Provider<SOAPMessage> and * Provider<DataSource>, depending on the binding * in use and the service mode. * *

        The ServiceMode annotation can be used to control whether * the Provider instance will receive entire protocol messages * or just message payloads. * * @since JAX-WS 2.0 * * @see javax.xml.transform.Source * @see javax.xml.soap.SOAPMessage * @see javax.xml.ws.ServiceMode **/ public interface Provider { /** Invokes an operation occording to the contents of the request * message. * * @param request The request message or message payload. * @return The response message or message payload. May be null if there is no response. * @throws WebServiceException If there is an error processing request. * The cause of the WebServiceException may be set to a subclass * of ProtocolException to control the protocol level * representation of the exception. * @see javax.xml.ws.handler.MessageContext * @see javax.xml.ws.ProtocolException **/ public T invoke(T request); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/RespectBindingFeature.java0000644000175000017500000001174010676430372031273 0ustar godgod/* * 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 javax.xml.ws; // $Id: RespectBindingFeature.java 4630 2007-09-26 10:14:18Z heiko.braun@jboss.com $ import javax.xml.ws.WebServiceFeature; /** * This feature clarifies the use of the wsdl:binding * in a JAX-WS runtime. *

        * This feature is only useful with web services that have an * associated WSDL. Enabling this feature requires that a JAX-WS * implementation inspect the wsdl:binding for an * endpoint at runtime to make sure that all wsdl:extensions * that have the required attribute set to true * are understood and are being used. *

        * The following describes the affects of this feature with respect * to be enabled or disabled: *

          *
        • ENABLED: In this Mode, a JAX-WS runtime MUST assure that all * required wsdl:binding extensions are either understood and used by the runtime, or explicitly disabled by the web service * application. A web service application can disable a particular * extension that has a know WebServiceFeature using * either the {@link BindingType#features} element on the server * or one of the following methods on the client: *
            *
          • {@link Service#getPort(QName,Class,WebServiceFeature...)} *
          • {@link Service#getPort(Class,WebServiceFeature...)} *
          • {@link Service#getPort(EndpointReference,Class,WebServiceFeature...)} *
          • {@link Service#createDispatch(QName,Class, * Service.Mode mode,WebServiceFeature...)} *
          • {@link Service21#createDispatch(EndpointReference, * Class,Service.Mode, * WebServiceFeature...)} *
          • {@link Service#createDispatch(QName, * JAXBContext, Service.Mode, WebServiceFeature...)} *
          • {@link Service#createDispatch(EndpointReference, * JAXBContext, Service.Mode, WebServiceFeature...)} *
          • {@link EndpointReference#getPort(Class,WebServiceFeature...)} *
          • One of the getXXXPort(WebServiceFeatures...) methods on a * generated Service. *
          * The runtime MUST also make sure that binding of * SEI parameters/return values respect the wsdl:binding. * With this feature enabled, if a required * wsdl:binding extension is in the WSDL and it is not * supported by a JAX-WS runtime and it has not * been explicitly turned off by the web service developer, then * that JAX-WS runtime MUST behave appropriately based on whether it is * on the client or server: *
            *
          • Client: runtime MUST throw a * WebServiceException no sooner than when one of the methods * above is invoked but no later than the first invocation of an endpoint * operation. *
          • throw a WebServiceException and the endpoint MUST fail to deploy *
          *
        • DISABLED: In this Mode, an implementation may choose whether * to inspect the wsdl:binding or not and to what degree * the wsdl:binding will be inspected. For example, * one implementation may choose to behave as if this feature is enabled, * another implementation may only choose to verify the SEI's * parameter/return type bindings. *
        * * @see javax.xml.ws.soap.AddressingFeature * * @since JAX-WS 2.1 */ public final class RespectBindingFeature extends WebServiceFeature { /** * * Constant value identifying the RespectBindingFeature */ public static final String ID = "javax.xml.ws.InspectBindingFeature"; /** * Create an RespectBindingFeature. * The instance created will be enabled. */ public RespectBindingFeature() { this.enabled = true; } /** * Create an RespectBindingFeature * * @param enabled specifies whether this feature should * be enabled or not. */ public RespectBindingFeature(boolean enabled) { this.enabled = enabled; } /** * {@inheritDoc} */ public String getID() { return ID; } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/ResponseWrapper.java0000644000175000017500000000425210613047074030210 0ustar godgod/* * 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 javax.xml.ws; // $Id: ResponseWrapper.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Used to annotate methods in the Service Endpoint Interface with the response * wrapper bean to be used at runtime. The default value of the localName is * the operationName as defined in WebMethod annotation appended with * Response and the targetNamespace is the target namespace of the SEI. *

        When starting from Java this annotation is used resolve * overloading conflicts in document literal mode. Only the className * is required in this case. * * @since JAX-WS 2.0 **/ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface ResponseWrapper { /** * Elements local name. **/ public String localName() default ""; /** * Elements namespace name. **/ public String targetNamespace() default ""; /** * Response wrapper bean name. **/ public String className() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Dispatch.java0000644000175000017500000001204410613047074026606 0ustar godgod/* * 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 javax.xml.ws; // $Id: Dispatch.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.util.concurrent.Future; /** The Dispatch interface provides support * for the dynamic invocation of a service endpoint operations. The * javax.xml.ws.Service * interface acts as a factory for the creation of Dispatch * instances. * * @since JAX-WS 2.0 **/ public interface Dispatch extends BindingProvider { /** Invoke a service operation synchronously. * * The client is responsible for ensuring that the msg object * when marshalled is formed according to the requirements of the protocol * binding in use. * * @param msg An object that will form the message or payload of * the message used to invoke the operation. * @return The response message or message payload to the * operation invocation. * @throws WebServiceException If a fault occurs during communication with * the service * @throws WebServiceException If there is any error in the configuration of * the Dispatch instance **/ public T invoke(T msg); /** Invoke a service operation asynchronously. The * method returns without waiting for the response to the operation * invocation, the results of the operation are obtained by polling the * returned Response. * * The client is responsible for ensuring that the msg object * when marshalled is formed according to the requirements of the protocol * binding in use. * * @param msg An object that will form the message or payload of * the message used to invoke the operation. * @return The response message or message payload to the * operation invocation. * @throws WebServiceException If there is any error in the configuration of * the Dispatch instance **/ public Response invokeAsync(T msg); /** Invoke a service operation asynchronously. The * method returns without waiting for the response to the operation * invocation, the results of the operation are communicated to the client * via the passed in handler. * * The client is responsible for ensuring that the msg object * when marshalled is formed according to the requirements of the protocol * binding in use. * * @param msg An object that will form the message or payload of * the message used to invoke the operation. * @param handler The handler object that will receive the * response to the operation invocation. * @return A Future object that may be used to check the status * of the operation invocation. This object MUST NOT be used to try to * obtain the results of the operation - the object returned from * Future.get() is implementation dependent * and any use of it will result in non-portable behaviour. * @throws WebServiceException If there is any error in the configuration of * the Dispatch instance **/ public Future invokeAsync(T msg, AsyncHandler handler); /** Invokes a service operation using the one-way * interaction mode. The operation invocation is logically non-blocking, * subject to the capabilities of the underlying protocol, no results * are returned. When * the protocol in use is SOAP/HTTP, this method MUST block until * an HTTP response code has been received or an error occurs. * * The client is responsible for ensuring that the msg object * when marshalled is formed according to the requirements of the protocol * binding in use. * * @param msg An object that will form the message or payload of * the message used to invoke the operation. * @throws WebServiceException If there is any error in the configuration of * the Dispatch instance or if an error occurs during the * invocation. **/ public void invokeOneWay(T msg); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/RespectBinding.java0000644000175000017500000001141210676430372027753 0ustar godgod/* * 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 javax.xml.ws; // $Id: RespectBinding.java 4630 2007-09-26 10:14:18Z heiko.braun@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.Target; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.xml.ws.spi.WebServiceFeatureAnnotation; /** * This feature clarifies the use of the wsdl:binding * in a JAX-WS runtime. *

        * This feature is only useful with web services that have an * associated WSDL. Enabling this feature requires that a JAX-WS * implementation inspect the wsdl:binding for an * endpoint at runtime to make sure that all wsdl:extensions * that have the required attribute set to true * are understood and are being used. *

        * The following describes the affects of this feature with respect * to be enabled or disabled: *

          *
        • ENABLED: In this Mode, a JAX-WS runtime MUST assure that all * required wsdl:binding extensions are either understood * and used by the runtime, or explicitly disabled by the web service * application. A web service application can disable a particular * extension that has a know WebServiceFeature using * either the {@link BindingType#features} element on the server * or one of the following methods on the client: *
            *
          • {@link Service#getPort(QName,Class,WebServiceFeature...)} *
          • {@link Service#getPort(Class,WebServiceFeature...)} *
          • {@link Service#getPort(EndpointReference,Class,WebServiceFeature...)} *
          • {@link Service#createDispatch(QName,Class, * Service.Mode mode,WebServiceFeature...)} *
          • {@link Service21#createDispatch(EndpointReference, * Class,Service.Mode, * WebServiceFeature...)} *
          • {@link Service#createDispatch(QName, * JAXBContext, Service.Mode, WebServiceFeature...)} *
          • {@link Service#createDispatch(EndpointReference, * JAXBContext, Service.Mode, WebServiceFeature...)} *
          • {@link EndpointReference#getPort(Class,WebServiceFeature...)} *
          • One of the getXXXPort(WebServiceFeatures...) methods on a * generated Service. *
          * The runtime MUST also make sure that binding of * SEI parameters/return values respect the wsdl:binding. * With this feature enabled, if a required * wsdl:binding extension is in the WSDL and it is not * supported by a JAX-WS runtime and it has not * been explicitly turned off by the web service developer, then * that JAX-WS runtime MUST behave appropriately based on whether it is * on the client or server: *
            *
          • Client: runtime MUST throw a * WebServiceException no sooner than when one of the methods * above is invoked but no later than the first invocation of an endpoint * operation. *
          • throw a WebServiceException and the endpoint MUST fail to deploy *
          *
        • DISABLED: In this Mode, an implementation may choose whether * to inspect the wsdl:binding or not and to what degree * the wsdl:binding will be inspected. For example, * one implementation may choose to behave as if this feature is enabled, * another implementation may only choose to verify the SEI's * parameter/return type bindings. *
        * * @see javax.xml.ws.RespectBindingFeature * * @since JAX-WS 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @WebServiceFeatureAnnotation(id = RespectBindingFeature.ID, bean = RespectBindingFeature.class) public @interface RespectBinding { /** * Specifies if this feature is enabled or disabled. */ boolean enabled() default true; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/AsyncHandler.java0000644000175000017500000000304410613047074027422 0ustar godgod/* * 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 javax.xml.ws; // $Id: AsyncHandler.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ /** The AsyncHandler interface is implemented by * clients that wish to receive callback notification of the completion of * service endpoint operations invoked asynchronously. * * @since JAX-WS 2.0 **/ public interface AsyncHandler { /** Called when the response to an asynchronous operation is available. * * @param res The response to the operation invocation. * **/ void handleResponse(Response res); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebFault.java0000644000175000017500000000352310613047074026562 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebFault.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Used to annotate service specific exception classes to customize * to the local and namespace name of the fault element and the name * of the fault bean. * * @since JAX-WS 2.0 **/ @Target( { ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface WebFault { /** * Elements local name. **/ public String name() default ""; /** * Elements namespace name. **/ public String targetNamespace() default ""; /** * Fault bean name. **/ public String faultBean() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServiceClient.java0000644000175000017500000000412110613047074030241 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebServiceClient.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Used to annotate a generated service interface. * *

        The information specified in this annotation is sufficient * to uniquely identify a wsdl:service * element inside a WSDL document. This wsdl:service * element represents the Web service for which the generated * service interface provides a client view. * * @since JAX-WS 2.0 **/ @Target( { ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface WebServiceClient { /** * The local name of the Web service. **/ String name() default ""; /** * The namespace for the Web service. **/ String targetNamespace() default ""; /** * The location of the WSDL document for the service (a URL). **/ String wsdlLocation() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/LogicalMessage.java0000644000175000017500000000722610613047074027734 0ustar godgod/* * 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 javax.xml.ws; // $Id: LogicalMessage.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import javax.xml.bind.JAXBContext; import javax.xml.transform.Source; /** The LogicalMessage interface represents a * protocol agnostic XML message and contains methods that * provide access to the payload of the message. * * @since JAX-WS 2.0 **/ public interface LogicalMessage { /** Gets the message payload as an XML source, may be called * multiple times on the same LogicalMessage instance, always * returns a new Source that may be used to retrieve the entire * message payload. * *

        If the returned Source is an instance of DOMSource, then * modifications to the encapsulated DOM tree change the message * payload in-place, there is no need to susequently call * setPayload. Other types of Source provide only * read access to the message payload. * * @return The contained message payload; returns null if no * payload is present in this message. **/ public Source getPayload(); /** Sets the message payload * * @param payload message payload * @throws WebServiceException If any error during the setting * of the payload in this message * @throws java.lang.UnsupportedOperationException If this * operation is not supported **/ public void setPayload(Source payload); /** Gets the message payload as a JAXB object. Note that there is no * connection between the returned object and the message payload, * changes to the payload require calling setPayload. * * @param context The JAXBContext that should be used to unmarshall * the message payload * @return The contained message payload; returns null if no * payload is present in this message * @throws WebServiceException If an error occurs when using a supplied * JAXBContext to unmarshall the payload. The cause of * the WebServiceException is the original JAXBException. **/ public Object getPayload(JAXBContext context); /** Sets the message payload * * @param payload message payload * @param context The JAXBContext that should be used to marshall * the payload * @throws java.lang.UnsupportedOperationException If this * operation is not supported * @throws WebServiceException If an error occurs when using the supplied * JAXBContext to marshall the payload. The cause of * the WebServiceException is the original JAXBException. **/ public void setPayload(Object payload, JAXBContext context); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/BindingType.java0000644000175000017500000000416710613047074027272 0ustar godgod/* * 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 javax.xml.ws; // $Id: BindingType.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * The BindingType annotation is used to * specify the binding to use for a web service * endpoint implementation class. As well as specify * additional features that may be enabled. * * @since JAX-WS 2.0 * **/ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface BindingType { /** * A binding identifier (a URI). * If not specified, the default is the SOAP 1.1 / HTTP binding. *

        * See the SOAPBinding and HTTPBinding * for the definition of the standard binding identifiers. * * @see javax.xml.ws.Binding * @see javax.xml.ws.soap.SOAPBinding#SOAP11HTTP_BINDING * @see javax.xml.ws.soap.SOAPBinding#SOAP12HTTP_BINDING * @see javax.xml.ws.http.HTTPBinding#HTTP_BINDING */ String value() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Action.java0000644000175000017500000001327010613047074026266 0ustar godgod/* * 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 javax.xml.ws; // $Id: Action.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * The Action annotation allows explicit association of Action * message addressing property with input, output, and * fault messages of the mapped WSDL operation. *

        * This annotation can be specified on each method of a service endpoint interface. * For such a method, the mapped operation in the generated WSDL * contains explicit wsaw:Action attribute on the WSDL input, * output and fault messages of the WSDL operation * based upon which attributes of the Action annotation have been specified. *

        * Example 1: Specify explicit values for Action message addressing property * for input and output messages. * *

         * @javax.jws.WebService
         * public class AddNumbersImpl {
         *     @javax.xml.ws.Action(
         *         input="http://example.com/inputAction",
         *         output="http://example.com/outputAction")
         *     public int addNumbers(int number1, int number2) {
         *         return number1 + number2;
         *     }
         * }
         * 
        * * The generated WSDL looks like: *
         *   <definitions targetNamespace="http://example.com/numbers" ...>
         *   ...
         *     <portType name="AddNumbersPortType">
         *       <operation name="AddNumbers">
         *         <input message="tns:AddNumbersInput" name="Parameters"
         *           wsaw:Action="http://example.com/inputAction"/>
         *        <output message="tns:AddNumbersOutput" name="Result"
         *           wsaw:Action="http://example.com/outputAction"/>
         *       </operation>
         *     <portType>
         *   ...
         *   <definitions>
         * 
        * *

        * Example 2: Specify explicit value for Action message addressing property * for only the input message. The default values are used for the * output message. * *

         * @javax.jws.WebService
         * public class AddNumbersImpl {
         *     @javax.xml.ws.Action(input="http://example.com/inputAction")
         *     public int addNumbers(int number1, int number2) {
         *         return number1 + number2;
         *     }
         * }
         * 
        * * The generated WSDL looks like: * *
         *   <definitions targetNamespace="http://example.com/numbers" ...>
         *   ...
         *     <portType name="AddNumbersPortType">
         *       <operation name="AddNumbers">
         *         <input message="tns:AddNumbersInput" name="Parameters"
         *           wsaw:Action="http://example.com/inputAction"/>
         *        <output message="tns:AddNumbersOutput" name="Result"/>
         *       </operation>
         *     <portType>
         *   ...
         *   <definitions>
         * 
        * * It is legitimate to specify an explicit value for Action message addressing property for * output message only. In this case, a default value of wsaw:Action is used * for the input message. * *

        * Example 3: See FaultAction annotation for an example of * how to specify an explicit value for Action message addressing property for the * fault message. * * @see FaultAction * * @since JAX-WS 2.1 */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Action { /** * Explicit value of Action message addressing property for the input * message of the operation. If the value is "", then no wsaw:Action * is generated. */ String input() default ""; /** * Explicit value of Action message addressing property for the output * message of the operation. If the value is "", then no wsaw:Action * is generated. */ String output() default ""; /** * Explicit value of Action message addressing property for the fault * message(s) of the operation. Each exception that is mapped to a fault and requires explicit * Action message addressing property, need to be specified as a value in this property * using FaultAction annotation. */ FaultAction[] fault() default {}; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServiceException.java0000644000175000017500000000563110706452722030773 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebServiceException.java 4836 2007-10-20 19:24:02Z thomas.diesler@jboss.com $ /** The WebServiceException class is the base * exception class for all JAX-WS API runtime exceptions. * * @since JAX-WS 2.0 **/ public class WebServiceException extends java.lang.RuntimeException { private static final long serialVersionUID = 9050257594613372011L; /** Constructs a new exception with null as its * detail message. The cause is not initialized. **/ public WebServiceException() { super(); } /** Constructs a new exception with the specified detail * message. The cause is not initialized. * @param message The detail message which is later * retrieved using the getMessage method **/ public WebServiceException(String message) { super(message); } /** Constructs a new exception with the specified detail * message and cause. * * @param message The detail message which is later retrieved * using the getMessage method * @param cause The cause which is saved for the later * retrieval throw by the getCause method **/ public WebServiceException(String message, Throwable cause) { super(message, cause); } /** Constructs a new WebServiceException with the specified cause * and a detail message of (cause==null ? null : * cause.toString()) (which typically contains the * class and detail message of cause). * * @param cause The cause which is saved for the later * retrieval throw by the getCause method. * (A null value is permitted, and * indicates that the cause is nonexistent or * unknown.) **/ public WebServiceException(Throwable cause) { super(cause); } } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebEndpoint.java0000644000175000017500000000373210613047074027271 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebEndpoint.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Used to annotate the getPortName() * methods of a generated service interface. * *

        The information specified in this annotation is sufficient * to uniquely identify a wsdl:port element * inside a wsdl:service. The latter is * determined based on the value of the WebServiceClient * annotation on the generated service interface itself. * * @since JAX-WS 2.0 * * @see javax.xml.ws.WebServiceClient **/ @Target( { ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface WebEndpoint { /** * The local name of the endpoint. **/ String name() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Endpoint21.java0000644000175000017500000001076610676430372027011 0ustar godgod/* * 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 javax.xml.ws; import org.w3c.dom.Element; /** * @author Heiko.Braun@jboss.com * @version $Revision: 4630 $ */ public abstract class Endpoint21 extends Endpoint { /** * Returns the EndpointReference associated with * this Endpoint instance. *

        * If the Binding for this bindingProvider is * either SOAP1.1/HTTP or SOAP1.2/HTTP, then a * W3CEndpointReference MUST be returned. * If the returned EndpointReference is a * W3CEndpointReference it MUST contain * the wsaw:ServiceName element and the * wsaw:EndpointName attribute on the * wsaw:ServiceName. It SHOULD contain * the embedded WSDL in the wsa:Metadata element * if there is an associated WSDL. The * wsaw:InterfaceName MAY also be present. *
        * See * WS-Addressing - WSDL 1.0. * * @param referenceParameters Reference parameters to be associated with the * returned EndpointReference instance. * @return EndpointReference of this Endpoint instance. * If the returned EndpointReference is of type * W3CEndpointReference then it MUST contain the * the specified referenceParameters. * @throws WebServiceException If any error in the creation of * the EndpointReference or if the Endpoint is * not in the published state. * @throws UnsupportedOperationException If this BindingProvider * uses the XML/HTTP binding. * * @see javax.xml.ws.wsaddressing.W3CEndpointReference * * @since JAX-WS 2.1 **/ public abstract EndpointReference getEndpointReference(Element... referenceParameters); /** * Returns the EndpointReference associated with * this Endpoint instance. *

        * If the returned EndpointReference is a * W3CEndpointReference it MUST contain * the wsaw:ServiceName element and the * wsaw:EndpointName attribute on the * wsaw:ServiceName. It SHOULD contain * the embedded WSDL in the wsa:Metadata element * if there is an associated WSDL. The * wsaw:InterfaceName MAY also be present. *
        * See * WS-Addressing - WSDL 1.0. * * @param referenceParameters Reference parameters to be associated with the * returned EndpointReference instance. * @return EndpointReference of type clazz of this * Endpoint instance. * If the returned EndpointReference is of type * W3CEndpointReference then it MUST contain the * the specified referenceParameters. * @throws WebServiceException If any error in the creation of * the EndpointReference or if the Endpoint is * not in the published state or if the clazz is not a supported * EndpointReference type. * @throws UnsupportedOperationException If this BindingProvider * uses the XML/HTTP binding. * * * @since JAX-WS 2.1 **/ public abstract T getEndpointReference(Class clazz, Element... referenceParameters); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/Endpoint.java0000644000175000017500000002506010676430372026637 0ustar godgod/* * 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 javax.xml.ws; // $Id: Endpoint.java 4630 2007-09-26 10:14:18Z heiko.braun@jboss.com $ import javax.xml.ws.soap.SOAPBinding; import javax.xml.ws.spi.Provider; import java.util.List; import java.util.Map; /** * A Web service endpoint. * *

        Endpoints are created using the static methods defined in this * class. An endpoint is always tied to one Binding * and one implementor, both set at endpoint creation time. * *

        An endpoint is either in a published or an unpublished state. * The publish methods can be used to start publishing * an endpoint, at which point it starts accepting incoming requests. * Conversely, the stop method can be used to stop * accepting incoming requests and take the endpoint down. * Once stopped, an endpoint cannot be published again. * *

        An Executor may be set on the endpoint in order * to gain better control over the threads used to dispatch incoming * requests. For instance, thread pooling with certain parameters * can be enabled by creating a ThreadPoolExecutor and * registering it with the endpoint. * *

        Handler chains can be set using the contained Binding. * *

        An endpoint may have a list of metadata documents, such as WSDL * and XMLSchema documents, bound to it. At publishing time, the * JAX-WS implementation will try to reuse as much of that metadata * as possible instead of generating new one based on the annotations * present on the implementor. * * @since JAX-WS 2.0 * * @see javax.xml.ws.Binding * @see javax.xml.ws.BindingType * @see javax.xml.ws.soap.SOAPBinding * @see java.util.concurrent.Executor * **/ public abstract class Endpoint { /** Standard property: name of WSDL service. *

        Type: javax.xml.namespace.QName **/ public static final String WSDL_SERVICE = "javax.xml.ws.wsdl.service"; /** Standard property: name of WSDL port. *

        Type: javax.xml.namespace.QName **/ public static final String WSDL_PORT = "javax.xml.ws.wsdl.port"; /** * Creates an endpoint with the specified implementor object. If there is * a binding specified via a BindingType annotation then it MUST be used else * a default of SOAP 1.1 / HTTP binding MUST be used. *

        * The newly created endpoint may be published by calling * one of the javax.xml.ws.Endpoint#publish(String) and * javax.xml.ws.Endpoint#publish(Object) methods. * * * @param implementor The endpoint implementor. * * @return The newly created endpoint. * **/ public static Endpoint create(Object implementor) { if (implementor == null) throw new IllegalArgumentException("Implementor cannot be null"); String bindingId = SOAPBinding.SOAP11HTTP_BINDING; BindingType anBindingType = implementor.getClass().getAnnotation(BindingType.class); if (anBindingType != null) bindingId = anBindingType.value(); return create(bindingId, implementor); } /** * Creates an endpoint with the specified binding type and * implementor object. *

        * The newly created endpoint may be published by calling * one of the javax.xml.ws.Endpoint#publish(String) and * javax.xml.ws.Endpoint#publish(Object) methods. * * @param bindingId A URI specifying the binding to use. If the bindingID is * null and no binding is specified via a BindingType * annotation then a default SOAP 1.1 / HTTP binding MUST be used. * * @param implementor The endpoint implementor. * * @return The newly created endpoint. * **/ public static Endpoint create(String bindingId, Object implementor) { return Provider.provider().createEndpoint(bindingId, implementor); } /** * Returns the binding for this endpoint. * * @return The binding for this endpoint **/ public abstract Binding getBinding(); /** * Returns the implementation object for this endpoint. * * @return The implementor for this endpoint **/ public abstract Object getImplementor(); /** * Publishes this endpoint at the given address. * The necessary server infrastructure will be created and * configured by the JAX-WS implementation using some default configuration. * In order to get more control over the server configuration, please * use the javax.xml.ws.Endpoint#publish(Object) method instead. * * @param address A URI specifying the address to use. The address * MUST be compatible with the binding specified at the * time the endpoint was created. * * @throws java.lang.IllegalArgumentException * If the provided address URI is not usable * in conjunction with the endpoint's binding. * * @throws java.lang.IllegalStateException * If the endpoint has been published already or it has been stopped. **/ public abstract void publish(String address); /** * Creates and publishes an endpoint for the specified implementor * object at the given address. *

        * The necessary server infrastructure will be created and * configured by the JAX-WS implementation using some default configuration. * * In order to get more control over the server configuration, please * use the javax.xml.ws.Endpoint#create(String,Object) and * javax.xml.ws.Endpoint#publish(Object) method instead. * * @param address A URI specifying the address and transport/protocol * to use. A http: URI MUST result in the SOAP 1.1/HTTP * binding being used. Implementations may support other * URI schemes. * @param implementor The endpoint implementor. * * @return The newly created endpoint. * **/ public static Endpoint publish(String address, Object implementor) { return Provider.provider().createAndPublishEndpoint(address, implementor); } /** * Publishes this endpoint at the provided server context. * A server context encapsulates the server infrastructure * and addressing information for a particular transport. * For a call to this method to succeed, the server context * passed as an argument to it MUST be compatible with the * endpoint's binding. * * @param serverContext An object representing a server * context to be used for publishing the endpoint. * * @throws java.lang.IllegalArgumentException * If the provided server context is not * supported by the implementation or turns * out to be unusable in conjunction with the * endpoint's binding. * * @throws java.lang.IllegalStateException * If the endpoint has been published already or it has been stopped. **/ public abstract void publish(Object serverContext); /** * Stops publishing this endpoint. * * If the endpoint is not in a published state, this method * has not effect. * **/ public abstract void stop(); /** * Returns true if the endpoint is in the published state. * * @return true if the endpoint is in the published state. **/ public abstract boolean isPublished(); /** * Returns a list of metadata documents for the service. * * @return List<javax.xml.transform.Source> A list of metadata documents for the service **/ public abstract List getMetadata(); /** * Sets the metadata for this endpoint. * * @param metadata A list of XML document sources containing * metadata information for the endpoint (e.g. * WSDL or XML Schema documents) * * @throws java.lang.IllegalStateException If the endpoint * has already been published. **/ public abstract void setMetadata(List metadata); /** * Returns the executor for this Endpointinstance. * * The executor is used to dispatch an incoming request to * the implementor object. * * @return The java.util.concurrent.Executor to be * used to dispatch a request. * * @see java.util.concurrent.Executor **/ public abstract java.util.concurrent.Executor getExecutor(); /** * Sets the executor for this Endpoint instance. * * The executor is used to dispatch an incoming request to * the implementor object. * * If this Endpoint is published using the * publish(Object) method and the specified server * context defines its own threading behavior, the executor * may be ignored. * * @param executor The java.util.concurrent.Executor * to be used to dispatch a request. * * @throws SecurityException If the instance does not support * setting an executor for security reasons (e.g. the * necessary permissions are missing). * * @see java.util.concurrent.Executor **/ public abstract void setExecutor(java.util.concurrent.Executor executor); /** * Returns the property bag for this Endpoint instance. * * @return Map<String,Object> The property bag * associated with this instance. **/ public abstract Map getProperties(); /** * Sets the property bag for this Endpoint instance. * * @param properties The property bag associated with * this instance. **/ public abstract void setProperties(Map properties); } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/RequestWrapper.java0000644000175000017500000000420710613047074030042 0ustar godgod/* * 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 javax.xml.ws; // $Id: RequestWrapper.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Used to annotate methods in the Service Endpoint Interface with the request * wrapper bean to be used at runtime. The default value of the localName is * the operationName, as defined in WebMethod annotation and the * targetNamespace is the target namespace of the SEI. *

        When starting from Java this annotation is used resolve * overloading conflicts in document literal mode. Only the className * is required in this case. * * @since JAX-WS 2.0 **/ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface RequestWrapper { /** * Elements local name. **/ public String localName() default ""; /** * Elements namespace name. **/ public String targetNamespace() default ""; /** * Request wrapper bean name. **/ public String className() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/xml/ws/WebServiceRef.java0000644000175000017500000000725010613047074027545 0ustar godgod/* * 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 javax.xml.ws; // $Id: WebServiceRef.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * The WebServiceRef annotation is used to * define a reference to a web service and * (optionally) an injection target for it. * * Web service references are resources in the Java EE 5 sense. * * @see javax.annotation.Resource * * @since JAX-WS 2.0 * **/ @Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface WebServiceRef { /** * The JNDI name of the resource. For field annotations, * the default is the field name. For method annotations, * the default is the JavaBeans property name corresponding * to the method. For class annotations, there is no default * and this MUST be specified. */ String name() default ""; /** * The Java type of the resource. For field annotations, * the default is the type of the field. For method annotations, * the default is the type of the JavaBeans property. * For class annotations, there is no default and this MUST be * specified. */ Class type() default Object.class; /** * A product specific name that this resource should be mapped to. * The name of this resource, as defined by the name * element or defaulted, is a name that is local to the application * component using the resource. (It's a name in the JNDI * java:comp/env namespace.) Many application servers * provide a way to map these local names to names of resources * known to the application server. This mapped name is often a * global JNDI name, but may be a name of any form.

        * * Application servers are not required to support any particular * form or type of mapped name, nor the ability to use mapped names. * The mapped name is product-dependent and often installation-dependent. * No use of a mapped name is portable. */ String mappedName() default ""; /** * The service class, always a type extending * javax.xml.ws.Service. This element MUST be specified * whenever the type of the reference is a service endpoint interface. */ Class value() default Object.class; /** * A URL pointing to the WSDL document for the web service. * If not specified, the WSDL location specified by annotations * on the resource type is used instead. */ String wsdlLocation() default ""; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/0000755000175000017500000000000010755000272023551 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/soap/0000755000175000017500000000000010755000272024513 5ustar godgodlibjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/soap/SOAPBinding.java0000644000175000017500000000456110613047074027425 0ustar godgod/* * 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 javax.jws.soap; // $Id: SOAPBinding.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Specifies the mapping of the Web Service onto the SOAP message protocol. * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.TYPE, ElementType.METHOD }) public @interface SOAPBinding { /** * The SOAP binding style */ public enum Style { DOCUMENT, RPC }; /** * The SOAP binding use */ public enum Use { LITERAL, ENCODED }; /** * The style of mapping parameters onto SOAP messages */ public enum ParameterStyle { BARE, WRAPPED } /** * Defines the encoding style for messages send to and from the Web Service. */ Style style() default Style.DOCUMENT; /** * Defines the formatting style for messages sent to and from the Web Service. */ Use use() default Use.LITERAL; /** * Determines whether method parameters represent the entire message body, or whether the parameters are elements * wrapped inside a top-level element named after the operation */ ParameterStyle parameterStyle() default ParameterStyle.WRAPPED; } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/soap/InitParam.java0000644000175000017500000000260110676154414027253 0ustar godgod/* * 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 javax.jws.soap; // $Id: InitParam.java 4619 2007-09-25 09:46:52Z heiko.braun@jboss.com $ /** An initialization parameter * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Deprecated public @interface InitParam { /** * Name of the initialization parameter */ String name(); /** * Value of the initialization parameter */ String value(); }; libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/soap/SOAPMessageHandler.java0000644000175000017500000000405510676154414030741 0ustar godgod/* * 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 javax.jws.soap; // $Id: SOAPMessageHandler.java 4619 2007-09-25 09:46:52Z heiko.braun@jboss.com $ /** * A single SOAP message handler * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 * @deprecated */ @Deprecated public @interface SOAPMessageHandler { /** * Name of the handler. Defaults to the name of the handler class. */ String name() default ""; /** * Name of the handler class. */ String className(); /** * Array of name/value pairs that should be passed to the handler during initialization. */ InitParam[] initParams() default {}; /** * List of SOAP roles/actors implemented by the handler */ String[] roles() default {}; /** * List of SOAP headers processed by the handler. Each element in this array contains a QName which defines the * header element processed by the handler. The QNames are specified using the string notation described in the * documentation for javax.xml.namespace.QName.valueOf(String qNameAsString) */ String[] headers() default {}; }; libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/soap/SOAPMessageHandlers.java0000644000175000017500000000332510676154414031123 0ustar godgod/* * 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 javax.jws.soap; // $Id: SOAPMessageHandlers.java 4619 2007-09-25 09:46:52Z heiko.braun@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * This annotation was originally used to create a JAX-RPC handler chain. In this version, * the annotation is ALWAYS ignored. * * This annotation will be permanently removed in a future version of JSR-181. * @author thomas.diesler@jboss.org * @since 26-Apr-2005 * @deprecated */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.TYPE }) @Deprecated public @interface SOAPMessageHandlers { SOAPMessageHandler[] value(); }; libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/WebResult.java0000644000175000017500000000562010613047074026337 0ustar godgod/* * 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 javax.jws; // $Id: WebResult.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Customizes the mapping of the return value to a WSDL part and XML element. * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.METHOD }) public @interface WebResult { /** * If true, the result is pulled from a message header rather then the message body. */ boolean header() default false; /** * If the operation is rpc style and @WebResult.partName has not been specified, this is the name of the wsdl:part representing the return value. * If the operation is document style or the return value maps to a header, this is the local name of the XML element representing the return value. * * Specification Default: * If the operation is document style and the parameter style is BARE, @WebParam.operationName+”Response”. * Otherwise, “return.” */ String name() default ""; /** * The name of the wsdl:part representing this return value. * This is only used if the operation is rpc style, or if the operation is document style and the parameter style is BARE. */ String partName() default ""; /** * The XML namespace for the return value. * * Only used if the operation is document style or the return value maps to a header. If the target namespace is set to “”, this represents the empty namespace. * * Specification Default: * If the operation is document style, the parameter style is WRAPPED, and the return value does not map to a header, the empty namespace. * Otherwise, the targetNamespace for the Web Service. */ String targetNamespace() default ""; }; libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/HandlerChain.java0000644000175000017500000000431010675677656026765 0ustar godgod/* * 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 javax.jws; // $Id: HandlerChain.java 4613 2007-09-24 09:13:18Z heiko.braun@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Associates the Web Service with an externally defined handler chain. This annotation is typically used in scenarios * where embedding the handler configuration directly in the Java source is not appropriate; for example, where the * handler configuration needs to be shared across multiple Web Services, or where the handler chain consists of * handlers for multiple transports. * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD }) public @interface HandlerChain { /** * Location of the handler chain file. The location is a URL, which may be relative or absolute. Relative URLs * are relative to the location of the service implementation bean at the time of processing. */ String file(); /** * Name of the handler chain in the configuration file */ @Deprecated String name() default ""; }; libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/Oneway.java0000644000175000017500000000343510613047074025667 0ustar godgod/* * 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 javax.jws; // $Id: Oneway.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Indicates that the given @WebMethod has only an input message and no output. Typically, a oneway method returns * the thread of control to the calling application prior to executing the actual business method. A 181 processor * should report an error if an operation marked @Oneway has a return value or Holder parameters, or declares any * checked exceptions. * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.METHOD }) public @interface Oneway { } libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/WebService.java0000644000175000017500000001170410613047074026461 0ustar godgod/* * 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 javax.jws; // $Id: WebService.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marks a Java class as implementing a Web Service, or a Java interface as defining a Web Service interface. * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.TYPE }) public @interface WebService { /** * The name of the Web Service. * Used as the name of the wsdl:portType when mapped to WSDL 1.1. * Specification Default: * The simple name of the Java class or interface. */ String name() default ""; /** * The port name of the Web Service. * Used as the name of the wsdl:port when mapped to WSDL 1.1. * This member-value is not allowed on endpoint interfaces. * Specification Default: * @WebService.name + ”Port”. */ String portName() default ""; /** * If the @WebService.targetNamespace annotation is on a service endpoint interface, the targetNamespace is used for the * namespace for the wsdl:portType (and associated XML elements). * * If the @WebService.targetNamespace annotation is on a service implementation bean that does NOT reference a service * endpoint interface (through the endpointInterface attribute), the targetNamespace is used for both the wsdl:portType * and the wsdl:service (and associated XML elements). * * If the @WebService.targetNamespace annotation is on a service implementation bean that does reference a service * endpoint interface (through the endpointInterface attribute), the targetNamespace is used for only the wsdl:service * (and associated XML elements). */ String targetNamespace() default ""; /** * The service name of the Web Service. * * Used as the name of the wsdl:service when mapped to WSDL 1.1. * * This member-value is not allowed on endpoint interfaces. * * Specification Default: * The simple name of the Java class + “Service". */ String serviceName() default ""; /** * The location of a pre-defined WSDL describing the service. * * The wsdlLocation is a URL (relative or absolute) that refers to a pre-existing WSDL file. * The presence of a wsdlLocation value indicates that the service implementation bean is implementing a * pre-defined WSDL contract. The JSR-181 tool MUST provide feedback if the service implementation bean is * inconsistent with the portType and bindings declared in this WSDL. Note that a single WSDL file might * contain multiple portTypes and multiple bindings. The annotations on the service implementation bean * determine the specific portType and bindings that correspond to the Web Service. */ String wsdlLocation() default ""; /** * The complete name of the service endpoint interface defining the service’s abstract Web Service contract. * * This annotation allows the developer to separate the interface contract from the implementation. * If this annotation is present, the service endpoint interface is used to determine the abstract * WSDL contract (portType and bindings). The service endpoint interface MAY include JSR-181 annotations * to customize the mapping from Java to WSDL. * * The service implementation bean MAY implement the service endpoint interface, but is not REQUIRED to do so. * If this member-value is not present, the Web Service contract is generated from annotations on the service * implementation bean. If a service endpoint interface is required by the target environment, it will be generated into an implementation-defined package with an implementation- defined name * * This member-value is not allowed on endpoint interfaces. */ String endpointInterface() default ""; }; libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/WebMethod.java0000644000175000017500000000446010613047074026302 0ustar godgod/* * 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 javax.jws; // $Id: WebMethod.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Specifies that the given method is exposed as a Web Service operation, making it part of the Web Service's public * contract. A WebMethod annotation is required for each method that is published by the Web Service. The associated * method must be public and its parameters return value, and exceptions must follow the rules defined in JAX-RPC 1.1, * section 5. The method is not required to throw java.rmi.RemoteException. * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Retention(value = RetentionPolicy.RUNTIME) @Target( { ElementType.METHOD }) public @interface WebMethod { /** * Indicate that a method should not be exposed on the Web Service */ boolean exclude() default false; /** * Name of the wsdl:operation matching this method. By default the WSDL operation name will be the same * as the Java method name. */ String operationName() default ""; /** * The action for this operation. For SOAP bindings, this determines the value of the SOAPAction header. */ String action() default ""; }; libjboss-web-services-java-0.0+svn5660.orig/jbossws-native/javax/jws/WebParam.java0000644000175000017500000000717510613047074026130 0ustar godgod/* * 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 javax.jws; // $Id: WebParam.java 2897 2007-04-23 06:12:12Z thomas.diesler@jboss.com $ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Customizes the mapping of an individual parameter to a Web Service message part and XML element. * * @author thomas.diesler@jboss.org * @since 26-Apr-2005 */ @Retention(value = RetentionPolicy.RUNTIME) @Target(value = { ElementType.PARAMETER }) public @interface WebParam { /** * The direction in which the parameter flows */ public enum Mode { IN, OUT, INOUT }; /** * Name of the parameter. * * If the operation is rpc style and @WebParam.partName has not been specified, this is name of the wsdl:part representing the parameter. * If the operation is document style or the parameter maps to a header, this is the local name of the XML element representing the parameter. * * A name MUST be specified if the operation is document style, the parameter style is BARE, and the mode is OUT or INOUT. * * Specification Default: * If the operation is document style and the parameter style is BARE, @WebMethod.operationName. * Otherwise, argN, where N represents the index of the parameter in the method signature (starting at arg0). */ String name() default ""; /** * The name of the wsdl:part representing this return value. * This is only used if the operation is rpc style, or if the operation is document style and the parameter style is BARE. */ String partName() default ""; /** * The XML namespace for the parameter. * * Only used if the operation is document style or the paramater maps to a header. If the target namespace is set to “”, this represents the empty namespace. * * Specification Default: * If the operation is document style, the parameter style is WRAPPED, and the parameter does not map to a header, the empty namespace. * Otherwise, the targetNamespace for the Web Service. */ String targetNamespace() default ""; /** * The direction in which the parameter is flowing. One of IN, OUT, or INOUT. The OUT and INOUT modes may only be * specified for parameter types that conform to the JAX-RPC definition of Holder types. See JAX-RPC 1.1, section * 4.3.5. OUT and INOUT modes are only supported for RPC bindings or for parameters that map to headers. */ Mode mode() default Mode.IN; /** * If true, the parameter is pulled from a message header rather then the message body. */ boolean header() default false; };