You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(233) |
Sep
(199) |
Oct
(206) |
Nov
(185) |
Dec
(270) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(232) |
Feb
(426) |
Mar
(623) |
Apr
(592) |
May
(506) |
Jun
(389) |
Jul
(160) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(9) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(2) |
Sep
(12) |
Oct
(10) |
Nov
(54) |
Dec
(49) |
2009 |
Jan
(19) |
Feb
(13) |
Mar
(20) |
Apr
(24) |
May
(44) |
Jun
(29) |
Jul
(32) |
Aug
(10) |
Sep
(7) |
Oct
(10) |
Nov
(4) |
Dec
(17) |
2010 |
Jan
(14) |
Feb
(5) |
Mar
(23) |
Apr
(50) |
May
(31) |
Jun
(9) |
Jul
(5) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(12) |
Feb
(5) |
Mar
(5) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jbo...@li...> - 2006-06-30 18:43:09
|
Author: estebanschifman Date: 2006-06-30 14:43:05 -0400 (Fri, 30 Jun 2006) New Revision: 4889 Added: labs/jbossesb/trunk/ESBCore/EsbListeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java Log: A new abtract class that can be extended for any "poller" e.g. Directory poller, SQL table poller, Email poller, etc See how it's used in "BetterDirListener" (that replaces DirListener) Added: labs/jbossesb/trunk/ESBCore/EsbListeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java =================================================================== --- labs/jbossesb/trunk/ESBCore/EsbListeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-06-30 18:40:04 UTC (rev 4888) +++ labs/jbossesb/trunk/ESBCore/EsbListeners/src/org/jboss/soa/esb/listeners/AbstractPoller.java 2006-06-30 18:43:05 UTC (rev 4889) @@ -0,0 +1,289 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2006, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ + + +package org.jboss.soa.esb.listeners; + +import java.util.*; + +import org.apache.log4j.*; + +import javax.naming.*; +import javax.jms.*; + +import org.jboss.soa.esb.util.*; +import org.jboss.soa.esb.common.*; +import org.jboss.soa.esb.helpers.*; +import org.jboss.soa.esb.parameters.*; + +public abstract class AbstractPoller +{ + + protected abstract void executeOneCycle()throws Exception; + protected abstract GroupOfChilds newChildGroup(ThreadGroup pThG) throws Exception; + + public static final String PARM_POLL_LTCY = "pollLatency"; + public static final String PARM_RELOAD_LTCY = "reloadLatency"; + + public static final String PARM_TOPIC_CONN_FACT = "topicConnFactoryClass"; + public static final String PARM_QUIESCE_TOPIC = "quiesceTopic"; + public static final String PARM_QUIESCE_SELECTOR = "quiesceSelector"; + + protected ThreadGroup m_oThrGrp = Thread.currentThread().getThreadGroup(); + protected Map<String,GroupOfChilds> m_omChildPrc + = new HashMap<String,GroupOfChilds>(); + + protected ParamsRepository m_oParmRepos; + protected Name m_oParmsName; + protected Logger m_oLogger; + + protected DomElement m_oParms; + protected boolean m_bEndRequested; + + protected TopicConnection m_oTopicConn; + protected TopicSession m_oSession; + protected Topic m_oTopic; + protected TopicSubscriber m_oTopicSubs; + + + protected AbstractPoller(String p_sParamsUid) throws Exception + { + m_oLogger = EsbUtil.getDefaultLogger(this.getClass()); + + String sFactoryClass = EsbSysProps.getParamsReposFactoryClass(); + m_oParmRepos = ParamsReposUtil.reposFromFactory(sFactoryClass,null); + m_oParmsName = ParamsReposUtil.nameFromString(p_sParamsUid); + } //__________________________________ + + protected void runUntilEndRequested() throws Exception + { while (! m_bEndRequested) + { try + { String sMsg = (null == m_oParms) + ? "Initial Parameter loading" : "Reloading Params"; + m_oLogger.info(formatLogMsg(sMsg)); + m_oParms = m_oParmRepos.getElement(m_oParmsName); + } + catch (Exception e) + { + StringBuilder sb = new StringBuilder ("Problems loading params ") + .append(m_oParmsName) + .append((null==m_oParms)? " exiting..." : "continuing to use cached params") + ; + m_oLogger.error(formatLogMsg(sb.toString())); + if (null==m_oParms) + throw e; + } + quiesceTopicSubscribe(); + executeOneCycle(); + } + } //__________________________________ + + protected String formatLogMsg(String p_s) + { return new StringBuilder("Processor '") + .append(EsbUtil.classSuffix(this.getClass())).append("' <") + .append(p_s).append("") + .toString(); + } //__________________________________ + + private final void quiesceTopicSubscribe() throws JMSException, NamingException + { + try + { + m_oTopicConn = null; + m_oSession = null; + m_oTopic = null; + m_oTopicSubs = null; + + String sStopTopic = m_oParms.getAttr(PARM_QUIESCE_TOPIC); + if (EsbUtil.isNullString(sStopTopic)) + return; + String sFactClass = m_oParms.getAttr(PARM_TOPIC_CONN_FACT); + if (EsbUtil.isNullString(sFactClass)) + sFactClass = "ConnectionFactory"; + + String sJndiType = EsbSysProps.getJndiServerType(); + String sJndiURL = EsbSysProps.getJndiServerURL(); + Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiURL); + Object tmp = oJndiCtx.lookup(sFactClass); + TopicConnectionFactory tcf = (TopicConnectionFactory) tmp; + + m_oTopicConn = tcf.createTopicConnection(); + m_oTopic = (Topic) oJndiCtx.lookup(sStopTopic); + m_oSession = m_oTopicConn.createTopicSession + (false,TopicSession.AUTO_ACKNOWLEDGE); + m_oTopicConn.start(); + + String sSelector = m_oParms.getAttr(PARM_QUIESCE_SELECTOR); + if (EsbUtil.isNullString(sSelector)) + sSelector = "processor='"+EsbUtil.classSuffix(this.getClass())+"'"; + m_oTopicSubs = m_oSession.createSubscriber(m_oTopic, sSelector,true); + } + catch (Exception e) + { m_oLogger.error("Problems connecting to JMS. ",e); + } + + } //_________________________________________ + + protected boolean waitForQuiesce(long p_lMillis) throws Exception + { + try + { boolean bSleep = (null== m_oTopicSubs); + Object oMsg = (bSleep) ? null : secureReceive(p_lMillis); + + if (null!=oMsg) + { m_oLogger.info("Starting Quiesce of " + +EsbUtil.classSuffix(this.getClass())); + return true; + } + if (bSleep) + Thread.sleep(p_lMillis); + return false; + + } + catch (Exception e) + { m_oLogger.error("Problems with waitForQuiesce. ",e); + Thread.sleep(p_lMillis); + return false; + } + } //_________________________________________ + + private Message secureReceive(long p_lMillis) throws Exception + { + while (true) + try + { return (null==m_oTopicSubs) ? null : m_oTopicSubs.receive(p_lMillis); } + catch (JMSException e) + { + // put here your recovery code + return null; + } + + } //_________________________________________ + + + protected void oneScan(DomElement p_oP, boolean p_bFirst) throws Exception + { + String sPrcName = p_oP.getName(); + if (!m_omChildPrc.containsKey(sPrcName)) + { + ThreadGroup[] oaCh = new ThreadGroup[m_oThrGrp.activeGroupCount()]; + int iMax = m_oThrGrp.enumerate(oaCh); + + ThreadGroup oThG = null; + for (int i1 = 0; null == oThG && i1 < iMax; i1++) + { if (m_oThrGrp.getName().equals(sPrcName)) + oThG = oaCh[i1]; + } + if (null == oThG) + oThG = new ThreadGroup(sPrcName); + m_omChildPrc.put(sPrcName, newChildGroup(oThG)); + } + GroupOfChilds oChildGrp = m_omChildPrc.get(sPrcName); + + if (null == oChildGrp) return; + if (p_bFirst) + oChildGrp.m_bError = false; + + try + { + oChildGrp.execute(p_oP); + } + catch (Exception e) + { + oChildGrp.m_bError = true; + m_oLogger.error(formatLogMsg("GroupOfChilds.execute"), e); + } + } //_________________________________________ + + protected abstract class GroupOfChilds implements Observer + { + protected abstract void doYourJob(DomElement p_oP) throws Exception; + + public static final String PARM_MAX_THREADS = "maxThreads"; + + protected ThreadGroup m_oThrGrp; + protected boolean m_bError = false; + + protected Class m_oExecClass; + protected DomElement m_oChParms; + + protected int m_iQthr = 0, m_iMaxThr; + protected StringBuilder m_sb; + protected int m_iSbIni; + + protected GroupOfChilds(ThreadGroup p_oThrGrp) throws Exception + { + m_oThrGrp = p_oThrGrp; + m_sb = new StringBuilder("GroupOfThreads ") + .append(m_oThrGrp.getName()).append(" : "); + m_iSbIni = m_sb.length(); + } //________________________________ + + public void update(Observable p_oObs, Object p_oUsrObj) + { + if (p_oUsrObj instanceof Integer) + { + updQthreads( ( (Integer) p_oUsrObj).intValue()); + } + } //________________________________ + + private synchronized void updQthreads(int p_i) + { + m_iQthr += p_i; + } //________________________________ + + private void execute(DomElement p_oP) throws Exception + { + m_sb.setLength(m_iSbIni); + if (m_bError) + { + m_oLogger.warn(m_sb.append(" Skipping execution due to previous errors") + .toString()); + return; + } + checkParms(p_oP); + doYourJob (p_oP); + } //________________________________ + + protected void setMaxThreads(DomElement p_oP,int p_iMax) + { + String sAtt = p_oP.getAttr(PARM_MAX_THREADS); + m_iMaxThr = (null == sAtt) ? 1 : Integer.parseInt(sAtt); + m_iMaxThr = (m_iMaxThr < 1) ? 1 + : (m_iMaxThr > p_iMax) ? p_iMax + : m_iMaxThr; + + } //________________________________ + + // Very basic checkParms method + // Remember to call super.checkParms(p_oP) in derived checkParms() methods + // so your parameters will be cloned + // and to add REAL parameter checking + protected void checkParms(DomElement p_oP) throws Exception + { + m_sb.setLength(0); + m_oChParms = p_oP.cloneObj(); + setMaxThreads(p_oP,10); + } //________________________________ + + } //______________________________________________________ +} //____________________________________________________________________________ |
From: <jbo...@li...> - 2006-06-30 18:40:13
|
Author: estebanschifman Date: 2006-06-30 14:40:04 -0400 (Fri, 30 Jun 2006) New Revision: 4888 Modified: labs/jbossesb/trunk/ESBCore/EsbListeners/src/org/jboss/soa/esb/listeners/DirListener.java Log: This listener is deprecated (although it still works because the parameter tree hasn't changed) Please see new example: BetterDirListener and AbstractPoller class. Modified: labs/jbossesb/trunk/ESBCore/EsbListeners/src/org/jboss/soa/esb/listeners/DirListener.java =================================================================== --- labs/jbossesb/trunk/ESBCore/EsbListeners/src/org/jboss/soa/esb/listeners/DirListener.java 2006-06-30 13:53:54 UTC (rev 4887) +++ labs/jbossesb/trunk/ESBCore/EsbListeners/src/org/jboss/soa/esb/listeners/DirListener.java 2006-06-30 18:40:04 UTC (rev 4888) @@ -45,14 +45,14 @@ new DirListener(args[0]); } //________________________________ - public static final String PARM_POLL_LTCY = "pollLatency"; - public static final String PARM_RELOAD_LTCY = "reloadLatency"; + public static final String PARM_POLL_LTCY = "pollLatency"; + public static final String PARM_RELOAD_LTCY = "reloadLatency"; - public static final String PARM_MAX_THREADS = "maxThreads"; + public static final String PARM_MAX_THREADS = "maxThreads"; public static final String PARM_FILE_PROCESSOR_CLASS = "fileProcessorClass"; - public static final String PARM_INPUT_DIR = "inputDirURI"; - public static final String PARM_SUFFIX = "inputSuffix"; + public static final String PARM_INPUT_DIR = "inputDirURI"; + public static final String PARM_SUFFIX = "inputSuffix"; private Map<String,GroupOfChilds> m_omChildPrc = new HashMap<String,GroupOfChilds>(); @@ -161,8 +161,9 @@ String sStopTopic = "topic/quiesce"; StringBuilder sb = new StringBuilder("processor='DirListener'"); - String sJndiServer = EsbSysProps.getDefaultJndiServer(); - Context oJndiCtx = AppServerContext.getServerContext(sJndiServer); + String sJndiType = EsbSysProps.getJndiServerType(); + String sJndiServer = EsbSysProps.getJndiServerURL(); + Context oJndiCtx = AppServerContext.getServerContext(sJndiType,sJndiServer); Object tmp = oJndiCtx.lookup("UIL2ConnectionFactory"); TopicConnectionFactory tcf = (TopicConnectionFactory) tmp; @@ -315,7 +316,7 @@ } } //________________________________ - private void checkParms(DomElement p_oP) throws Exception + protected void checkParms(DomElement p_oP) throws Exception { String sAtt = p_oP.getAttr(PARM_MAX_THREADS); m_iMaxThr = (null == sAtt) ? 1 : Integer.parseInt(sAtt); |
From: <jbo...@li...> - 2006-06-30 16:54:49
|
Author: dar...@jb... Date: 2006-06-30 12:54:45 -0400 (Fri, 30 Jun 2006) New Revision: 538 Modified: trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java Log: Merged fix for JBWS-1010 from branch/jbossws-1.0 to trunk Modified: trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java =================================================================== --- trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java 2006-06-30 14:08:12 UTC (rev 537) +++ trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java 2006-06-30 16:54:45 UTC (rev 538) @@ -78,7 +78,7 @@ public ToolsEndpointMetaData generate() { - generateOperationMetaData(seiClass.getDeclaredMethods()); + generateOperationMetaData(seiClass.getMethods()); return tmd; } |
From: <jbo...@li...> - 2006-06-30 14:08:20
|
Author: hei...@jb... Date: 2006-06-30 10:08:12 -0400 (Fri, 30 Jun 2006) New Revision: 537 Modified: branches/jbossws-1.0/version.properties Log: move to XB snapshot release Modified: branches/jbossws-1.0/version.properties =================================================================== --- branches/jbossws-1.0/version.properties 2006-06-30 13:50:50 UTC (rev 536) +++ branches/jbossws-1.0/version.properties 2006-06-30 14:08:12 UTC (rev 537) @@ -14,7 +14,7 @@ apache-xmlsec=1.3.0 ibm-wsdl4j=1.5.2jboss javassist=3.2.0.CR2 -jboss-jbossxb=1.0.0.CR5_JBoss-4.0.4.GA +jboss-jbossxb=snapshot jboss-microcontainer=1.0.2 jboss-remoting=1.4.3.GA |
From: <jbo...@li...> - 2006-06-30 13:54:05
|
Author: unibrew Date: 2006-06-30 09:53:54 -0400 (Fri, 30 Jun 2006) New Revision: 4887 Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewTopic.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml Log: [JBFORUMS-54] Working on SplitTopic view and on new tag for SplitView and TopicView. Clearing ModeratorAction. Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java 2006-06-30 08:05:20 UTC (rev 4886) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java 2006-06-30 13:53:54 UTC (rev 4887) @@ -24,9 +24,14 @@ import java.text.DecimalFormat; import java.util.Date; +import javax.faces.context.FacesContext; + import javax.portlet.ActionRequest; +import javax.portlet.PortletRequest; +import org.jboss.portal.format.render.bbcodehtml.ToHTMLConfig; + /** * @author <a href="mailto:soh...@jb...">Sohil Shah</a> * @@ -93,4 +98,5 @@ return dateStr; } + } Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2006-06-30 08:05:20 UTC (rev 4886) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2006-06-30 13:53:54 UTC (rev 4887) @@ -22,6 +22,8 @@ package org.jboss.portlet.forums.ui; +import java.io.StringWriter; + import java.util.Date; import java.util.Iterator; @@ -29,8 +31,13 @@ import java.text.SimpleDateFormat; +import java.util.Locale; import java.util.Map; +import java.util.ResourceBundle; + +import javax.faces.component.UIViewRoot; + import org.apache.log4j.Logger; //jsf @@ -44,10 +51,17 @@ import javax.portlet.RenderResponse; import javax.portlet.PortletRequest; +import javax.servlet.ServletRequest; + +import javax.servlet.http.HttpServletRequest; + import org.jboss.portal.core.CoreConstants; import org.jboss.portal.core.modules.ModuleConstants; import org.jboss.portal.core.modules.UserModule; import org.jboss.portal.core.model.User; +import org.jboss.portal.format.render.bbcodehtml.ToHTMLConfig; +import org.jboss.portal.format.render.bbcodehtml.ToHTMLRenderer; +import org.jboss.portal.format.util.CLLoader; import org.jboss.portlet.forums.ForumsConstants; import org.jboss.portlet.forums.model.Poster; import org.jboss.portlet.forums.impl.PosterImpl; @@ -67,6 +81,7 @@ */ public class PortalUtil { + private static CLLoader loader = new CLLoader("template"); private static Logger log = Logger.getLogger(PortalUtil.class); private static CoreConstants coreConstants = new CoreConstants() { @@ -314,7 +329,78 @@ return poster; } + + /** + * + * @return + */ + public static String formatMessage( String text , boolean allowHTML ) { + Object req = FacesContext.getCurrentInstance().getExternalContext().getRequest(); + + if (allowHTML) + { + getToHTMLRenderer(req).getConfig().setFilterMode(ToHTMLConfig.FILTER_MODE_ALWAYS_PRINT); + getToHTMLRenderer(req).getConfig().setOuputMode(ToHTMLConfig.OUTPUT_MODE_REMOVE); + } + else + { + getToHTMLRenderer(req).getConfig().setFilterMode(ToHTMLConfig.FILTER_MODE_NEVER_PRINT); + getToHTMLRenderer(req).getConfig().setOuputMode(ToHTMLConfig.OUTPUT_MODE_REMOVE); + } + return formatTitle(req, text); + } + + /** + * + * @param text + * @return + */ + public static String formatTitle(Object req, String text) + { + StringWriter stringWriter = new StringWriter(); + getToHTMLRenderer(req).setWriter(stringWriter); + System.out.println("REQ: "+req+" TEXT: "+text); + getToHTMLRenderer(req).render(text.toCharArray(), 0, text.length()); + return stringWriter.toString(); + } + + /** + * + * @return + */ + private static ToHTMLRenderer getToHTMLRenderer(Object req) { + ToHTMLRenderer renderer = null; + PortletRequest porReq = null; + HttpServletRequest serReq = null; + if (req instanceof PortletRequest) { + porReq = (PortletRequest)req; + renderer = (ToHTMLRenderer)porReq.getPortletSession().getAttribute("RENDERER"); + } else { + serReq = (HttpServletRequest)req; + // TODO: GETTING RENDERER FROM APPLICATION SCOPE ATTRIBUTE + } + if (renderer == null) { + + // Getting ResourceBundle with current Locale + FacesContext ctx = FacesContext.getCurrentInstance(); + UIViewRoot uiRoot = ctx.getViewRoot(); + Locale locale = uiRoot.getLocale(); + ClassLoader ldr = Thread.currentThread().getContextClassLoader(); + ResourceBundle bundle = ResourceBundle.getBundle("ResourceJSF", locale, ldr); + // Create the HTMLRenderer for BBCode + ToHTMLConfig config = new ToHTMLConfig(); + config.setLoader(loader); + renderer = new ToHTMLRenderer(config, bundle); + if (porReq!=null) { + porReq.getPortletSession().setAttribute("RENDERER", renderer); + } else if (serReq!=null){ + // TODO: SETTING RENDERER IN APPLICATION SCOPE ATTRIBUTE + } + } + return renderer; + } + /** * * @return Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-06-30 08:05:20 UTC (rev 4886) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-06-30 13:53:54 UTC (rev 4887) @@ -26,23 +26,17 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlInputHidden; import javax.faces.context.FacesContext; -import org.jboss.portlet.forums.ForumsModuleExtension; import org.jboss.portlet.forums.model.Forum; import org.jboss.portlet.forums.model.Topic; -import org.jboss.portlet.forums.theme.FolderType; -import org.jboss.portlet.forums.theme.ForumsTheme; import org.jboss.portlet.forums.ui.BaseController; import org.jboss.portlet.forums.ui.Constants; import org.jboss.portlet.forums.ui.ForumUtil; @@ -416,7 +410,6 @@ if(f!=null && f.trim().length()>0) { forumId = Integer.parseInt(f); - System.out.println("HELLO 1"); } checkboxes=new HashMap(); @@ -433,7 +426,6 @@ Integer.parseInt(this.userPreferences.getPreference(Constants.TOPICS_FORUM_KEY)), currentPage //currently selected page being displayed, first page by default ); - System.out.println("HELLO 2"); this.page = this.pageNavigator.getPage(); } else { // trying to get forumId from topicId read from request @@ -451,10 +443,7 @@ ); this.page = this.pageNavigator.getPage(); } - System.out.println("HELLO 3"); } - - System.out.println("FORUM: "+this.forum); } Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2006-06-30 08:05:20 UTC (rev 4886) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2006-06-30 13:53:54 UTC (rev 4887) @@ -22,7 +22,15 @@ package org.jboss.portlet.forums.ui.action; +import java.util.Collection; +import java.util.Map; + +import org.jboss.portlet.forums.model.Topic; import org.jboss.portlet.forums.ui.BaseController; +import org.jboss.portlet.forums.ui.Constants; +import org.jboss.portlet.forums.ui.ForumUtil; +import org.jboss.portlet.forums.ui.JSFUtil; +import org.jboss.portlet.forums.ui.view.PageNavigator; /** * @author <a href="mailto:rys...@jb...">Ryszard Kozmik</a> @@ -30,8 +38,9 @@ public class SplitTopic extends BaseController { private String newTopicTitle; + private Map checkboxes; + private Topic topic; - public void setNewTopicTitle(String newTopicTitle) { this.newTopicTitle = newTopicTitle; } @@ -39,4 +48,54 @@ public String getNewTopicTitle() { return newTopicTitle; } + + public void setCheckboxes(Map checkboxes) + { + this.checkboxes = checkboxes; + } + + public Map getCheckboxes() + { + return checkboxes; + } + + public Topic getTopic() { + return topic; + } + + + /** + * + */ + public boolean isInitialized() + { + boolean initialized = false; + try + { + this.execute(); + initialized = true; + } + catch(Exception e) + { + JSFUtil.handleException(e); + } + return initialized; + } + + private void execute() throws Exception + { + //parse input data + int topicId = -1; + String t = ForumUtil.getParameter(Constants.p_topicId); + String page = ForumUtil.getParameter(Constants.p_page); + if (t != null && t.trim().length() > 0) { + topicId = Integer.parseInt(t); + } + + //process the topic information + if (topicId != -1) { + this.topic = BaseController.getForumsModule().findTopicById(new Integer(topicId)); + } + } + } Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewTopic.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewTopic.java 2006-06-30 08:05:20 UTC (rev 4886) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewTopic.java 2006-06-30 13:53:54 UTC (rev 4887) @@ -52,8 +52,8 @@ */ private Topic topic; private boolean rowClass; - private long postDays=0L; // This is value of selectItem describing time constraint for displayed posts - private PageNavigator pageNavigator = null; + private long postDays=0L; // This is value of selectItem describing time constraint for displayed posts + private PageNavigator pageNavigator = null; private Collection page = new ArrayList(); /** @@ -183,45 +183,40 @@ /** * This method gets topicId from parameters and tries to find topic with that id. */ - private void execute() throws Exception - { + private void execute() throws Exception { //parse input data - int topicId = -1; - String t = ForumUtil.getParameter(Constants.p_topicId); - String page = ForumUtil.getParameter(Constants.p_page); - if(t!=null && t.trim().length()>0) - { - topicId = Integer.parseInt(t); - } - - //process the topic information - if(topicId!=-1) - { - this.topic = BaseController.getForumsModule().findTopicById(new Integer(topicId)); - Collection posts = this.topic.getPosts(); - - if(posts!=null && posts.size()>0) - { - int currentPage = 0; - if(page!=null && page.trim().length()>0) - { - //setup the page data - currentPage = Integer.parseInt(page); - } - - //setup the pageNavigator - this.pageNavigator = new PageNavigator( - posts.toArray(), //total number of entries to be split up into pages - Integer.parseInt(this.userPreferences.getPreference(Constants.POSTS_TOPIC_KEY)), - currentPage //currently selected page being displayed, first page by default - ); - - - - this.page = this.pageNavigator.getPage(); - } - } - } + int topicId = -1; + String t = ForumUtil.getParameter(Constants.p_topicId); + String page = ForumUtil.getParameter(Constants.p_page); + if (t != null && t.trim().length() > 0) { + topicId = Integer.parseInt(t); + } + + //process the topic information + if (topicId != -1) { + this.topic = + BaseController.getForumsModule().findTopicById(new Integer(topicId)); + Collection posts = this.topic.getPosts(); + + if (posts != null && posts.size() > 0) { + int currentPage = 0; + if (page != null && page.trim().length() > 0) { + //setup the page data + currentPage = Integer.parseInt(page); + } + + //setup the pageNavigator + //total number of entries to be split up into pages + //currently selected page being displayed, first page by default + this.pageNavigator = + new PageNavigator(posts.toArray(), Integer.parseInt(this.userPreferences.getPreference(Constants.POSTS_TOPIC_KEY)), + currentPage); + + + this.page = this.pageNavigator.getPage(); + } + } + } //implement this functionality later in 1.1.0 release of forums------------------------------------------------------------------------------------------------------------------------------------------------- Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml 2006-06-30 08:05:20 UTC (rev 4886) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml 2006-06-30 13:53:54 UTC (rev 4887) @@ -67,9 +67,8 @@ <function-name>dateStr</function-name> <function-class>org.jboss.portlet.forums.ui.ForumUtil</function-class> <function-signature>java.lang.String getDateStr(java.util.Date)</function-signature> - </function> + </function> - <!-- application specific functions --> <!-- function calculates the vote percent for the specified poll option @@ -79,6 +78,15 @@ <function-class>org.jboss.portlet.forums.ui.PortalUtil</function-class> <function-signature>float getVotePercent(org.jboss.portlet.forums.model.Poll,org.jboss.portlet.forums.model.PollOption)</function-signature> </function> + + <!-- + Method for processing posts' messages. + --> + <function> + <function-name>formatMessage</function-name> + <function-class>org.jboss.portlet.forums.ui.PortalUtil</function-class> + <function-signature>java.lang.String formatMessage(java.lang.String,boolean)</function-signature> + </function> <!-- function to get theme URL location --> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml 2006-06-30 08:05:20 UTC (rev 4886) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_split.xhtml 2006-06-30 13:53:54 UTC (rev 4887) @@ -32,7 +32,7 @@ <ui:composition template="/views/common/common.xhtml"> <ui:define name="mainContent"> <c:if test="#{splitTopic.initialized && splitTopic.topic!=null && splitTopic.topic.id!=-1}"> -<forums:isAllowed fragment="acl://moderateForum" contextData="#{splitTopic.forum}"> +<forums:isAllowed fragment="acl://moderateForum" contextData="#{splitTopic.topic.forum}"> <h:messages layout="table" infoStyle="color:green" warnStyle="color:red"/> <h:form> @@ -43,8 +43,8 @@ ->&nbsp; <h:outputLink value="#{forums:outputLink(shared.links['forum'],true)}" styleClass="nav"> - <f:param name="f" value="#{splitTopic.forum.id}"/> - <h:outputText value="#{splitTopic.forum.name}"/> + <f:param name="f" value="#{splitTopic.topic.forum.id}"/> + <h:outputText value="#{splitTopic.topic.forum.name}"/> </h:outputLink> </span> </td> @@ -104,18 +104,18 @@ border="0" align="center"> <tr> <td width="50%" align="center"> - <h:commandButton action="{splitTopic.splitPosts}" + <h:commandButton action="${splitTopic.splitPosts}" type="submit" class="liteoption" name="split_type_all" - value="{resource.L_SPLIT_POSTS}"/> + value="${resource.L_SPLIT_POSTS}"/> </td> <td width="50%" align="center"> - <h:commandButton action="{splitTopic.splitAfter}" + <h:commandButton action="${splitTopic.splitAfter}" type="submit" class="liteoption" name="split_type_beyond" - value="{resource.L_SPLIT_AFTER}"/> + value="${resource.L_SPLIT_AFTER}"/> </td> </tr> </table> @@ -128,23 +128,23 @@ </tr> <c:forEach items="#{splitTopic.topic.posts}" var="postrow" varStatus="status" > <tr> - <td align="left" valign="top" class="${n:out("postrow.ROW_CLASS")}"> + <td align="left" valign="top" class='${(status.index%2==0)?"row1":"row2"}'> <span class="name"> - <a name="${n:out("postrow.U_POST_ID")}"></a> - ${n:out("postrow.POSTER_NAME")} + <a name="${postrow.id}"></a> + ${postrow.poster.user.userName} </span> </td> - <td width="100%" valign="top" class="${n:out("postrow.ROW_CLASS")}"> + <td width="100%" valign="top" class='${(status.index%2==0)?"row1":"row2"}'> <table width="100%" cellspacing="0" cellpadding="3" border="0"> <tr> <td valign="middle"> - <img src="${n:out("postrow.IMG_MINIPOST")}" alt="${resource.L_POST}"> + <img src="#{forums:themeURL('resourceIconMinipostURL')}" alt="${resource.L_POST}" /> <span class="postdetails"> ${resource.L_POSTED}: - ${n:out("postrow.POST_DATE")} - + #{forums:dateStr(postrow.createDate)} + &nbsp;&nbsp;&nbsp;&nbsp; ${resource.L_POST_SUBJECT}: - ${n:out("postrow.POST_SUBJECT")} + ${postrow.message.subject} </span> </td> </tr> @@ -152,25 +152,25 @@ <td valign="top"> <hr size="1"/> <span class="postbody"> - ${n:out("postrow.MESSAGE")} + <!-- TODO: PROBLEM WITH THIS TAG!: #{forums:formatMessage(postrow.message.text,??false??)}--> + ${postrow.message.text} + <br /><br /> + ${postrow.poster.user.signature} </span> </td> </tr> </table> </td> - <td width="5%" align="center" class="${n:out("postrow.ROW_CLASS")}"> - <%--${n:out("postrow.S_SPLIT_CHECKBOX")}--%> - <input type="checkbox" - name="post_id_list[${n:out("postrow.POST_ROW_INDEX")}]" - value="${n:out("postrow.POST_ID")}"/> + <td width="5%" align="center" class='${(status.index%2==0)?"row1":"row2"}'> + <h:selectBooleanCheckbox value="#{splitTopic.checkboxes[postrow.id]}"/> </td> </tr> <tr> <td colspan="3" height="1" class="row3"> - <img src="${n:out("postrow.IMG_SPACER")}" width="1" height="1" alt="."> + <img src="#{forums:themeURL('resourceIconSpacerURL')}" width="1" height="1" alt="." /> </td> </tr> - </n:iterate> + </c:forEach> <tr> <td class="catBottom" colspan="3" height="28"> <table width="60%" cellspacing="0" cellpadding="0" border="0" align="center"> @@ -182,7 +182,6 @@ <td width="50%" align="center"> <input class="liteoption" type="submit" name="split_type_beyond" value="${resource.L_SPLIT_AFTER}"/> - ${n:out("S_HIDDEN_FIELDS")} </td> </tr> </table> @@ -191,11 +190,10 @@ </table> <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2"> <tr> - <td align="right" valign="top"> - <span class="gensmall"> - ${n:out("S_TIMEZONE")} - </span> - </td> + <!-- integrate jumpbox here --> + <td align="right" valign="top" nowrap="nowrap"> + <ui:include src="/views/jumpbox.xhtml"/> + </td> </tr> </table> </h:form> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2006-06-30 08:05:20 UTC (rev 4886) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2006-06-30 13:53:54 UTC (rev 4887) @@ -256,11 +256,12 @@ </h:outputLink> <span class="postdetails"> ${resource.Posted}:&nbsp; - <h:outputText value="${postrow.createDate}"> - <f:convertDateTime pattern="EEE MMM d, yyyy HH:mm:ss aaa" /> - </h:outputText> + #{forums:dateStr(postrow.createDate)} <span class="gen">&nbsp;</span> - &nbsp; &nbsp;${resource.Post_subject}&nbsp;:&nbsp;${postrow.message.subject} + &nbsp;&nbsp; + ${resource.Post_subject} + &nbsp;:&nbsp; + ${postrow.message.subject} </span> </td> <!-- "Quote", "Edit", and "Delete" buttons --> @@ -305,7 +306,12 @@ </tr> <tr> <td colspan="2"> - <span class="postbody">${postrow.message.text}</span> + <span class="postbody"> + <!-- TODO: PROBLEM WITH THIS TAG!: #{forums:formatMessage(postrow.message.text,??false??)}--> + ${postrow.message.text} + <br /><br /> + ${postrow.poster.user.signature} + </span> <c:if test="postrow.attachments">--> <ui:include src="/views/topics/attachmentsview.xhtml"> @@ -339,11 +345,6 @@ </c:if> </td> </tr> - <tr> - <td colspan="2"> - <span class="postbody">${postrow.poster.user.signature}</span> - </td> - </tr> </table> </td> </tr> |
From: <jbo...@li...> - 2006-06-30 13:50:55
|
Author: tho...@jb... Date: 2006-06-30 09:50:50 -0400 (Fri, 30 Jun 2006) New Revision: 536 Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanJAXB.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/UserType.java Log: use JAXBElement Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanJAXB.java =================================================================== --- trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanJAXB.java 2006-06-30 13:46:12 UTC (rev 535) +++ trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanJAXB.java 2006-06-30 13:50:50 UTC (rev 536) @@ -26,6 +26,7 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.util.JAXBSource; +import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.ws.Provider; import javax.xml.ws.Service; @@ -48,9 +49,12 @@ try { JAXBContext jc = JAXBContext.newInstance(UserType.class.getPackage().getName()); - JAXBElement jaxbEl = (JAXBElement)jc.createUnmarshaller().unmarshal(request); - UserType user = (UserType)jaxbEl.getValue(); - return new JAXBSource(jc, user); + JAXBElement reqElement = (JAXBElement)jc.createUnmarshaller().unmarshal(request); + + UserType user = (UserType)reqElement.getValue(); + + JAXBElement resElement = new JAXBElement(new QName("http://org.jboss.ws/provider", "user"), UserType.class, user); + return new JAXBSource(jc, resElement); } catch (RuntimeException rte) { Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/provider/UserType.java =================================================================== --- trunk/src/test/java/org/jboss/test/ws/jaxws/provider/UserType.java 2006-06-30 13:46:12 UTC (rev 535) +++ trunk/src/test/java/org/jboss/test/ws/jaxws/provider/UserType.java 2006-06-30 13:50:50 UTC (rev 536) @@ -36,7 +36,6 @@ */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "UserType", propOrder = { "string", "qname" }) -@XmlRootElement(name = "user") public class UserType { |
From: <jbo...@li...> - 2006-06-30 13:46:17
|
Author: tho...@jb... Date: 2006-06-30 09:46:12 -0400 (Fri, 30 Jun 2006) New Revision: 535 Added: trunk/src/test/resources/jaxws/provider/payload/WEB-INF/web.xml Log: JBWS-1020: Implement javax.xml.ws.Provider<JAXBSource> Added: trunk/src/test/resources/jaxws/provider/payload/WEB-INF/web.xml =================================================================== --- trunk/src/test/resources/jaxws/provider/payload/WEB-INF/web.xml 2006-06-30 13:41:35 UTC (rev 534) +++ trunk/src/test/resources/jaxws/provider/payload/WEB-INF/web.xml 2006-06-30 13:46:12 UTC (rev 535) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" + version="2.4"> + + <servlet> + <servlet-name>TestEndpoint</servlet-name> + <servlet-class>org.jboss.test.ws.jaxws.provider.ProviderBeanPayload</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>TestEndpoint</servlet-name> + <url-pattern>/*</url-pattern> + </servlet-mapping> +</web-app> + Property changes on: trunk/src/test/resources/jaxws/provider/payload/WEB-INF/web.xml ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF |
Author: tho...@jb... Date: 2006-06-30 09:41:35 -0400 (Fri, 30 Jun 2006) New Revision: 534 Added: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ObjectFactory.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanJAXB.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/package-info.java trunk/src/test/resources/jaxws/provider/jaxb/ trunk/src/test/resources/jaxws/provider/jaxb/WEB-INF/ trunk/src/test/resources/jaxws/provider/jaxb/WEB-INF/web.xml trunk/src/test/resources/jaxws/provider/jaxb/org/ trunk/src/test/resources/jaxws/provider/jaxb/org/jboss/ trunk/src/test/resources/jaxws/provider/jaxb/org/jboss/test/ trunk/src/test/resources/jaxws/provider/jaxb/org/jboss/test/ws/ trunk/src/test/resources/jaxws/provider/jaxb/org/jboss/test/ws/jaxws/ trunk/src/test/resources/jaxws/provider/jaxb/org/jboss/test/ws/jaxws/provider/ trunk/src/test/resources/jaxws/provider/jaxb/org/jboss/test/ws/jaxws/provider/ObjectFactory.java trunk/src/test/resources/jaxws/provider/jaxb/org/jboss/test/ws/jaxws/provider/UserType.java trunk/src/test/resources/jaxws/provider/jaxb/org/jboss/test/ws/jaxws/provider/package-info.java trunk/src/test/resources/jaxws/provider/jaxb/usertype.xsd trunk/src/test/resources/jaxws/provider/payload/ trunk/src/test/resources/jaxws/provider/payload/WEB-INF/ Removed: trunk/src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java trunk/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilder.java trunk/src/main/java/org/jboss/ws/soap/STAXEnvelopeBuilder.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayloadJAXB.java Modified: trunk/ant.properties.example trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java trunk/src/main/java/org/jboss/ws/soap/SOAPMessageImpl.java trunk/src/test/ant/build-jars.xml trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanMessage.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/UserType.java Log: JBWS-1020: Implement javax.xml.ws.Provider<JAXBSource> Modified: trunk/ant.properties.example =================================================================== --- trunk/ant.properties.example 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/ant.properties.example 2006-06-30 13:41:35 UTC (rev 534) @@ -3,7 +3,7 @@ # # Required JBoss Home -#jboss.jdk15.home=d:/cvs/jboss-branch/jboss-4.0.x/build/output/jboss-4.0.5.CR1-ejb3 +#jboss.jdk15.home=d:/cvs/jboss-head/build/output/jboss-5.0.0.Alpha # Optional JBoss Home #jboss.jdk14.home=d:/cvs/jboss-archive/jboss-4.0.4/build/output/jboss-4.0.4.GA Modified: trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-06-30 13:41:35 UTC (rev 534) @@ -39,6 +39,7 @@ { static String JAXRPC_SOAP11_BINDING = "org.jboss.ws.binding.jaxrpc.soap11"; static String JAXWS_MESSAGE_BINDING = "org.jboss.ws.binding.jaxws.message"; + static String JAXWS_PAYLOAD_BINDING = "org.jboss.ws.binding.jaxws.payload"; /** On the client side, generate the SOAPMessage from IN parameters. */ SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException; Modified: trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-06-30 13:41:35 UTC (rev 534) @@ -28,6 +28,7 @@ import org.jboss.ws.WSException; import org.jboss.ws.binding.soap.JAXRPCBindingProviderSOAP11; import org.jboss.ws.binding.soap.JAXWSBindingProviderMessage; +import org.jboss.ws.binding.soap.JAXWSBindingProviderPayload; /** A registry of binding providers. * @@ -43,6 +44,7 @@ { providers.put(BindingProvider.JAXRPC_SOAP11_BINDING, defaultProvider); providers.put(BindingProvider.JAXWS_MESSAGE_BINDING, JAXWSBindingProviderMessage.class); + providers.put(BindingProvider.JAXWS_PAYLOAD_BINDING, JAXWSBindingProviderPayload.class); } /** Get a binding provider for a given URI Added: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java 2006-06-30 13:41:35 UTC (rev 534) @@ -0,0 +1,141 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ws.binding.soap; + +// $Id$ + +import java.util.Map; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPMessage; +import javax.xml.transform.Source; + +import org.jboss.logging.Logger; +import org.jboss.util.NotImplementedException; +import org.jboss.ws.Constants; +import org.jboss.ws.WSException; +import org.jboss.ws.binding.BindingException; +import org.jboss.ws.binding.BindingProvider; +import org.jboss.ws.binding.EndpointInvocation; +import org.jboss.ws.binding.UnboundHeader; +import org.jboss.ws.metadata.OperationMetaData; +import org.jboss.ws.metadata.ParameterMetaData; +import org.jboss.ws.soap.MessageContextAssociation; +import org.jboss.ws.soap.MessageFactoryImpl; +import org.jboss.ws.soap.SOAPBodyImpl; +import org.jboss.ws.soap.SOAPMessageContextImpl; +import org.jboss.ws.soap.SOAPMessageImpl; + +/** A BindingProvider for a JAXWS payload + * + * @author Tho...@jb... + * @since 27-Jun-2006 + */ +public class JAXWSBindingProviderPayload implements BindingProvider +{ + // provide logging + private static final Logger log = Logger.getLogger(JAXWSBindingProviderPayload.class); + + /** On the client side, generate the payload from IN parameters. */ + public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> 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, SOAPMessage reqMessage) throws BindingException + { + log.debug("unbindRequestMessage: " + opMetaData.getXmlName()); + + try + { + // Construct the endpoint invocation object + EndpointInvocation epInv = new EndpointInvocation(opMetaData); + + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + if (msgContext == null) + throw new WSException("MessageContext not available"); + + ParameterMetaData paramMetaData = opMetaData.getParameters().get(0); + QName xmlName = paramMetaData.getXmlName(); + + SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody(); + Source payload = soapBody.getPayload(); + epInv.setRequestParamValue(xmlName, payload); + + return epInv; + } + catch (Exception e) + { + handleException(e); + return null; + } + } + + /** On the server side, generate the payload from OUT parameters. */ + public SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException + { + log.debug("bindResponseMessage: " + opMetaData.getXmlName()); + + try + { + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + if (msgContext == null) + throw new WSException("MessageContext not available"); + + // Associate current message with message context + MessageFactoryImpl factory = new MessageFactoryImpl(); + factory.setEnvelopeURI(Constants.NS_SOAP11_ENV); + SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(); + msgContext.setMessage(resMessage); + + Source payload = (Source)epInv.getReturnValue(); + SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody(); + soapBody.setPayload(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, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) + throws BindingException + { + throw new NotImplementedException(); + } + + 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); + } +} Property changes on: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java =================================================================== --- trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-06-30 13:41:35 UTC (rev 534) @@ -194,6 +194,7 @@ } MessageFactoryImpl msgFactory = new MessageFactoryImpl(); + msgFactory.setServiceMode(epMetaData.getServiceMode()); msgFactory.setStyle(epMetaData.getStyle()); MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null); Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java =================================================================== --- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java 2006-06-30 13:41:35 UTC (rev 534) @@ -107,6 +107,10 @@ { bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_MESSAGE_BINDING); } + else if (epMetaData.getServiceMode() == Mode.PAYLOAD) + { + bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_PAYLOAD_BINDING); + } else { bindingProvider = BindingProviderRegistry.getDefaultProvider(); Deleted: trunk/src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java =================================================================== --- trunk/src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java 2006-06-30 13:41:35 UTC (rev 534) @@ -1,238 +0,0 @@ -package org.jboss.ws.soap; - -import org.w3c.dom.*; -import org.jboss.util.xml.DOMUtils; -import org.jboss.util.xml.DOMWriter; -import org.jboss.xb.binding.NamespaceRegistry; -import org.jboss.ws.jaxrpc.Style; -import org.jboss.ws.WSException; - -import javax.xml.soap.*; -import javax.xml.soap.Node; -import javax.xml.namespace.QName; -import java.io.InputStream; -import java.io.IOException; -import java.util.Iterator; - -/** - * @author Heiko Braun, <hei...@jb...> - * @since 19-Apr-2006 - */ -public class DOMEnvelopeBuilder implements SAAJEnvelopeBuilder { - - private SOAPMessage soapMessage; - private boolean ignoreParseException = false; - private Style style = Style.DOCUMENT; - - public void setSOAPMessage(SOAPMessage soapMessage) { - this.soapMessage = soapMessage; - } - - public void setIgnoreParseException(boolean ignoreParseException) { - this.ignoreParseException = ignoreParseException; - } - - public void setStyle(Style style) { - this.style = style; - } - - public SOAPEnvelope build(InputStream ins) throws IOException, SOAPException { - // Parse the XML input stream - Element domEnv = null; - try - { - domEnv = DOMUtils.parse(ins); - } - catch (IOException ex) - { - if (ignoreParseException) - { - return null; - } - throw ex; - } - - String envNS = domEnv.getNamespaceURI(); - String envPrefix = domEnv.getPrefix(); - - // Construct the envelope - SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); - SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); - SOAPEnvelopeImpl soapEnv = new SOAPEnvelopeImpl(soapPart, soapFactory.createElement(domEnv, false)); - NamespaceRegistry namespaceRegistry = soapEnv.getNamespaceRegistry(); - - DOMUtils.copyAttributes(soapEnv, domEnv); - registerNamespaces(namespaceRegistry, soapEnv); - - // Add the header elements - Element domHeader = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Header")); - if (domHeader != null) - { - SOAPHeader soapHeader = soapEnv.getHeader(); - - DOMUtils.copyAttributes(soapHeader, domHeader); - registerNamespaces(namespaceRegistry, soapHeader); - - Iterator it = DOMUtils.getChildElements(domHeader); - while (it.hasNext()) - { - Element srcElement = (Element)it.next(); - String xmlFragment = DOMWriter.printNode(srcElement, false); - - 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); - } - } - - // Add the body elements - Element domBody = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Body")); - SOAPBody soapBody = soapEnv.getBody(); - - DOMUtils.copyAttributes(soapBody, domBody); - registerNamespaces(namespaceRegistry, soapBody); - - Iterator itBody = DOMUtils.getChildElements(domBody); - if (itBody.hasNext()) - { - Element domBodyElement = (Element)itBody.next(); - - String localName = domBodyElement.getLocalName(); - String prefix = domBodyElement.getPrefix(); - String nsURI = domBodyElement.getNamespaceURI(); - Name beName = new NameImpl(localName, prefix, nsURI); - - // Process a <env:Fault> message - if (beName.equals(new NameImpl("Fault", envPrefix, envNS))) - { - SOAPFaultImpl soapFault = new SOAPFaultImpl(envNS); - soapBody.addChildElement(soapFault); - - DOMUtils.copyAttributes(soapFault, domBodyElement); - - Element domFaultCode = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultcode")); - if (domFaultCode == null) - throw new SOAPException("SOAPFault does not contain a <faultcode> element"); - - Element domFaultString = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultstring")); - if (domFaultString == null) - throw new SOAPException("SOAPFault does not contain a <faultstring> element"); - - String faultCode = DOMUtils.getTextContent(domFaultCode); - soapFault.setFaultCode(faultCode); - - String faultString = DOMUtils.getTextContent(domFaultString); - soapFault.setFaultString(faultString); - - Element domFaultActor = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultactor")); - if (domFaultActor != null) - { - String faultActor = DOMUtils.getTextContent(domFaultActor); - soapFault.setFaultActor(faultActor); - } - - // Add the fault detail - Element domFaultDetail = DOMUtils.getFirstChildElement(domBodyElement, "detail"); - if (domFaultDetail != null) - { - Detail detail = soapFault.addDetail(); - Iterator it = DOMUtils.getChildElements(domFaultDetail); - while (it.hasNext()) - { - Element domElement = (Element)it.next(); - SOAPElement detailEntry = new DetailEntryImpl(soapFactory.createElement(domElement, true)); - detailEntry = detail.addChildElement(detailEntry); - } - } - } - - // Process and RPC or DOCUMENT style message - else - { - - if (style == Style.RPC) - { - SOAPBodyElementRpc soapBodyElement = new SOAPBodyElementRpc(beName); - soapBodyElement = (SOAPBodyElementRpc)soapBody.addChildElement(soapBodyElement); - - DOMUtils.copyAttributes(soapBodyElement, domBodyElement); - - Iterator itBodyElement = DOMUtils.getChildElements(domBodyElement); - while (itBodyElement.hasNext()) - { - Element srcElement = (Element)itBodyElement.next(); - - Name name = new NameImpl(srcElement.getLocalName(), srcElement.getPrefix(), srcElement.getNamespaceURI()); - SOAPContentElement destElement = new SOAPContentElement(name); - soapBodyElement.addChildElement(destElement); - - String xmlFragment = DOMWriter.printNode(srcElement, false); - destElement.setXMLFragment(xmlFragment); - } - } - else if (style == Style.DOCUMENT) - { - Element srcElement = (Element)domBodyElement; - SOAPBodyElementDoc destElement = new SOAPBodyElementDoc(beName); - destElement = (SOAPBodyElementDoc)soapBody.addChildElement(destElement); - - String xmlFragment = DOMWriter.printNode(srcElement, false); - destElement.setXMLFragment(xmlFragment); - } - else if (style == null) - { - SOAPBodyElementMessage 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++) - { - org.w3c.dom.Node child = nlist.item(i); - short childType = child.getNodeType(); - if (childType == org.w3c.dom.Node.ELEMENT_NODE) - { - SOAPElement soapElement = soapFactory.createElement((Element)child, true); - soapBodyElement.addChildElement(soapElement); - } - else if (childType == org.w3c.dom.Node.TEXT_NODE) - { - String nodeValue = child.getNodeValue(); - soapBodyElement.addTextNode(nodeValue); - } - else if (childType == org.w3c.dom.Node.CDATA_SECTION_NODE) - { - String nodeValue = child.getNodeValue(); - soapBodyElement.addTextNode(nodeValue); - } - else - { - System.out.println("Ignore child type: " + childType); - } - } - } - else - { - throw new WSException("Unsupported message style: " + style); - } - } - } - - return soapEnv; - } - - private void registerNamespaces(NamespaceRegistry namespaceRegistry, SOAPElement soapEl) - { - Iterator itNSPrefixes = soapEl.getNamespacePrefixes(); - while (itNSPrefixes.hasNext()) - { - String prefix = (String)itNSPrefixes.next(); - String nsURI = soapEl.getNamespaceURI(prefix); - namespaceRegistry.registerURI(nsURI, prefix); - } - } -} Added: trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java =================================================================== --- trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java 2006-06-30 13:41:35 UTC (rev 534) @@ -0,0 +1,130 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, 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$ + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +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.transform.stream.StreamSource; + +import org.jboss.util.xml.DOMUtils; +import org.jboss.util.xml.DOMWriter; +import org.jboss.xb.binding.NamespaceRegistry; +import org.w3c.dom.Element; + +/** + * A SOAPEnvelope builder for JAXWS in service mode PAYLOAD + * + * @author Tho...@jb... + * @since 30-Jun-2006 + */ +public class JAXWSPayloadBuilder implements PayloadBuilder +{ + public void build(SOAPMessageImpl 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; + } + throw ex; + } + + String envNS = domEnv.getNamespaceURI(); + String envPrefix = domEnv.getPrefix(); + + // Construct the envelope + SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); + SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); + SOAPEnvelopeImpl soapEnv = new SOAPEnvelopeImpl(soapPart, soapFactory.createElement(domEnv, false)); + NamespaceRegistry namespaceRegistry = soapEnv.getNamespaceRegistry(); + + DOMUtils.copyAttributes(soapEnv, domEnv); + registerNamespaces(namespaceRegistry, soapEnv); + + // Add the header elements + Element domHeader = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Header")); + if (domHeader != null) + { + SOAPHeader soapHeader = soapEnv.getHeader(); + + DOMUtils.copyAttributes(soapHeader, domHeader); + registerNamespaces(namespaceRegistry, soapHeader); + + Iterator it = DOMUtils.getChildElements(domHeader); + while (it.hasNext()) + { + Element srcElement = (Element)it.next(); + String xmlFragment = DOMWriter.printNode(srcElement, false); + + 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); + } + } + + // Add the body elements + Element domBody = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Body")); + SOAPBodyImpl soapBody = (SOAPBodyImpl)soapEnv.getBody(); + + DOMUtils.copyAttributes(soapBody, domBody); + registerNamespaces(namespaceRegistry, soapBody); + + Iterator itBody = DOMUtils.getChildElements(domBody); + if (itBody.hasNext()) + { + Element domBodyElement = (Element)itBody.next(); + String xmlStr = DOMWriter.printNode(domBodyElement, false); + soapBody.setPayload(new StreamSource(new ByteArrayInputStream(xmlStr.getBytes()))); + } + } + + private void registerNamespaces(NamespaceRegistry namespaceRegistry, SOAPElement soapEl) + { + Iterator itNSPrefixes = soapEl.getNamespacePrefixes(); + while (itNSPrefixes.hasNext()) + { + String prefix = (String)itNSPrefixes.next(); + String nsURI = soapEl.getNamespaceURI(prefix); + namespaceRegistry.registerURI(nsURI, prefix); + } + } +} Property changes on: trunk/src/main/java/org/jboss/ws/soap/JAXWSPayloadBuilder.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Deleted: trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java =================================================================== --- trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-06-30 13:41:35 UTC (rev 534) @@ -1,257 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ws.soap; - -// $Id$ - -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.SOAPException; -import javax.xml.soap.SOAPMessage; - -import org.jboss.logging.Logger; -import org.jboss.ws.Constants; -import org.jboss.ws.jaxrpc.Style; -import org.jboss.ws.soap.attachment.MimeConstants; -import org.jboss.ws.soap.attachment.MultipartRelatedDecoder; -import org.jboss.ws.utils.IOUtils; - -/** - * MessageFactory implementation - * - * @author Tho...@jb... - */ -public class MessageFactoryImpl extends MessageFactory -{ - private static Logger log = Logger.getLogger(MessageFactoryImpl.class); - - // The envelope URI used by the MessageFactory - private String envelopeURI = Constants.NS_SOAP11_ENV; - - // The style used by this MessageFactory - private Style style; - - /** - * Get the SOAP envelope URI this factory will use when creating envelopes. - */ - public String getEnvelopeURI() - { - return envelopeURI; - } - - /** - * Set the SOAP envelope URI this factory will use when creating envelopes. - */ - public void setEnvelopeURI(String envelopeURI) - { - this.envelopeURI = envelopeURI; - } - - /** - * Get the Style this message factory will use - */ - public Style getStyle() - { - if (style == null) - { - SOAPMessageContextImpl 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; - } - - /** - * 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 - { - SOAPMessageImpl soapMessage = new SOAPMessageImpl(); - SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); - new SOAPEnvelopeImpl(soapPart, envelopeURI); - 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 createMessageInternal(mimeHeaders, ins, false); - } - - public SOAPMessage createMessageInternal(MimeHeaders mimeHeaders, InputStream ins, boolean ingnoreParseException) throws IOException, SOAPException - { - if (mimeHeaders == null) - { - mimeHeaders = new MimeHeaders(); - } - else if (log.isTraceEnabled()) - { - Iterator<MimeHeader> itMimeHeaders = mimeHeaders.getAllHeaders(); - while (itMimeHeaders.hasNext()) - { - MimeHeader mh = itMimeHeaders.next(); - log.trace(mh); - } - } - - ContentType contentType = getContentType(mimeHeaders); - log.debug("createMessage: [contentType=" + contentType + "]"); - - // Debug the incoming message - if (log.isTraceEnabled()) - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); - IOUtils.copyStream(baos, ins); - byte[] bytes = baos.toByteArray(); - - log.trace("createMessage\n" + new String(bytes)); - ins = new ByteArrayInputStream(bytes); - } - - Collection<AttachmentPart> attachments = null; - if (isMultipartRelatedContent(contentType)) - { - MultipartRelatedDecoder decoder; - try - { - decoder = new MultipartRelatedDecoder(contentType); - decoder.decodeMultipartRelatedMessage(ins); - } - catch (RuntimeException rte) - { - throw rte; - } - catch (IOException ex) - { - throw ex; - } - catch (Exception ex) - { - throw new SOAPException("Cannot decode multipart related message", ex); - } - - ins = decoder.getRootPart().getDataHandler().getInputStream(); - attachments = decoder.getRelatedParts(); - } - else if (isSoapContent(contentType) == false) - { - throw new SOAPException("Unsupported content type: " + contentType); - } - - SOAPMessageImpl soapMessage = new SOAPMessageImpl(); - if (mimeHeaders != null) - soapMessage.setMimeHeaders(mimeHeaders); - - if (attachments != null) - soapMessage.setAttachments(attachments); - - SAAJEnvelopeBuilder envelopeBuilder = new DOMEnvelopeBuilder(); - envelopeBuilder.setIgnoreParseException(ingnoreParseException); - envelopeBuilder.setStyle(getStyle()); - envelopeBuilder.setSOAPMessage(soapMessage); - envelopeBuilder.build(ins); - - 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.equals(baseType) || MimeConstants.TYPE_SOAP12.equals(baseType); - } - - private boolean isMultipartRelatedContent(ContentType type) - { - String baseType = type.getBaseType(); - return MimeConstants.TYPE_MULTIPART_RELATED.equals(baseType); - } -} Added: trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java =================================================================== --- trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java 2006-06-30 13:41:35 UTC (rev 534) @@ -0,0 +1,279 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, 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$ + +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.SOAPException; +import javax.xml.soap.SOAPMessage; +import javax.xml.ws.Service.Mode; + +import org.jboss.logging.Logger; +import org.jboss.ws.Constants; +import org.jboss.ws.jaxrpc.Style; +import org.jboss.ws.soap.attachment.MimeConstants; +import org.jboss.ws.soap.attachment.MultipartRelatedDecoder; +import org.jboss.ws.utils.IOUtils; + +/** + * MessageFactory implementation + * + * @author Tho...@jb... + */ +public class MessageFactoryImpl extends MessageFactory +{ + private static Logger log = Logger.getLogger(MessageFactoryImpl.class); + + // The envelope URI used by the MessageFactory + private String envelopeURI = Constants.NS_SOAP11_ENV; + + // The JAXWS ServiceMode + private Mode serviceMode; + // The style used by this MessageFactory + private Style style; + + /** + * Get the SOAP envelope URI this factory will use when creating envelopes. + */ + public String getEnvelopeURI() + { + return envelopeURI; + } + + /** + * Set the SOAP envelope URI this factory will use when creating envelopes. + */ + public void setEnvelopeURI(String envelopeURI) + { + this.envelopeURI = envelopeURI; + } + + /** + * Get the Style this message factory will use + */ + public Style getStyle() + { + if (style == null) + { + SOAPMessageContextImpl 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 + { + SOAPMessageImpl soapMessage = new SOAPMessageImpl(); + SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); + new SOAPEnvelopeImpl(soapPart, envelopeURI); + 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 createMessageInternal(mimeHeaders, ins, false); + } + + public SOAPMessage createMessageInternal(MimeHeaders mimeHeaders, InputStream ins, boolean ingnoreParseException) throws IOException, SOAPException + { + if (mimeHeaders == null) + { + mimeHeaders = new MimeHeaders(); + } + else if (log.isTraceEnabled()) + { + Iterator<MimeHeader> itMimeHeaders = mimeHeaders.getAllHeaders(); + while (itMimeHeaders.hasNext()) + { + MimeHeader mh = itMimeHeaders.next(); + log.trace(mh); + } + } + + ContentType contentType = getContentType(mimeHeaders); + log.debug("createMessage: [contentType=" + contentType + "]"); + + // Debug the incoming message + if (log.isTraceEnabled()) + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); + IOUtils.copyStream(baos, ins); + byte[] bytes = baos.toByteArray(); + + log.trace("createMessage\n" + new String(bytes)); + ins = new ByteArrayInputStream(bytes); + } + + Collection<AttachmentPart> attachments = null; + if (isMultipartRelatedContent(contentType)) + { + MultipartRelatedDecoder decoder; + try + { + decoder = new MultipartRelatedDecoder(contentType); + decoder.decodeMultipartRelatedMessage(ins); + } + catch (RuntimeException rte) + { + throw rte; + } + catch (IOException ex) + { + throw ex; + } + catch (Exception ex) + { + throw new SOAPException("Cannot decode multipart related message", ex); + } + + ins = decoder.getRootPart().getDataHandler().getInputStream(); + attachments = decoder.getRelatedParts(); + } + else if (isSoapContent(contentType) == false) + { + throw new SOAPException("Unsupported content type: " + contentType); + } + + SOAPMessageImpl soapMessage = new SOAPMessageImpl(); + if (mimeHeaders != null) + soapMessage.setMimeHeaders(mimeHeaders); + + if (attachments != null) + soapMessage.setAttachments(attachments); + + // Get the SOAPEnvelope builder + PayloadBuilder payloadBuilder; + if (serviceMode == Mode.PAYLOAD) + { + payloadBuilder = new JAXWSPayloadBuilder(); + } + else + { + SAAJPayloadBuilderDOM jaxrpcBuilder = new SAAJPayloadBuilderDOM(); + jaxrpcBuilder.setStyle(getStyle()); + payloadBuilder = jaxrpcBuilder; + } + + // Build the payload + payloadBuilder.build(soapMessage, ins, false); + + 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.equals(baseType) || MimeConstants.TYPE_SOAP12.equals(baseType); + } + + private boolean isMultipartRelatedContent(ContentType type) + { + String baseType = type.getBaseType(); + return MimeConstants.TYPE_MULTIPART_RELATED.equals(baseType); + } +} Property changes on: trunk/src/main/java/org/jboss/ws/soap/MessageFactoryImpl.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Added: trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java =================================================================== --- trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java 2006-06-30 13:41:35 UTC (rev 534) @@ -0,0 +1,40 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, 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$ + +import java.io.IOException; +import java.io.InputStream; + +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPMessage; + +/** + * @author Heiko Braun, <hei...@jb...> + * @author Tho...@jb... + * @since 19-Apr-2006 + */ +public interface PayloadBuilder +{ + void build(SOAPMessageImpl soapMessage, InputStream in, boolean ingnoreParseError) throws IOException, SOAPException; +} Property changes on: trunk/src/main/java/org/jboss/ws/soap/PayloadBuilder.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Deleted: trunk/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilder.java =================================================================== --- trunk/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilder.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/soap/SAAJEnvelopeBuilder.java 2006-06-30 13:41:35 UTC (rev 534) @@ -1,20 +0,0 @@ -package org.jboss.ws.soap; - -import org.jboss.ws.jaxrpc.Style; - -import javax.xml.soap.SOAPEnvelope; -import javax.xml.soap.SOAPMessage; -import javax.xml.soap.SOAPException; -import java.io.InputStream; -import java.io.IOException; - -/** - * @author Heiko Braun, <hei...@jb...> - * @since 19-Apr-2006 - */ -public interface SAAJEnvelopeBuilder { - void setSOAPMessage(SOAPMessage soapMessage); - void setStyle(Style style); - SOAPEnvelope build(InputStream in) throws IOException, SOAPException; - void setIgnoreParseException(boolean b); -} Added: trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java =================================================================== --- trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java 2006-06-30 13:41:35 UTC (rev 534) @@ -0,0 +1,260 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, 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$ + +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; + +import javax.xml.namespace.QName; +import javax.xml.soap.Detail; +import javax.xml.soap.Name; +import javax.xml.soap.SOAPBody; +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPHeader; + +import org.jboss.util.xml.DOMUtils; +import org.jboss.util.xml.DOMWriter; +import org.jboss.ws.WSException; +import org.jboss.ws.jaxrpc.Style; +import org.jboss.xb.binding.NamespaceRegistry; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +/** + * A SOAPEnvelope builder for JAXRPC based on DOM + * + * @author Heiko Braun, <hei...@jb...> + * @author Tho...@jb... + * @since 19-Apr-2006 + */ +public class SAAJPayloadBuilderDOM implements PayloadBuilder +{ + private Style style = Style.DOCUMENT; + + public void setStyle(Style style) + { + this.style = style; + } + + public void build(SOAPMessageImpl 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; + } + throw ex; + } + + String envNS = domEnv.getNamespaceURI(); + String envPrefix = domEnv.getPrefix(); + + // Construct the envelope + SOAPFactoryImpl soapFactory = new SOAPFactoryImpl(); + SOAPPartImpl soapPart = (SOAPPartImpl)soapMessage.getSOAPPart(); + SOAPEnvelopeImpl soapEnv = new SOAPEnvelopeImpl(soapPart, soapFactory.createElement(domEnv, false)); + NamespaceRegistry namespaceRegistry = soapEnv.getNamespaceRegistry(); + + DOMUtils.copyAttributes(soapEnv, domEnv); + registerNamespaces(namespaceRegistry, soapEnv); + + // Add the header elements + Element domHeader = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Header")); + if (domHeader != null) + { + SOAPHeader soapHeader = soapEnv.getHeader(); + + DOMUtils.copyAttributes(soapHeader, domHeader); + registerNamespaces(namespaceRegistry, soapHeader); + + Iterator it = DOMUtils.getChildElements(domHeader); + while (it.hasNext()) + { + Element srcElement = (Element)it.next(); + String xmlFragment = DOMWriter.printNode(srcElement, false); + + 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); + } + } + + // Add the body elements + Element domBody = DOMUtils.getFirstChildElement(domEnv, new QName(envNS, "Body")); + SOAPBody soapBody = soapEnv.getBody(); + + DOMUtils.copyAttributes(soapBody, domBody); + registerNamespaces(namespaceRegistry, soapBody); + + Iterator itBody = DOMUtils.getChildElements(domBody); + if (itBody.hasNext()) + { + Element domBodyElement = (Element)itBody.next(); + + String localName = domBodyElement.getLocalName(); + String prefix = domBodyElement.getPrefix(); + String nsURI = domBodyElement.getNamespaceURI(); + Name beName = new NameImpl(localName, prefix, nsURI); + + // Process a <env:Fault> message + if (beName.equals(new NameImpl("Fault", envPrefix, envNS))) + { + SOAPFaultImpl soapFault = new SOAPFaultImpl(envNS); + soapBody.addChildElement(soapFault); + + DOMUtils.copyAttributes(soapFault, domBodyElement); + + Element domFaultCode = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultcode")); + if (domFaultCode == null) + throw new SOAPException("SOAPFault does not contain a <faultcode> element"); + + Element domFaultString = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultstring")); + if (domFaultString == null) + throw new SOAPException("SOAPFault does not contain a <faultstring> element"); + + String faultCode = DOMUtils.getTextContent(domFaultCode); + soapFault.setFaultCode(faultCode); + + String faultString = DOMUtils.getTextContent(domFaultString); + soapFault.setFaultString(faultString); + + Element domFaultActor = DOMUtils.getFirstChildElement(domBodyElement, new QName("faultactor")); + if (domFaultActor != null) + { + String faultActor = DOMUtils.getTextContent(domFaultActor); + soapFault.setFaultActor(faultActor); + } + + // Add the fault detail + Element domFaultDetail = DOMUtils.getFirstChildElement(domBodyElement, "detail"); + if (domFaultDetail != null) + { + Detail detail = soapFault.addDetail(); + Iterator it = DOMUtils.getChildElements(domFaultDetail); + while (it.hasNext()) + { + Element domElement = (Element)it.next(); + SOAPElement detailEntry = new DetailEntryImpl(soapFactory.createElement(domElement, true)); + detailEntry = detail.addChildElement(detailEntry); + } + } + } + + // Process and RPC or DOCUMENT style message + else + { + + if (style == Style.RPC) + { + SOAPBodyElementRpc soapBodyElement = new SOAPBodyElementRpc(beName); + soapBodyElement = (SOAPBodyElementRpc)soapBody.addChildElement(soapBodyElement); + + DOMUtils.copyAttributes(soapBodyElement, domBodyElement); + + Iterator itBodyElement = DOMUtils.getChildElements(domBodyElement); + while (itBodyElement.hasNext()) + { + Element srcElement = (Element)itBodyElement.next(); + + Name name = new NameImpl(srcElement.getLocalName(), srcElement.getPrefix(), srcElement.getNamespaceURI()); + SOAPContentElement destElement = new SOAPContentElement(name); + soapBodyElement.addChildElement(destElement); + + String xmlFragment = DOMWriter.printNode(srcElement, false); + destElement.setXMLFragment(xmlFragment); + } + } + else if (style == Style.DOCUMENT) + { + Element srcElement = (Element)domBodyElement; + SOAPBodyElementDoc destElement = new SOAPBodyElementDoc(beName); + destElement = (SOAPBodyElementDoc)soapBody.addChildElement(destElement); + + String xmlFragment = DOMWriter.printNode(srcElement, false); + destElement.setXMLFragment(xmlFragment); + } + else if (style == null) + { + SOAPBodyElementMessage 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++) + { + org.w3c.dom.Node child = nlist.item(i); + short childType = child.getNodeType(); + if (childType == org.w3c.dom.Node.ELEMENT_NODE) + { + SOAPElement soapElement = soapFactory.createElement((Element)child, true); + soapBodyElement.addChildElement(soapElement); + } + else if (childType == org.w3c.dom.Node.TEXT_NODE) + { + String nodeValue = child.getNodeValue(); + soapBodyElement.addTextNode(nodeValue); + } + else if (childType == org.w3c.dom.Node.CDATA_SECTION_NODE) + { + String nodeValue = child.getNodeValue(); + soapBodyElement.addTextNode(nodeValue); + } + else + { + System.out.println("Ignore child type: " + childType); + } + } + } + else + { + throw new WSException("Unsupported message style: " + style); + } + } + } + } + + private void registerNamespaces(NamespaceRegistry namespaceRegistry, SOAPElement soapEl) + { + Iterator itNSPrefixes = soapEl.getNamespacePrefixes(); + while (itNSPrefixes.hasNext()) + { + String prefix = (String)itNSPrefixes.next(); + String nsURI = soapEl.getNamespaceURI(prefix); + namespaceRegistry.registerURI(nsURI, prefix); + } + } +} Property changes on: trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderDOM.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Added: trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java =================================================================== --- trunk/src/main/java/org/jboss/ws/soap/SAAJPayloadBuilderStax.java 2006-06-30 10:19:14 UTC (rev 533) +++ trunk/src/main/java/org/jboss/ws/s... [truncated message content] |
From: <jbo...@li...> - 2006-06-30 10:19:20
|
Author: tho...@jb... Date: 2006-06-30 06:19:14 -0400 (Fri, 30 Jun 2006) New Revision: 533 Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java Log: JBWS-1020: Implement javax.xml.ws.Provider<Source> Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java =================================================================== --- trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java 2006-06-30 09:33:29 UTC (rev 532) +++ trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java 2006-06-30 10:19:14 UTC (rev 533) @@ -23,15 +23,18 @@ // $Id$ -import java.io.StringReader; +import java.io.ByteArrayInputStream; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.ws.Provider; -import javax.xml.ws.Service; -import javax.xml.ws.ServiceMode; +import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceProvider; +import org.jboss.util.xml.DOMUtils; +import org.jboss.util.xml.DOMWriter; +import org.w3c.dom.Element; + /** * Test a Provider<Source> * @@ -39,19 +42,31 @@ * @since 29-Jun-2006 */ @WebServiceProvider -@ServiceMode(value = Service.Mode.PAYLOAD) +// in absence PAYLOAD is implicit +// @ServiceMode(value = Service.Mode.PAYLOAD) public class ProviderBeanPayload implements Provider<Source> { - public ProviderBeanPayload() + public Source invoke(Source req) { - } + try + { + Element reqPayload = DOMUtils.parse(((StreamSource)req).getInputStream()); + String xmlReq = DOMWriter.printNode(reqPayload, false); - public Source invoke(Source request) - { - Source requestPayload = null; //request.getPayload(); - String replyElement = "<n:ack xmlns:n=.../>"; - StreamSource reply = new StreamSource(new StringReader(replyElement)); - return reply; + String expReq = "<ns1:somePayload xmlns:ns1='http://org.jboss.ws/provider'/>"; + if (!expReq.equals(xmlReq)) + throw new WebServiceException("Unexpected payload: " + xmlReq); + + return new StreamSource(new ByteArrayInputStream(xmlReq.getBytes())); + } + catch (RuntimeException rte) + { + throw rte; + } + catch (Exception e) + { + throw new WebServiceException(e); + } } } \ No newline at end of file |
From: <jbo...@li...> - 2006-06-30 09:33:37
|
Author: hei...@jb... Date: 2006-06-30 05:33:29 -0400 (Fri, 30 Jun 2006) New Revision: 532 Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java Log: SVN id tags Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-06-30 09:32:52 UTC (rev 531) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-06-30 09:33:29 UTC (rev 532) @@ -42,7 +42,7 @@ * * @author Heiko Braun <hei...@jb...> * @since May 10, 2006 - * @version $Revision$ + * @version $Id$ */ public class XOPContext { Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java 2006-06-30 09:32:52 UTC (rev 531) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java 2006-06-30 09:33:29 UTC (rev 532) @@ -45,7 +45,7 @@ * * @author Heiko Braun <hei...@jb...> * @since May 9, 2006 - * @version $Revision$ + * @version $Id$ */ public class XOPMarshallerImpl implements XOPMarshaller { Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java 2006-06-30 09:32:52 UTC (rev 531) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java 2006-06-30 09:33:29 UTC (rev 532) @@ -43,7 +43,7 @@ * * @author Heiko Braun <hei...@jb...> * @since Jun 9, 2006 - * @version $Revision$ + * @version $Id$ */ public class XOPScanner { Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java 2006-06-30 09:32:52 UTC (rev 531) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java 2006-06-30 09:33:29 UTC (rev 532) @@ -45,7 +45,7 @@ * * @author Heiko Braun <hei...@jb...> * @since May 9, 2006 - * @version $Revision$ + * @version $Id$ */ public class XOPUnmarshallerImpl implements XOPUnmarshaller { |
From: <jbo...@li...> - 2006-06-30 09:32:56
|
Author: hei...@jb... Date: 2006-06-30 05:32:52 -0400 (Fri, 30 Jun 2006) New Revision: 531 Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java Log: SVN id tags Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java 2006-06-30 09:31:29 UTC (rev 530) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java 2006-06-30 09:32:52 UTC (rev 531) @@ -32,7 +32,7 @@ /** * @author <a href="mailto:al...@jb...">Alexey Loubyansky</a> - * @version <tt>$Revision$</tt> + * @version <tt>$Id$</tt> */ public class SimpleDataSource implements DataSource |
From: <jbo...@li...> - 2006-06-30 09:31:35
|
Author: hei...@jb... Date: 2006-06-30 05:31:29 -0400 (Fri, 30 Jun 2006) New Revision: 530 Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java Log: SVN id tags Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-06-30 08:58:58 UTC (rev 529) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-06-30 09:31:29 UTC (rev 530) @@ -39,9 +39,10 @@ * XOP context associated with a message context. * * @see ThreadLocalAssociation - * + * * @author Heiko Braun <hei...@jb...> * @since May 10, 2006 + * @version $Revision$ */ public class XOPContext { Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java 2006-06-30 08:58:58 UTC (rev 529) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java 2006-06-30 09:31:29 UTC (rev 530) @@ -45,6 +45,7 @@ * * @author Heiko Braun <hei...@jb...> * @since May 9, 2006 + * @version $Revision$ */ public class XOPMarshallerImpl implements XOPMarshaller { Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java 2006-06-30 08:58:58 UTC (rev 529) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java 2006-06-30 09:31:29 UTC (rev 530) @@ -43,6 +43,7 @@ * * @author Heiko Braun <hei...@jb...> * @since Jun 9, 2006 + * @version $Revision$ */ public class XOPScanner { Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java 2006-06-30 08:58:58 UTC (rev 529) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java 2006-06-30 09:31:29 UTC (rev 530) @@ -45,6 +45,7 @@ * * @author Heiko Braun <hei...@jb...> * @since May 9, 2006 + * @version $Revision$ */ public class XOPUnmarshallerImpl implements XOPUnmarshaller { |
From: <jbo...@li...> - 2006-06-30 08:59:01
|
Author: hei...@jb... Date: 2006-06-30 04:58:58 -0400 (Fri, 30 Jun 2006) New Revision: 529 Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java Log: docs and comments Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-06-30 08:57:46 UTC (rev 528) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-06-30 08:58:58 UTC (rev 529) @@ -36,8 +36,10 @@ import java.util.Iterator; /** - * XOP context that associated with a message context. + * XOP context associated with a message context. * + * @see ThreadLocalAssociation + * * @author Heiko Braun <hei...@jb...> * @since May 10, 2006 */ |
From: <jbo...@li...> - 2006-06-30 08:57:51
|
Author: hei...@jb... Date: 2006-06-30 04:57:46 -0400 (Fri, 30 Jun 2006) New Revision: 528 Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java Log: added missing headers Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java 2006-06-30 08:56:26 UTC (rev 527) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java 2006-06-30 08:57:46 UTC (rev 528) @@ -1,3 +1,24 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ package org.jboss.ws.xop; import java.io.ByteArrayInputStream; Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java 2006-06-30 08:56:26 UTC (rev 527) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java 2006-06-30 08:57:46 UTC (rev 528) @@ -1,3 +1,24 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ package org.jboss.ws.xop; import org.apache.xerces.xs.*; |
From: <jbo...@li...> - 2006-06-30 08:56:29
|
Author: hei...@jb... Date: 2006-06-30 04:56:26 -0400 (Fri, 30 Jun 2006) New Revision: 527 Removed: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java Log: removed Deleted: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java 2006-06-30 08:55:45 UTC (rev 526) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java 2006-06-30 08:56:26 UTC (rev 527) @@ -1,8 +0,0 @@ -package org.jboss.ws.xop; - -/** - * @author Heiko Braun <hei...@jb...> - * @since Jun 30, 2006 - */ -public class XOPinlineBuilder { -} |
From: <jbo...@li...> - 2006-06-30 08:55:51
|
Author: hei...@jb... Date: 2006-06-30 04:55:45 -0400 (Fri, 30 Jun 2006) New Revision: 526 Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java Log: init Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java 2006-06-30 08:49:02 UTC (rev 525) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java 2006-06-30 08:55:45 UTC (rev 526) @@ -0,0 +1,72 @@ +package org.jboss.ws.xop; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import javax.activation.DataSource; +import org.jboss.xb.binding.JBossXBRuntimeException; + +/** + * @author <a href="mailto:al...@jb...">Alexey Loubyansky</a> + * @version <tt>$Revision$</tt> + */ +public class SimpleDataSource + implements DataSource +{ + public final byte[] bytes; + public final String contentType; + + public SimpleDataSource(Object o, String contentType) + { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = null; + try + { + oos = new ObjectOutputStream(baos); + oos.writeObject(o); + } + catch(IOException e) + { + throw new JBossXBRuntimeException("XOP failed to serialize object " + o + ": " + e.getMessage()); + } + finally + { + if(oos != null) + { + try + { + oos.close(); + } + catch(IOException e) + { + } + } + } + bytes = baos.toByteArray(); + + this.contentType = contentType; + } + + public String getContentType() + { + return contentType; + } + + public InputStream getInputStream() throws IOException + { + return new ByteArrayInputStream(bytes); + } + + public String getName() + { + throw new UnsupportedOperationException("getName is not implemented."); + } + + public OutputStream getOutputStream() throws IOException + { + throw new UnsupportedOperationException("getOutputStream is not implemented."); + } +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-06-30 08:49:02 UTC (rev 525) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java 2006-06-30 08:55:45 UTC (rev 526) @@ -0,0 +1,148 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.ws.xop; + +import org.jboss.util.xml.DOMUtils; +import org.jboss.ws.soap.MessageContextAssociation; +import org.jboss.ws.soap.SOAPMessageContextImpl; +import org.jboss.ws.soap.SOAPMessageImpl; +import org.jboss.ws.utils.ThreadLocalAssociation; +import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller; +import org.jboss.xb.binding.SimpleTypeBindings; +import org.w3c.dom.Element; + +import javax.xml.soap.SOAPElement; +import javax.activation.DataHandler; +import javax.activation.DataSource; +import java.util.Iterator; + +/** + * XOP context that associated with a message context. + * + * @author Heiko Braun <hei...@jb...> + * @since May 10, 2006 + */ +public class XOPContext { + + public static final String CID_PREFIX = "cid:"; + + public static boolean isXOPPackage() { + boolean isXOP = false; + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + if(msgContext!=null) { + SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage(); + isXOP = (soapMessage != null && soapMessage.isXOPMessage()); + } + return isXOP; + } + + /** + * Force inline representation. + */ + public static void setInlineBase64() + { + ThreadLocalAssociation.localXOPCalleeAssoc().set(Boolean.TRUE); + } + + /** + * Unset inline representation flag. + */ + public static void unsetInlineBase64() + { + ThreadLocalAssociation.localXOPCalleeAssoc().set(Boolean.FALSE); + } + + /** + * Should the current message be inlined? + * An inlined message contains the base64 representation instead + * if the <code>xop:Include</code> element. + */ + public static boolean doInlineBase64() + { + Boolean b = ThreadLocalAssociation.localXOPCalleeAssoc().get() != null ? + ThreadLocalAssociation.localXOPCalleeAssoc().get():Boolean.FALSE; + return b.booleanValue(); + } + + /** + * Replace all <code>xop:Include</code> elements with it's base64 representation + */ + public static void inlineXOPData(SOAPElement xopElement) + { + Iterator it = DOMUtils.getChildElements(xopElement); + while(it.hasNext()) + { + SOAPElement childElement = (SOAPElement)it.next(); + String ns = childElement.getNamespaceURI()!=null ? childElement.getNamespaceURI(): ""; + String localName = childElement.getLocalName(); + if(ns.equals("http://www.w3.org/2004/08/xop/include") && localName.equals("Include")) + { + replaceXOPInclude(xopElement, childElement); + } + else + { + inlineXOPData(childElement); + } + } + } + + private static void replaceXOPInclude(SOAPElement parent, SOAPElement child) + { + String cid = child.getAttribute("href"); + if(cid!=null) + { + XOPUnmarshaller unm = new XOPUnmarshallerImpl(); + byte[] data = unm.getAttachmentAsByteArray(cid); + String base64 = SimpleTypeBindings.marshalBase64(data); + parent.removeChild(child); + parent.setValue(base64); + } + } + + public static DataHandler getDataHandler(Object o) + { + DataHandler dataHandler; + // todo: contentType + if(o instanceof java.awt.Image) + { + dataHandler = new DataHandler(o, "image/jpeg"); + } + else if(o instanceof javax.xml.transform.Source) + { + dataHandler = new DataHandler(o, "application/xml"); + } + else if(o instanceof String) + { + dataHandler = new DataHandler(o, "text/xml"); + } + else if(o instanceof DataHandler) + { + dataHandler = (DataHandler)o;//new DataHandler(o, "application/octet-stream"); + } + else + { + DataSource ds = new SimpleDataSource(o, "application/octet-stream"); + dataHandler = new DataHandler(ds); + } + return dataHandler; + } +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java 2006-06-30 08:49:02 UTC (rev 525) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java 2006-06-30 08:55:45 UTC (rev 526) @@ -0,0 +1,100 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ws.xop; + +import org.jboss.logging.Logger; +import org.jboss.util.NotImplementedException; +import org.jboss.ws.soap.MessageContextAssociation; +import org.jboss.ws.soap.SOAPMessageContextImpl; +import org.jboss.ws.soap.SOAPMessageImpl; +import org.jboss.ws.soap.attachment.MimeConstants; +import org.jboss.xb.binding.sunday.xop.XOPMarshaller; +import org.jboss.xb.binding.sunday.xop.XOPObject; + +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.xml.namespace.QName; +import javax.xml.soap.AttachmentPart; + +/** + * The XOPMarshallerImpl allows callbacks from the binding layer towards the + * soap processing components in order to optimize binary processing. + * + * @see org.jboss.ws.xop.XOPUnmarshallerImpl + * @see org.jboss.ws.jaxrpc.encoding.JAXBSerializer + * @see org.jboss.ws.jaxrpc.encoding.SimpleSerializer + * + * @author Heiko Braun <hei...@jb...> + * @since May 9, 2006 + */ +public class XOPMarshallerImpl implements XOPMarshaller { + + private static final Logger log = Logger.getLogger(XOPMarshallerImpl.class); + + public boolean isXOPPackage() + { + return XOPContext.isXOPPackage(); + } + + public String addMtomAttachment(XOPObject obj, String elementNamespace, String elementName) + { + + QName xmlName = new QName(elementNamespace, elementName); + log.debug("serialize: [xmlName=" + xmlName + "]"); + + SOAPMessageContextImpl msgContext = (SOAPMessageContextImpl)MessageContextAssociation.peekMessageContext(); + SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage(); + + String cid = soapMessage.getCidGenerator().generateFromName(xmlName.getLocalPart()); + + DataHandler dataHandler = XOPContext.getDataHandler(obj.getContent()); + obj.setContentType(dataHandler.getContentType()); + + AttachmentPart xopPart = soapMessage.createAttachmentPart(dataHandler); + xopPart.addMimeHeader(MimeConstants.CONTENT_ID, '<'+cid+'>'); // RFC2392 requirement + soapMessage.addAttachmentPart(xopPart); + + 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(); + } + + +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java 2006-06-30 08:49:02 UTC (rev 525) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java 2006-06-30 08:55:45 UTC (rev 526) @@ -0,0 +1,126 @@ +package org.jboss.ws.xop; + +import org.apache.xerces.xs.*; + +import java.util.List; +import java.util.ArrayList; + +/** + * 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: + * + * <code> <pre> + * <xs:complexType name="MyXOPElement" > + * <xs:simpleContent> + * <xs:extension base="xs:base64Binary" > + * <xs:attribute ref="xmime:contentType" /> + * </xs:extension> + * </xs:simpleContent> + * </xs:complexType> + * </pre></code> + * + * @author Heiko Braun <hei...@jb...> + * @since Jun 9, 2006 + */ +public class XOPScanner { + + // avoid circular scans + private List<String> scannedItems = new ArrayList<String>(); + + /** + * Query a complex type for nested XOP type definitions. + */ + public XSTypeDefinition findXOPTypeDef(XSTypeDefinition typeDef) + { + XSTypeDefinition result = null; + + if(typeDef instanceof XSComplexTypeDefinition) + { + XSComplexTypeDefinition complexTypeDef = (XSComplexTypeDefinition)typeDef; + String name = complexTypeDef.getName(); + String namespace = complexTypeDef.getNamespace()!=null ? complexTypeDef.getNamespace():""; + if(name!=null) + { + String typeKey = namespace+":"+name; + + if(scannedItems.contains(typeKey)) + { + return null; + } + else + { + scannedItems.add(typeKey); + } + } + + //System.out.println("ct -> " + complexTypeDef); + + /*for(int x=0; x<complexTypeDef.getAttributeUses().getLength(); x++) + { + // TODO: access content type attribute value + XSAttributeUseImpl att = (XSAttributeUseImpl)complexTypeDef.getAttributeUses().item(x); + //System.out.println("! " + att.getAttrDeclaration().getName()); + }*/ + + // 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 ("base64Binary".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<xm.getParticles().getLength(); i++ ) + { + XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm(); + + // Can be either XSModelGroup, XSWildcard, XSElementDeclaration + // We only proceed with XSElementDeclaration + if(xsterm instanceof XSElementDeclaration) + { + XSElementDeclaration xe = (XSElementDeclaration)xsterm; + XSTypeDefinition nestedTypeDef = xe.getTypeDefinition(); + + //System.out.println("Query nested -> " + xe.getName()); + result = findXOPTypeDef(nestedTypeDef); + } + } + } + } + } + + } + + //System.out.println("result -> " + result); + + } + + return result; + + } + + public void reset() + { + scannedItems.clear(); + } + +} \ No newline at end of file Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java 2006-06-30 08:49:02 UTC (rev 525) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java 2006-06-30 08:55:45 UTC (rev 526) @@ -0,0 +1,118 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ws.xop; + +import org.jboss.logging.Logger; +import org.jboss.ws.WSException; +import org.jboss.ws.soap.MessageContextAssociation; +import org.jboss.ws.soap.SOAPMessageContextImpl; +import org.jboss.ws.soap.SOAPMessageImpl; +import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller; +import org.jboss.xb.binding.sunday.xop.XOPObject; + +import javax.activation.DataHandler; +import javax.xml.soap.AttachmentPart; +import javax.xml.soap.SOAPException; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +/** + * The XOPUnmarshallerImpl allows callbacks from the binding layer towards the + * soap processing components in order to optimize binary processing. + * + * @see XOPMarshallerImpl + * @see org.jboss.ws.jaxrpc.encoding.JAXBDeserializer + * @see org.jboss.ws.jaxrpc.encoding.SimpleDeserializer + * + * @author Heiko Braun <hei...@jb...> + * @since May 9, 2006 + */ +public class XOPUnmarshallerImpl implements XOPUnmarshaller { + + private static final Logger log = Logger.getLogger(XOPUnmarshallerImpl.class); + + public boolean isXOPPackage() + { + return XOPContext.isXOPPackage(); + } + + public XOPObject getAttachmentAsDataHandler(String cid) + { + try + { + AttachmentPart part = getAttachementByCID(cid); + + XOPObject xopObject = new XOPObject(part.getDataHandler().getContent()); + xopObject.setContentType(part.getDataHandler().getContentType()); + + return xopObject; + } + catch (SOAPException ex) + { + throw new WSException(ex); + } + catch(IOException e) + { + throw new WSException("Unable to retrieve content for cid:" + cid, e); + } + + } + + public byte[] getAttachmentAsByteArray(String cid) + { + try + { + AttachmentPart part = getAttachementByCID(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); + } + + } + + private AttachmentPart getAttachementByCID(String cid) throws SOAPException + { + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage(); + + // 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; + } + +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java =================================================================== --- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java 2006-06-30 08:49:02 UTC (rev 525) +++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java 2006-06-30 08:55:45 UTC (rev 526) @@ -0,0 +1,8 @@ +package org.jboss.ws.xop; + +/** + * @author Heiko Braun <hei...@jb...> + * @since Jun 30, 2006 + */ +public class XOPinlineBuilder { +} Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF |
From: <jbo...@li...> - 2006-06-30 08:49:07
|
Author: hei...@jb... Date: 2006-06-30 04:49:02 -0400 (Fri, 30 Jun 2006) New Revision: 525 Added: branches/jbossws-1.0_SchemaBindingMarshaller/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java Log: missing Added: branches/jbossws-1.0_SchemaBindingMarshaller/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java =================================================================== --- branches/jbossws-1.0_SchemaBindingMarshaller/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java 2006-06-30 07:06:24 UTC (rev 524) +++ branches/jbossws-1.0_SchemaBindingMarshaller/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java 2006-06-30 08:49:02 UTC (rev 525) @@ -0,0 +1,8 @@ +package org.jboss.ws.xop; + +/** + * @author Heiko Braun <hei...@jb...> + * @since Jun 30, 2006 + */ +public class XOPinlineBuilder { +} Property changes on: branches/jbossws-1.0_SchemaBindingMarshaller/src/main/java/org/jboss/ws/xop/XOPinlineBuilder.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF |
From: <jbo...@li...> - 2006-06-30 08:05:24
|
Author: wrzep Date: 2006-06-30 04:05:20 -0400 (Fri, 30 Jun 2006) New Revision: 4886 Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java Log: JBLAB-599 Pawel Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-06-30 07:55:51 UTC (rev 4885) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-06-30 08:05:20 UTC (rev 4886) @@ -218,18 +218,20 @@ try { ScoresManager.save(projects, pluginsConf); - - pluginsValues = ScoresManager.getLatestScores(); - } catch (ScoresSaveException e) { log.warn("Saving scores failed."); - } catch (GetScoresException e) { - log.warn("Failed to get lates scores."); } } - if (pluginsValues != null) { + try { + pluginsValues = ScoresManager.getLatestScores(); + } catch (GetScoresException e) { + log.warn("Failed to get lates scores."); + } + if ((pluginsValues != null) && + (!pluginsValues.getDate().equals(updateDate))) { + refreshScores(pluginsValues); log.info("Refreshed scores."); return true; |
From: <jbo...@li...> - 2006-06-30 07:55:55
|
Author: wrzep Date: 2006-06-30 03:55:51 -0400 (Fri, 30 Jun 2006) New Revision: 4885 Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java Log: JBLAB-599 minor fix Pawel Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-06-30 07:15:55 UTC (rev 4884) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-06-30 07:55:51 UTC (rev 4885) @@ -232,9 +232,10 @@ refreshScores(pluginsValues); log.info("Refreshed scores."); + return true; } - return true; + return false; } private boolean needsSave(Calendar date) { |
From: <jbo...@li...> - 2006-06-30 07:16:00
|
Author: wrzep Date: 2006-06-30 03:15:55 -0400 (Fri, 30 Jun 2006) New Revision: 4884 Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java Log: JBLAB-599 Perform save after restart to notice conf changes. Pawel Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-06-30 04:46:42 UTC (rev 4883) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-06-30 07:15:55 UTC (rev 4884) @@ -74,6 +74,7 @@ private List<PluginConf> pluginsConf; private Calendar updateDate; + private boolean firstSave = false; /* true iff first save was performed */ private Logger log; @@ -238,6 +239,11 @@ private boolean needsSave(Calendar date) { + if (!firstSave) { + firstSave = true; + return true; + } + Calendar now = Calendar.getInstance(); return (now.get(Calendar.DAY_OF_MONTH) != date.get(Calendar.DAY_OF_MONTH)); |
From: <jbo...@li...> - 2006-06-30 07:06:27
|
Author: tho...@jb... Date: 2006-06-30 03:06:24 -0400 (Fri, 30 Jun 2006) New Revision: 524 Modified: trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java Log: remove inint XSModel Modified: trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java =================================================================== --- trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java 2006-06-30 07:04:32 UTC (rev 523) +++ trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java 2006-06-30 07:06:24 UTC (rev 524) @@ -109,15 +109,9 @@ // Process or generate WSDL String wsdlLocation = anWebServiceProvider.wsdlLocation(); - /* FIXME: JBWS-1026 - processOrGenerateWSDL(wsClass, serviceMetaData, wsdlLocation, sepMetaData); + // FIXME: JBWS-1026 + // processOrGenerateWSDL(wsClass, serviceMetaData, wsdlLocation, sepMetaData); - // Read the generated WSDL and initialize the schema model - WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions(); - JBossXSModel schemaModel = wsdlDefinitions.getWsdlTypes().getSchemaModel(); - serviceMetaData.getTypesMetaData().setSchemaModel(schemaModel); - */ - // Set the endpoint address processPortComponent(udi, wsClass, linkName, sepMetaData); |
From: <jbo...@li...> - 2006-06-30 07:04:36
|
Author: tho...@jb... Date: 2006-06-30 03:04:32 -0400 (Fri, 30 Jun 2006) New Revision: 523 Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java Log: add test wsdl access Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java =================================================================== --- trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java 2006-06-30 06:54:49 UTC (rev 522) +++ trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java 2006-06-30 07:04:32 UTC (rev 523) @@ -50,6 +50,17 @@ return JBossWSTestSetup.newTestSetup(ProviderMessageTestCase.class, "jbossws-jaxws-provider-message.war"); } + public void testWSDLAccess() throws Exception + { + System.out.println("FIXME: JBWS-1026"); + /* + URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jbossws-jaxws-provider-message?wsdl"); + WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance(); + WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL); + assertNotNull(wsdlDefinitions); + */ + } + public void testProviderMessage() throws Exception { String msgString = |
Author: tho...@jb... Date: 2006-06-30 02:54:49 -0400 (Fri, 30 Jun 2006) New Revision: 522 Added: trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java trunk/src/main/java/org/jboss/ws/deployment/AbstractAnnotationsMetaDataBuilder.java trunk/src/main/java/org/jboss/ws/deployment/JAXWSDeployment.java trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java trunk/src/test/java/org/jboss/test/ws/jaxws/ trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanMessage.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayloadJAXB.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java trunk/src/test/java/org/jboss/test/ws/jaxws/provider/UserType.java trunk/src/test/resources/jaxws/ trunk/src/test/resources/jaxws/provider/ trunk/src/test/resources/jaxws/provider/message/ trunk/src/test/resources/jaxws/provider/message/WEB-INF/ trunk/src/test/resources/jaxws/provider/message/WEB-INF/web.xml Removed: trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java Modified: trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java trunk/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientDeployment.java trunk/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java trunk/src/main/java/org/jboss/ws/deployment/JSR181Deployment.java trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java trunk/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorEJB21.java trunk/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorEJB3.java trunk/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorJSE.java trunk/src/main/java/org/jboss/ws/integration/jboss/WebServiceClientDeployer.java trunk/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointServlet.java trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java trunk/src/main/java/org/jboss/ws/jaxrpc/ParameterWrapping.java trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java trunk/src/test/ant/build-jars.xml trunk/src/test/build.xml trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java trunk/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java Log: JBWS-1020: Implement javax.xml.ws.Provider Modified: trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-06-29 12:44:24 UTC (rev 521) +++ trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-06-30 06:54:49 UTC (rev 522) @@ -37,6 +37,9 @@ */ public interface BindingProvider { + static String JAXRPC_SOAP11_BINDING = "org.jboss.ws.binding.jaxrpc.soap11"; + static String JAXWS_MESSAGE_BINDING = "org.jboss.ws.binding.jaxws.message"; + /** On the client side, generate the SOAPMessage from IN parameters. */ SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException; Modified: trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-06-29 12:44:24 UTC (rev 521) +++ trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-06-30 06:54:49 UTC (rev 522) @@ -1,35 +1,34 @@ /* -* JBoss, Home of Professional Open Source -* Copyright 2005, JBoss Inc., and individual contributors as indicated -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ package org.jboss.ws.binding; // $Id$ import java.util.HashMap; -import javax.xml.rpc.JAXRPCException; +import org.jboss.ws.WSException; +import org.jboss.ws.binding.soap.JAXRPCBindingProviderSOAP11; +import org.jboss.ws.binding.soap.JAXWSBindingProviderMessage; -import org.jboss.ws.Constants; -import org.jboss.ws.binding.soap.SOAP11BindingProvider; - /** A registry of binding providers. * * @author Tho...@jb... @@ -37,13 +36,13 @@ */ public class BindingProviderRegistry { - private static Class defaultProvider = SOAP11BindingProvider.class; + private static Class defaultProvider = JAXRPCBindingProviderSOAP11.class; private static HashMap providers = new HashMap(); - // Put the default provider in the map static { - providers.put(Constants.NS_SOAP11_ENV, defaultProvider); + providers.put(BindingProvider.JAXRPC_SOAP11_BINDING, defaultProvider); + providers.put(BindingProvider.JAXWS_MESSAGE_BINDING, JAXWSBindingProviderMessage.class); } /** Get a binding provider for a given URI @@ -65,7 +64,7 @@ } catch (Exception e) { - throw new JAXRPCException(e); + throw new WSException(e); } } @@ -83,7 +82,7 @@ } catch (Exception e) { - throw new JAXRPCException(e); + throw new WSException(e); } } } Copied: trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java (from rev 502, trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java) =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java 2006-06-28 02:58:55 UTC (rev 502) +++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java 2006-06-30 06:54:49 UTC (rev 522) @@ -0,0 +1,795 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ws.binding.soap; + +// $Id$ + +import org.apache.xerces.xs.XSElementDeclaration; +import org.apache.xerces.xs.XSTypeDefinition; +import org.jboss.logging.Logger; +import org.jboss.util.xml.DOMUtils; +import org.jboss.ws.Constants; +import org.jboss.ws.WSException; +import org.jboss.ws.binding.BindingException; +import org.jboss.ws.binding.BindingProvider; +import org.jboss.ws.binding.EndpointInvocation; +import org.jboss.ws.binding.UnboundHeader; +import org.jboss.ws.jaxrpc.ParameterWrapping; +import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper; +import org.jboss.ws.jaxrpc.Style; +import org.jboss.ws.metadata.OperationMetaData; +import org.jboss.ws.metadata.ParameterMetaData; +import org.jboss.ws.metadata.TypesMetaData; +import org.jboss.ws.soap.*; +import org.jboss.ws.soap.attachment.AttachmentPartImpl; +import org.jboss.ws.soap.attachment.CIDGenerator; +import org.jboss.ws.soap.attachment.MimeConstants; +import org.jboss.ws.utils.JavaUtils; +import org.jboss.ws.utils.MimeUtils; +import org.jboss.xb.binding.NamespaceRegistry; +import org.w3c.dom.Element; + +import javax.activation.DataHandler; +import javax.xml.namespace.QName; +import javax.xml.rpc.JAXRPCException; +import javax.xml.rpc.ParameterMode; +import javax.xml.rpc.soap.SOAPFaultException; +import javax.xml.soap.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +/** An abstract BindingProvider for SOAP that is independent of the SOAP version. + * + * @author Tho...@jb... + * @since 16-Oct-2004 + */ +public abstract class JAXRPCBindingProvider implements BindingProvider +{ + // provide logging + private static final Logger log = Logger.getLogger(JAXRPCBindingProvider.class); + + /** Create the SOAPMessage */ + protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException; + + /** On the client side, generate the payload from IN parameters. */ + public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException + { + log.debug("bindRequestMessage: " + opMetaData.getXmlName()); + + try + { + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + if (msgContext == null) + throw new WSException("MessageContext not available"); + + // Associate current message with message context + SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData); + msgContext.setMessage(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(); + if (style == Style.RPC) + { + QName opQName = opMetaData.getXmlName(); + Name opName = new NameImpl(namespaceRegistry.registerQName(opQName)); + + log.debug("Create RPC body element: " + opName); + SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName); + + soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement); + + for (ParameterMetaData paramMetaData : opMetaData.getInputParameters()) + { + QName xmlName = paramMetaData.getXmlName(); + Object value = epInv.getRequestParamValue(xmlName); + + if (paramMetaData.isSwA()) + { + CIDGenerator cidGenerator = reqMessage.getCidGenerator(); + AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator); + reqMessage.addAttachmentPart(part); + } + else + { + SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBodyElement; + SOAPContentElement contentElement = addParameterToMessage(paramMetaData, value, soapElement); + + } + } + } + else if (style == Style.DOCUMENT) + { + for (ParameterMetaData paramMetaData : opMetaData.getInputParameters()) + { + QName xmlName = paramMetaData.getXmlName(); + Object value = epInv.getRequestParamValue(xmlName); + + if (paramMetaData.isSwA()) + { + CIDGenerator cidGenerator = reqMessage.getCidGenerator(); + AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator); + reqMessage.addAttachmentPart(part); + } + else + { + SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBody; + addParameterToMessage(paramMetaData, value, soapElement); + } + } + } + else + { + throw new WSException("Unsupported message style: " + style); + } + + // 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()); + + SOAPContentElement contentElement = new SOAPHeaderElementImpl(soapName); + contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData)); + contentElement.setObjectValue(value); + + log.debug("Add unboundHeader element: " + soapName); + soapHeader.addChildElement(contentElement); + } + } + } + + return reqMessage; + } + catch (Exception e) + { + handleException(e); + return null; + } + } + + /** On the server side, extract the IN parameters from the payload and populate an Invocation object */ + public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException + { + log.debug("unbindRequestMessage: " + opMetaData.getXmlName()); + + try + { + // Read the SOAPEnvelope from the reqMessage + SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope(); + SOAPHeader soapHeader = soapEnvelope.getHeader(); + SOAPBody soapBody = soapEnvelope.getBody(); + + // Construct the endpoint invocation object + EndpointInvocation epInv = new EndpointInvocation(opMetaData); + + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + if (msgContext == null) + throw new WSException("MessageContext not available"); + + // Get the namespace registry + NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry(); + + if (opMetaData.isMessageEndpoint() == false) + { + Style style = opMetaData.getStyle(); + if (style == Style.RPC) + { + SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next(); + Name elName = soapBodyElement.getElementName(); + + QName elQName = new QName(elName.getURI(), elName.getLocalName(), elName.getPrefix()); + elQName = namespaceRegistry.registerQName(elQName); + + for (ParameterMetaData paramMetaData : opMetaData.getParameters()) + { + QName xmlName = paramMetaData.getXmlName(); + if (paramMetaData.getMode() == ParameterMode.OUT) + { + epInv.setRequestParamValue(xmlName, null); + } + else + { + if (paramMetaData.isSwA()) + { + Object value = getAttachmentFromMessage(paramMetaData, reqMessage); + epInv.setRequestParamValue(xmlName, value); + } + else + { + if (paramMetaData.isInHeader() == false) + { + Object value = getParameterFromMessage(paramMetaData, soapBodyElement, false); + epInv.setRequestParamValue(xmlName, value); + } + else + { + Object value = getParameterFromMessage(paramMetaData, soapHeader, false); + epInv.setRequestParamValue(xmlName, value); + } + } + } + } + } + + // Document style + else + { + for (ParameterMetaData paramMetaData : opMetaData.getParameters()) + { + QName xmlName = paramMetaData.getXmlName(); + if (paramMetaData.isSwA()) + { + Object value = getAttachmentFromMessage(paramMetaData, reqMessage); + epInv.setRequestParamValue(xmlName, value); + } + else + { + if (paramMetaData.isInHeader()) + { + if (paramMetaData.getMode() == ParameterMode.IN) + { + Object value = getParameterFromMessage(paramMetaData, soapHeader, false); + epInv.setRequestParamValue(xmlName, value); + } + else + { + Object value = getParameterFromMessage(paramMetaData, soapHeader, true); + epInv.setRequestParamValue(xmlName, value); + } + } + else + { + Object value = getParameterFromMessage(paramMetaData, soapBody, false); + epInv.setRequestParamValue(xmlName, value); + } + } + } + } + } + + // 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 SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException + { + log.debug("bindResponseMessage: " + opMetaData.getXmlName()); + + try + { + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + if (msgContext == null) + throw new WSException("MessageContext not available"); + + // Associate current message with message context + SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData); + msgContext.setMessage(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. + if (opMetaData.isOneWayOperation()) + { + 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(); + if (style == Style.RPC) + { + QName opQName = opMetaData.getResponseName(); + + Name opName = new NameImpl(namespaceRegistry.registerQName(opQName)); + SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName); + + soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement); + + // Add the return to the message + ParameterMetaData retMetaData = opMetaData.getReturnParameter(); + if (retMetaData != null) + { + Object value = epInv.getReturnValue(); + if (retMetaData.isSwA()) + { + CIDGenerator cidGenerator = resMessage.getCidGenerator(); + AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator); + resMessage.addAttachmentPart(part); + epInv.setReturnValue(part); + } + 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(retMetaData, value, cidGenerator); + resMessage.addAttachmentPart(part); + } + else + { + if (paramMetaData.isInHeader()) + { + addParameterToMessage(paramMetaData, value, soapHeader); + } + else + { + addParameterToMessage(paramMetaData, value, soapBodyElement); + } + } + } + } + else if (style == Style.DOCUMENT) + { + ParameterMetaData retMetaData = opMetaData.getReturnParameter(); + if (retMetaData != null) + { + Object value = epInv.getReturnValue(); + if (opMetaData.isDocumentWrapped()) + value = ParameterWrapping.wrapResponseParameter(opMetaData, value); + + if (retMetaData.isSwA()) + { + CIDGenerator cidGenerator = resMessage.getCidGenerator(); + AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator); + resMessage.addAttachmentPart(part); + epInv.setReturnValue(part); + } + else + { + SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBody); + epInv.setReturnValue(soapElement); + } + } + + // Add the out header parameters to the message + for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters()) + { + QName xmlName = paramMetaData.getXmlName(); + if (paramMetaData.isInHeader()) + { + Object value = epInv.getResponseParamValue(xmlName); + addParameterToMessage(paramMetaData, value, soapHeader); + } + } + } + else + { + throw new WSException("Unsupported message style: " + style); + } + + 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, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) + throws BindingException + { + log.debug("unbindResponseMessage: " + opMetaData.getXmlName()); + + 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.isOneWayOperation() == true) + { + return; + } + + // WS-Addressing might redirect the response, which results in an empty envelope + SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope(); + if (soapEnvelope == null) + { + return; + } + + // Get the SOAP message context that is associated with the current thread + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + if (msgContext == null) + throw new WSException("MessageContext not available"); + + SOAPHeader soapHeader = soapEnvelope.getHeader(); + SOAPBody soapBody = soapEnvelope.getBody(); + Iterator bodyChildren = soapBody.getChildElements(); + + SOAPBodyElement soapBodyElement = null; + if (bodyChildren.hasNext() != false) + soapBodyElement = (SOAPBodyElement)bodyChildren.next(); + + // Translate the SOAPFault to an exception and throw it + if (soapBodyElement instanceof SOAPFaultImpl) + { + SOAPFaultImpl soapFault = (SOAPFaultImpl)soapBodyElement; + SOAPFaultException faultEx = SOAPFaultExceptionHelper.getSOAPFaultException(soapFault); + throw faultEx; + } + + // Extract unbound OUT headers + if (unboundHeaders != null) + { + Map<QName, UnboundHeader> outHeaders = new HashMap<QName, UnboundHeader>(); + 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(); + if (style == Style.RPC) + { + ParameterMetaData retMetaData = opMetaData.getReturnParameter(); + if (retMetaData != null) + { + if (retMetaData.isSwA()) + { + Object value = getAttachmentFromMessage(retMetaData, resMessage); + epInv.setReturnValue(value); + } + else + { + Object value = getParameterFromMessage(retMetaData, soapBodyElement, false); + epInv.setReturnValue(value); + } + } + + for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters()) + { + QName xmlName = paramMetaData.getXmlName(); + if (paramMetaData.isSwA()) + { + Object value = getAttachmentFromMessage(paramMetaData, resMessage); + epInv.setResponseParamValue(xmlName, value); + } + else + { + SOAPElement soapElement = paramMetaData.isInHeader() ? soapHeader : (SOAPElement)soapBodyElement; + Object value = getParameterFromMessage(paramMetaData, soapElement, false); + epInv.setResponseParamValue(xmlName, value); + } + } + } + else if (style == Style.DOCUMENT) + { + ParameterMetaData retMetaData = opMetaData.getReturnParameter(); + + // WS-Eventing has no message part for UnsubscribeResponseMsg + if (retMetaData != null) + { + if (retMetaData.isSwA()) + { + Object value = getAttachmentFromMessage(retMetaData, resMessage); + epInv.setReturnValue(value); + } + else + { + Object value = getParameterFromMessage(retMetaData, soapBody, false); + epInv.setReturnValue(value); + } + + for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters()) + { + QName xmlName = paramMetaData.getXmlName(); + if (paramMetaData.isInHeader()) + { + Object value = getParameterFromMessage(paramMetaData, soapHeader, false); + epInv.setResponseParamValue(xmlName, value); + } + } + } + } + else + { + throw new WSException("Unsupported message style: " + style); + } + } + catch (Exception e) + { + handleException(e); + } + } + + 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()); + + if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes)) + throw new BindingException("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 Object 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) + { + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry(); + xmlName = namespaceRegistry.registerQName(xmlName); + } + + Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI()); + if (paramMetaData.isSOAPArrayParam()) + soapName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC); + + 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()) + contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC); + + // The object value needs to be set after xmime:contentType + if (paramMetaData.isXOP() == false) + { + contentElement.setObjectValue(value); + } + else + { + contentElement.setXMimeContentType(MimeUtils.resolveMimeType(value)); + contentElement.setObjectValue(value); + } + + return contentElement; + } + + /** Unmarshall a message element and add it to the parameter list + * @param optional TODO*/ + private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement soapElement, boolean optional) throws BindingException + { + Name xmlName = new NameImpl(paramMetaData.getXmlName()); + Name soapArrayName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC); + + SOAPContentElement soapContentElement = null; + Iterator childElements = soapElement.getChildElements(); + while (childElements.hasNext()) + { + SOAPElementImpl childElement = (SOAPElementImpl)childElements.next(); + + // 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 (soapArrayName.equals(elName)) + { + QName compXMLName = paramMetaData.getXmlName(); + Element compElement = DOMUtils.getFirstChildElement(aux); + if (compElement.getNodeName().equals(compXMLName.getLocalPart())) + { + soapContentElement = aux; + soapContentElement.setParamMetaData(paramMetaData); + break; + } + } + } + + // 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 JAXRPCException("Cannot find child element: " + xmlName); + + if(paramMetaData.isXOP()) + soapContentElement.setXMimeContentType(MimeUtils.resolveMimeType(paramMetaData.getJavaType())); + return soapContentElement; + } + + 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); + } +} Copied: trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java (from rev 502, trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java) =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java 2006-06-28 02:58:55 UTC (rev 502) +++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java 2006-06-30 06:54:49 UTC (rev 522) @@ -0,0 +1,67 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.ws.binding.soap; + +// $Id$ + +import java.util.Map; + +import javax.xml.namespace.QName; +import javax.xml.soap.MimeHeaders; +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPMessage; + +import org.jboss.ws.Constants; +import org.jboss.ws.binding.BindingException; +import org.jboss.ws.binding.EndpointInvocation; +import org.jboss.ws.binding.UnboundHeader; +import org.jboss.ws.metadata.OperationMetaData; +import org.jboss.ws.soap.MessageFactoryImpl; + +/** A BindingProvider that implements the SOAP-1.1 specifics. + * + * @author Tho...@jb... + * @since 09-Nov-2004 + */ +public class JAXRPCBindingProviderSOAP11 extends JAXRPCBindingProvider +{ + /** Create the SOAP-1.1 message */ + protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException + { + MessageFactoryImpl factory = new MessageFactoryImpl(); + factory.setEnvelopeURI(Constants.NS_SOAP11_ENV); + return factory.createMessage(); + } + + /** On the client side, generate the payload from IN parameters. */ + public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException + { + SOAPMessage reqMessage = super.bindRequestMessage(opMetaData, epInv, unboundHeaders); + + // Set the SOAPAction + MimeHeaders mimeHeaders = reqMessage.getMimeHeaders(); + String soapAction = opMetaData.getSOAPAction(); + mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : ""); + + return reqMessage; + } +} Copied: trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java (from rev 502, trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java) =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java 2006-06-28 02:58:55 UTC (rev 502) +++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java 2006-06-30 06:54:49 UTC (rev 522) @@ -0,0 +1,47 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.ws.binding.soap; + +// $Id$ + +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPMessage; + +import org.jboss.ws.Constants; +import org.jboss.ws.metadata.OperationMetaData; +import org.jboss.ws.soap.MessageFactoryImpl; + +/** A BindingProvider that implements the SOAP-1.2 specifics. + * + * @author Tho...@jb... + * @since 09-Nov-2004 + */ +public class JAXRPCBindingProviderSOAP12 extends JAXRPCBindingProvider +{ + /** Create the SOAP-1.2 message */ + protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException + { + MessageFactoryImpl factory = new MessageFactoryImpl(); + factory.setEnvelopeURI(Constants.NS_SOAP12_ENV); + return factory.createMessage(); + } +} Added: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java 2006-06-29 12:44:24 UTC (rev 521) +++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java 2006-06-30 06:54:49 UTC (rev 522) @@ -0,0 +1,127 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.ws.binding.soap; + +// $Id$ + +import java.util.Map; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPMessage; + +import org.jboss.logging.Logger; +import org.jboss.util.NotImplementedException; +import org.jboss.ws.WSException; +import org.jboss.ws.binding.BindingException; +import org.jboss.ws.binding.BindingProvider; +import org.jboss.ws.binding.EndpointInvocation; +import org.jboss.ws.binding.UnboundHeader; +import org.jboss.ws.metadata.OperationMetaData; +import org.jboss.ws.metadata.ParameterMetaData; +import org.jboss.ws.soap.MessageContextAssociation; +import org.jboss.ws.soap.SOAPMessageContextImpl; + +/** A BindingProvider for unprocessed SOAP Messages + * + * @author Tho...@jb... + * @since 27-Jun-2006 + */ +public class JAXWSBindingProviderMessage implements BindingProvider +{ + // provide logging + private static final Logger log = Logger.getLogger(JAXWSBindingProviderMessage.class); + + /** On the client side, generate the payload from IN parameters. */ + public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> 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, SOAPMessage reqMessage) throws BindingException + { + log.debug("unbindRequestMessage: " + opMetaData.getXmlName()); + + try + { + // Construct the endpoint invocation object + EndpointInvocation epInv = new EndpointInvocation(opMetaData); + + SOAPMessageContextImpl msgContext = 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 SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException + { + log.debug("bindResponseMessage: " + opMetaData.getXmlName()); + + try + { + SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext(); + if (msgContext == null) + throw new WSException("MessageContext not available"); + + // Associate current message with message context + SOAPMessage resMessage = (SOAPMessage)epInv.getReturnValue(); + msgContext.setMessage(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, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) + throws BindingException + { + throw new NotImplementedException(); + } + + 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); + } +} Property changes on: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java ___________________________________________________________________ Name: svn:keywords + Id Revision Name: svn:eol-style + LF Deleted: trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java 2006-06-29 12:44:24 UTC (rev 521) +++ trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java 2006-06-30 06:54:49 UTC (rev 522) @@ -1,67 +0,0 @@ -/* -* JBoss, Home of Professional Open Source -* Copyright 2005, JBoss Inc., and individual contributors as indicated -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ -package org.jboss.ws.binding.soap; - -// $Id$ - -import java.util.Map; - -import javax.xml.namespace.QName; -import javax.xml.soap.MimeHeaders; -import javax.xml.soap.SOAPException; -import javax.xml.soap.SOAPMessage; - -import org.jboss.ws.Constants; -import org.jboss.ws.binding.BindingException; -import org.jboss.ws.binding.EndpointInvocation; -import org.jboss.ws.binding.UnboundHeader; -import org.jboss.ws.metadata.OperationMetaData; -import org.jboss.ws.soap.MessageFactoryImpl; - -/** A BindingProvider that implements the SOAP-1.1 specifics. - * - * @author Tho...@jb... - * @since 09-Nov-2004 - */ -public class SOAP11BindingProvider extends SOAPBindingProvider -{ - /** Create the SOAP-1.1 message */ - protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException - { - MessageFactoryImpl factory = new MessageFactoryImpl(); - factory.setEnvelopeURI(Constants.NS_SOAP11_ENV); - return factory.createMessage(); - } - - /** On the client side, generate the payload from IN parameters. */ - public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException - { - SOAPMessage reqMessage = super.bindRequestMessage(opMetaData, epInv, unboundHeaders); - - // Set the SOAPAction - MimeHeaders mimeHeaders = reqMessage.getMimeHeaders(); - String soapAction = opMetaData.getSOAPAction(); - mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : ""); - - return reqMessage; - } -} Deleted: trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java 2006-06-29 12:44:24 UTC (rev 521) +++ trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java 2006-06-30 06:54:49 UTC (rev 522) @@ -1,47 +0,0 @@ -/* -* JBoss, Home of Professional Open Source -* Copyright 2005, JBoss Inc., and individual contributors as indicated -* by the @authors tag. See the copyright.txt in the distribution for a -* full listing of individual contributors. -* -* This is free software; you can redistribute it and/or modify it -* under the terms of the GNU Lesser General Public License as -* published by the Free Software Foundation; either version 2.1 of -* the License, or (at your option) any later version. -* -* This software is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this software; if not, write to the Free -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA, or see the FSF site: http://www.fsf.org. -*/ -package org.jboss.ws.binding.soap; - -// $Id$ - -import javax.xml.soap.SOAPException; -import javax.xml.soap.SOAPMessage; - -import org.jboss.ws.Constants; -import org.jboss.ws.metadata.OperationMetaData; -import org.jboss.ws.soap.MessageFactoryImpl; - -/** A BindingProvider that implements the SOAP-1.2 specifics. - * - * @author Tho...@jb... - * @since 09-Nov-2004 - */ -public class SOAP12BindingProvider extends SOAPBindingProvider -{ - /** Create the SOAP-1.2 message */ - protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException - { - MessageFactoryImpl factory = new MessageFactoryImpl(); - factory.setEnvelopeURI(Constants.NS_SOAP12_ENV); - return factory.createMessage(); - } -} Deleted: trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java =================================================================== --- trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java 2006-06-29 12:44:24 UTC (rev 521) +++ trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java 2006-06-30 06:54:49 UTC (rev 522) @@ -1,795 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.ws.binding.soap; - -// $Id$ - -import org.apache.xerces.xs.XSElementDeclaration; -import org.apache.xerces.xs.XSTypeDefinition; -import org.jboss.logging.Logger; -import org.jboss.util.xml.DOMUtils; -import org.jboss.ws.Constants; -import org.jboss.ws.WSException; -import org.jboss.ws.binding.BindingException; -import org.jboss.ws.binding.BindingProvider; -import org.jboss.ws.binding.EndpointInvocation; -import org.jboss.ws.binding.UnboundHeader; -import org.jboss.ws.jaxrpc.ParameterWrapping; -import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper; -import org.jboss.ws.jaxrpc.Style; -import org.jboss.ws.metadata.OperationMetaData; -import org.jboss.ws.metadata.ParameterMetaData; -import org.jboss.ws.metadata.TypesMetaData; -import org.jboss.ws.soap.*; -import org.jboss.ws.soap.attachment.AttachmentPartImpl; -import org.jboss.ws.soap.attachment.CIDGenerator; -import org.jboss.ws.soap.attachment.MimeConstants; -import org.jboss.ws.utils.JavaUtils; -import org.jboss.ws.utils.MimeUtils; -import org.jboss.xb.binding.NamespaceRegistry; -import org.w3c.dom.Element; - -import javax.activation.DataHandler; -import javax.xml.namespace.QName; -import javax.xml.rpc.JAXRPCException; -import javax.xml.rpc.ParameterMode; -import javax.xml.rpc.soap.SOAPFaultException; -import javax.xml.soap.*; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -/** An abstract BindingProvider for SOAP that is independent of the SOAP version. - * - * @author Tho...@jb... - * @since 16-Oct-2004 - */ -public abstract class SOAPBindingProvider implements BindingProvider -{ - // provide logging - private static final Logger log = Logge... [truncated message content] |
From: <jbo...@li...> - 2006-06-30 04:46:46
|
Author: mar...@jb... Date: 2006-06-30 00:46:42 -0400 (Fri, 30 Jun 2006) New Revision: 4883 Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java Log: JBRULES-354 Date parsing fail in unit tests if non-english locale environment -Hardcoded to english locale Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java 2006-06-30 01:43:01 UTC (rev 4882) +++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java 2006-06-30 04:46:42 UTC (rev 4883) @@ -21,6 +21,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import junit.framework.TestCase; @@ -147,7 +148,7 @@ public void testDate() throws Exception { - final SimpleDateFormat df = new SimpleDateFormat( "dd-MMM-yyyy" ); + final SimpleDateFormat df = new SimpleDateFormat( "dd-MMM-yyyy", Locale.ENGLISH ); //note that strings are also allowed on the right final Object[][] data = {{df.parse( "10-Jul-1974" ), "==", df.parse( "10-Jul-1974" ), Boolean.TRUE}, {df.parse( "10-Jul-1974" ), "<", df.parse( "11-Jul-1974" ), Boolean.TRUE}, |
From: <jbo...@li...> - 2006-06-30 01:43:09
|
Author: tirelli Date: 2006-06-29 21:43:01 -0400 (Thu, 29 Jun 2006) New Revision: 4882 Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Eval.drl Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java Log: Adding integration test for JBRULES-318 Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2006-06-30 01:34:49 UTC (rev 4881) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2006-06-30 01:43:01 UTC (rev 4882) @@ -2496,37 +2496,20 @@ public void FIXME_testEval2() throws Exception { final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Eval.drl" ) ); - WorkingMemoryFileLogger logger = null; - try { - final PackageBuilder builder = new PackageBuilder(); - builder.addPackageFromDrl( reader ); - final Package pkg1 = builder.getPackage(); + final PackageBuilder builder = new PackageBuilder(); + builder.addPackageFromDrl( reader ); + final Package pkg1 = builder.getPackage(); - final RuleBase ruleBase = getRuleBase(); - ruleBase.addPackage( pkg1 ); - final WorkingMemory workingMemory = ruleBase.newWorkingMemory(); - -// logger = new WorkingMemoryFileLogger(workingMemory); -// logger.setFileName( "logger.log" ); -// DebugWorkingMemoryEventListener l1 = new DebugWorkingMemoryEventListener(); -// workingMemory.addEventListener( l1 ); -// DebugAgendaEventListener l2 = new DebugAgendaEventListener(); -// workingMemory.addEventListener( l2 ); - - final int MAX = 3; - for (int i=1 ; i<=MAX; i++) { - IndexedNumber n = new IndexedNumber(i, MAX - i + 1); - workingMemory.assertObject(n); - } - workingMemory.fireAllRules(); - - } catch ( RuntimeException e ) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { -// logger.writeToDisk(); + final RuleBase ruleBase = getRuleBase(); + ruleBase.addPackage( pkg1 ); + final WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + + final int MAX = 3; + for (int i=1 ; i<=MAX; i++) { + IndexedNumber n = new IndexedNumber(i, MAX - i + 1); + workingMemory.assertObject(n); } - + workingMemory.fireAllRules(); } } Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Eval.drl =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Eval.drl 2006-06-30 01:34:49 UTC (rev 4881) +++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Eval.drl 2006-06-30 01:43:01 UTC (rev 4882) @@ -0,0 +1,45 @@ +#created on: 12 juin 2006 +package Number + +import org.drools.IndexedNumber; + +rule "Order" +salience 200 + when + #Doesnt work + n1 : IndexedNumber($nb1 : number); + n2 : IndexedNumber(number < $nb1); + eval(n1.getIndex() < n2.getIndex()); + + #Works great + #n1 : IndexedNumber($nb1 : number, $index1 : index); + #n2 : IndexedNumber($nb2 : number -> ($nb2.compareTo($nb1) < 0), index > $index1); + then + System.out.println("Swapping " + n1 + " with " + n2); + check(n1, n2); + swap(n1, n2); + modify(n1); + modify(n2); +end + +rule "Debug" +salience 10 + when + n : IndexedNumber($idx : index); + not IndexedNumber(index < $idx); + then + System.out.println("Number is " + n); + retract(n); +end + +function void check(IndexedNumber n1, IndexedNumber n2) { + if ( ! (n1.getIndex() < n2.getIndex())) { + System.out.println("Shouldn't come here... " + n1 + " " + n2); + } +} + +function void swap(IndexedNumber n1, IndexedNumber n2) { + int tmp = n1.getIndex(); + n1.setIndex(n2.getIndex()); + n2.setIndex(tmp); +} \ No newline at end of file Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Eval.drl ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native |